BUILT-IN MATHEMATICA SYMBOL

# ZTest

ZTest[data]
tests whether the mean of the data is zero.

ZTest[{data1, data2}]
tests whether the means of and are equal.

ZTest[dspec, ]
tests for zero or equal means assuming a population variance .

ZTest[dspec, , 0]
tests the mean against.

ZTest[dspec, , 0, "property"]
returns the value of .

## Details and OptionsDetails and Options

• ZTest performs a hypothesis test on data with null hypothesis that the true population mean is some value , and alternative hypothesis that .
• Given and , ZTest tests that against that .
• By default a probability value or -value is returned.
• A small -value suggests that it is unlikely that is true.
• The data in dspec can be univariate or multivariate .
• Given one dataset, the argument can be any positive real number or a positive definite matrix with dimension equal to the dimension of data.
• Given two datasets, the argument can be any positive real number, a positive definite matrix with dimension equal to the dimension of dspec, or two such numbers or matrices.
• The argument can be a real number or a real vector with length equal to the dimension of the data.
• ZTest assumes that the data is normally distributed and that the variance is known and not estimated from the data.
• If variances or covariance matrices are not provided, ZTest treats the sample estimate as the known variance or covariance.
• ZTest[dspec, , 0, "HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
• ZTest[dspec, , 0, "property"] can be used to directly give the value of .
• Properties related to the reporting of test results include:
•  "DegreesOfFreedom" the degrees of freedom of a test "PValue" list of -values "PValueTable" formatted table of -values "TestData" list of pairs of test statistics and -values "TestDataTable" formatted table of -values and test statistics "TestStatistic" list of test statistics "TestStatisticTable" formatted table of test statistics
• If a known variance is not provided, ZTest performs a -test assuming the sample variance is the known variance for univariate data and Hotelling's test assuming the sample covariance is the known covariance for multivariate data.
• Options include:
•  AlternativeHypothesis "Unequal" the inequality for the alternative hypothesis SignificanceLevel 0.05 cutoff for diagnostics and reporting VerifyTestAssumptions All what assumptions to verify
• For tests of location, a cutoff is chosen such that is rejected if and only if . The value of used for the and properties is controlled by the SignificanceLevel option. This value is also used in diagnostic tests of assumptions including tests for normality, equal variance, and symmetry. By default is set to .
• Named settings for VerifyTestAssumptions in ZTest include:
•  "Normality" verify that all data is normally distributed

## ExamplesExamplesopen allclose all

### Basic Examples (4)Basic Examples (4)

Test for zero mean, assuming a known variance of 1:

 Out[2]=
 Out[3]=

The mean of the dataset:

 Out[4]=

Compare the means of two populations, assuming known variances of 4 and 16:

 Out[2]=

The means are significantly different:

 Out[3]=

Compare the mean vectors of two multivariate populations:

 Out[2]=

Compare the mean vector of a multivariate population to :

 Out[2]=

The difference is significant:

 Out[3]=

## See AlsoSee Also

New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »