Investment Studio > Expressions > Functions > Statistical > ZTEST

float ztest(float array data, float x, float standard_deviation = stdev(data))

Returns the two-tailed probability value of a z test on the value x and the population sample in data, i.e. the probability that the value x is drawn from the same population as data.

data contains values sampled from a population known to be normally distributed (see normdist). All array elements are converted to float, with exclusion if conversion fails.

x is the value to test.

standard_deviation is the known standard deviation of the population from which data is sampled. If standard_deviation is omitted, it defaults to the estimate stdev(data).

Given N data values, ztest is equivalent to the expression

=1 - normsdist((average(data) - x) * sqrt(N) / standard_deviation)

Example

=ztest({1, 6, 3, 7, 3, 6, 9, 4, 6, 8, 0, 4, 5 ,3}, 3)

returns 0.00817675792810135.

See also chitest, confidence, ftest, normdist, normsdist, normsinv, standardize, ttest.