ZTEST
function ZTEST(arg1: number[] | ApiRange = null, arg2: number = null, arg3: number = null): number
Description
Returns the one-tailed P-value of a z-test.
Parameters
The array or range of data against which to test X.
- arg2
number
null The value to test.
- arg3
number
null The population (known) standard deviation. If omitted, the sample standard deviation is used.
Returns
number
Try It
var oWorksheet = Api.GetActiveSheet();
var argumentsArr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
// Place the numbers in cells
for (var i = 0; i < argumentsArr.length; i++) {
oWorksheet.GetRange("A" + (i + 1)).SetValue(argumentsArr[i]);
}
// Get values from the range
var data = oWorksheet.GetRange("A1:A16");
// Calculate the TRIMMEAN of the range A1:A16
var oFunction = Api.GetWorksheetFunction();
var result = oFunction.ZTEST(data, 0.4);
oWorksheet.GetRange("B1").SetValue(result);