Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Z-test
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Statistical test}} {{DISPLAYTITLE:''Z''-test}} {{redirect-multi|1|Z test|the "Z-test" procedure in the [[graphics pipeline]]|Z-buffering}} {{nofootnotes|date=May 2020}} [[File:Null-hypothesis-region-eng.png|thumb|]] A '''''Z''-test''' is any [[statistical hypothesis testing|statistical test]] for which the [[probability distribution|distribution]] of the [[test statistic]] under the [[null hypothesis]] can be approximated by a [[normal distribution]]. ''Z''-test tests the mean of a distribution. For each [[statistical significance|significance level]] in the [[Confidence intervals|confidence interval]], the ''Z''-test has a single critical value (for example, 1.96 for 5% two-tailed), which makes it more convenient than the [[Student's t-test|Student's ''t''-test]] whose critical values are defined by the sample size (through the corresponding [[degrees of freedom (statistics)|degrees of freedom]]). Both the ''Z''-test and Student's ''t''-test have similarities in that they both help determine the significance of a set of data. However, the ''Z''-test is rarely used in practice because the population deviation is difficult to determine.{{cn|date=May 2025}} ==Applicability== Because of the [[central limit theorem]], many test statistics are approximately normally distributed for large samples. Therefore, many statistical tests can be conveniently performed as approximate ''Z''-tests if the sample size is large or the population variance is known. If the population variance is unknown (and therefore has to be estimated from the sample itself) and the sample size is not large (''n'' < 30), the Student's ''t''-test may be more appropriate (in some cases, ''n'' < 50, as described below). ==Procedure== How to perform a ''Z''-test when ''T'' is a statistic that is approximately normally distributed under the null hypothesis is as follows: First, estimate the [[expected value]] μ of ''T'' under the null hypothesis and obtain an estimate ''s'' of the [[standard deviation]] of ''T''. Second, determine the properties of ''T'': one-tailed or two-tailed. For null hypothesis '''''H''<sub>0</sub>''': '''''μ'' ≥ ''μ''<sub>0</sub>''' vs [[alternative hypothesis]] '''''H''<sub>1</sub>''': '''''μ'' < ''μ''<sub>0</sub>''', it is lower/left-tailed (one-tailed). For null hypothesis '''''H''<sub>0</sub>''': '''''μ'' ≤ ''μ''<sub>0</sub>''' vs alternative hypothesis '''''H''<sub>1</sub>''': '''''μ'' > ''μ''<sub>0</sub>''', it is upper/right-tailed (one-tailed). For null hypothesis '''''H''<sub>0</sub>''': '''''μ'' = ''μ''<sub>0</sub>''' vs alternative hypothesis '''''H''<sub>1</sub>''': '''''μ'' ≠ ''μ''<sub>0</sub>''', it is two-tailed. Third, calculate the [[standard score]]: <math display="block"> Z = \frac{\bar{X} - \mu_0}{s}, </math> which [[one- and two-tailed tests|one-tailed and two-tailed]] [[p-values|''p''-values]] can be calculated as Φ(''Z'') (for lower/left-tailed tests), Φ(−''Z'') (for upper/right-tailed tests) and 2Φ(−|''Z''|) (for two-tailed tests), where Φ is the standard [[normal distribution|normal]] [[cumulative distribution function]]. ==Use in location testing== # The term "''Z''-test" is often used to refer specifically to the [[location test|one-sample location test]] comparing the mean of a set of measurements to a given constant when the sample variance is known. For example, if the observed data ''X''<sub>1</sub>, ..., ''X''<sub>n</sub> are (i) independent, (ii) have a common mean μ, and (iii) have a common variance σ<sup>2</sup>, then the sample average <span style="text-decoration: overline">''X''</span> has mean μ and variance <math>\frac{\sigma^2}{n}</math>. # The null hypothesis is that the mean value of X is a given number μ<sub>0</sub>. We can use <span style="text-decoration: overline">''X''</span> as a test-statistic, rejecting the null hypothesis if <span style="text-decoration: overline">''X''</span> − μ<sub>0</sub> is large. # To calculate the standardized statistic <math>Z=\frac{(\bar{X}-\mu_0)}{s}</math>, we need to either know or have an approximate value for σ<sup>2</sup>, from which we can calculate <math>s^2=\frac{\sigma^2}{n}</math> . In some applications, σ<sup>2</sup> is known, but this is uncommon. # If the sample size is moderate or large, we can substitute the [[Sample variance#Population variance and sample variance|sample variance]] for σ<sup>2</sup>, giving a ''plug-in'' test. The resulting test will not be an exact ''Z''-test since the uncertainty in the sample variance is not accounted for—however, it will be a good approximation unless the sample size is small. # A [[t-test|''t''-test]] can be used to account for the uncertainty in the sample variance when the data are exactly [[normal distribution|normal]]. # Difference between ''Z''-test and ''t''-test: ''Z''-test is used when sample size is large (''n'' > 50), or the population variance is known. ''t''-test is used when sample size is small (''n'' < 50) and population variance is unknown. # There is no universal constant at which the sample size is generally considered large enough to justify use of the plug-in test. Typical rules of thumb: the sample size should be 50 observations or more. # For large sample sizes, the ''t''-test procedure gives almost identical ''p''-values as the ''Z''-test procedure. # Other location tests that can be performed as ''Z''-tests are the two-sample location test and the [[paired difference test]]. == Conditions == For the ''Z''-test to be applicable, certain conditions must be met. * [[Nuisance parameter]]s should be known, or estimated with high accuracy (an example of a nuisance parameter would be the [[standard deviation]] in a one-sample location test). ''Z''-tests focus on a single parameter, and treat all other unknown parameters as being fixed at their true values. In practice, due to [[Slutsky's theorem]], "plugging in" [[consistent estimator|consistent]] estimates of nuisance parameters can be justified. However, if the sample size is not large enough for these estimates to be reasonably accurate, the ''Z''-test may not perform well. * The test statistic should follow a [[normal distribution]]. Generally, one appeals to the [[central limit theorem]] to justify assuming that a test statistic varies normally. There is a great deal of statistical research on the question of when a test statistic varies approximately normally. If the variation of the test statistic is strongly non-normal, a ''Z''-test should not be used. If estimates of nuisance parameters are plugged in as discussed above, it is important to use estimates appropriate for the way the data were [[sampling (statistics)|sampled]]. In the special case of ''Z''-tests for the one or two sample location problem, the usual sample standard deviation is only appropriate if the data were collected as an independent sample. In some situations, it is possible to devise a test that properly accounts for the variation in plug-in estimates of nuisance parameters. In the case of one and two sample location problems, a [[t-test|''t''-test]] does this. == Example == Suppose that in a particular geographic region, the mean and standard deviation of scores on a reading test are 100 points, and 12 points, respectively. Our interest is in the scores of 55 students in a particular school who received a mean score of 96. We can ask whether this mean score is significantly lower than the regional mean—that is, are the students in this school comparable to a simple random sample of 55 students from the region as a whole, or are their scores surprisingly low? First calculate the [[standard error (statistics)|standard error]] of the mean: :<math>\mathrm{SE} = \frac{\sigma}{\sqrt n} = \frac{12}{\sqrt{55}} = \frac{12}{7.42} = 1.62 </math> where <math>{\sigma}</math> is the population standard deviation. Next calculate the [[standard score|''z''-score]], which is the distance from the sample mean to the population mean in units of the standard error: :<math>z = \frac{M - \mu}{\mathrm{SE}} = \frac{96 - 100}{1.62} = -2.47 </math> In this example, we treat the population mean and variance as known, which would be appropriate if all students in the region were tested. When population parameters are unknown, a [[Student's t-test|Student's ''t''-test]] should be conducted instead. The classroom mean score is 96, which is −2.47 standard error units from the population mean of 100. Looking up the ''z''-score in a table of the standard [[normal distribution]] cumulative probability, we find that the probability of observing a standard normal value below −2.47 is approximately 0.5 − 0.4932 = 0.0068. This is the [[one-tailed|one-sided]] [[p-value|''p''-value]] for the null hypothesis that the 55 students are comparable to a simple random sample from the population of all test-takers. The two-sided ''p''-value is approximately 0.014 (twice the one-sided ''p''-value). Another way of stating things is that with probability 1 − 0.014 = 0.986, a simple random sample of 55 students would have a mean test score within 4 units of the population mean. We could also say that with 98.6% confidence we reject the [[null hypothesis]] that the 55 test takers are comparable to a simple random sample from the population of test-takers. The ''Z''-test tells us that the 55 students of interest have an unusually low mean test score compared to most simple random samples of similar size from the population of test-takers. A deficiency of this analysis is that it does not consider whether the [[effect size]] of 4 points is meaningful. If instead of a classroom, we considered a subregion containing 900 students whose mean score was 99, nearly the same ''z''-score and ''p''-value would be observed. This shows that if the sample size is large enough, very small differences from the null value can be highly statistically significant. See [[statistical hypothesis testing]] for further discussion of this issue. == Occurrence and applications == === For maximum likelihood estimation of a parameter === Location tests are the most familiar ''Z''-tests. Another class of ''Z''-tests arises in [[maximum likelihood]] estimation of the [[parameter]]s in a [[parametric statistics|parametric]] [[statistical model]]. Maximum likelihood estimates are approximately normal under certain conditions, and their asymptotic variance can be calculated in terms of the Fisher information. The maximum likelihood estimate divided by its standard error can be used as a test statistic for the null hypothesis that the population value of the parameter equals zero. More generally, if <math>\hat{\theta}</math> is the maximum likelihood estimate of a parameter θ, and θ<sub>0</sub> is the value of θ under the null hypothesis, :<math>\frac{\hat{\theta}-\theta_0}{{\rm SE}(\hat{\theta})}</math> can be used as a ''Z''-test statistic. When using a ''Z''-test for maximum likelihood estimates, it is important to be aware that the normal approximation may be poor if the sample size is not sufficiently large. Although there is no simple, universal rule stating how large the sample size must be to use a ''Z''-test, [[Monte Carlo method|simulation]] can give a good idea as to whether a ''Z''-test is appropriate in a given situation. ''Z''-tests are employed whenever it can be argued that a test statistic follows a normal distribution under the null hypothesis of interest. Many [[non-parametric statistics|non-parametric]] test statistics, such as [[U statistic]]s, are approximately normal for large enough sample sizes, and hence are often performed as ''Z''-tests. === Comparing the proportions of two binomials === {{Main|Two-proportion Z-test}} The '''''Z''-test for comparing two proportions''' is a statistical method used to evaluate whether the proportion of a certain characteristic differs significantly between two independent samples. This test leverages the property that the [[Binomial_distribution#Estimation_of_parameters|sample proportions]] (which is the average of observations coming from a [[Bernoulli distribution]]) are [[Asymptotic_distribution|asymptotically]] [[normal distribution|normal]] under the [[Central Limit Theorem]], enabling the construction of a ''Z''-test. The z-statistic for comparing two proportions is computed using: <math>z = \frac{\hat{p}_1 - \hat{p}_2}{\sqrt{\hat{p}(1-\hat{p})\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}}</math> Where: * <math>\hat{p}_1</math> = sample proportion in the first sample * <math>\hat{p}_2</math> = sample proportion in the second sample * <math>n_1</math> = size of the first sample * <math>n_2</math> = size of the second sample * <math>\hat{p}</math> = pooled proportion, calculated as <math>\hat{p} = \frac{x_1 + x_2}{n_1 + n_2}</math>, where <math>x_1</math> and <math>x_2</math> are the counts of successes in the two samples. The [[confidence interval]] for the difference between two proportions, based on the definitions above, is: <math>(\hat{p}_1 - \hat{p}_2) \pm z_{\alpha/2} \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}</math> Where: * <math>z_{\alpha/2}</math> is the critical value of the standard normal distribution (e.g., 1.96 for a 95% confidence level). The MDE for when using the (two-sided) ''Z''-test formula for comparing two proportions, incorporating critical values for <math>\alpha</math> and <math>1-\beta</math>, and the standard errors of the proportions:<ref>COOLSerdash (https://stats.stackexchange.com/users/21054/coolserdash), Two proportion sample size calculation, URL (version: 2023-04-14): https://stats.stackexchange.com/q/612894</ref><ref>Chow S-C, Shao J, Wang H, Lokhnygina Y (2018): Sample size calculations in clinical research. 3rd ed. CRC Press.</ref> <math> \text{MDE} = |p_1 - p_2| = z_{1-\alpha/2} \sqrt{p_0(1-p_0)\left(\frac{1}{n_1} + \frac{1}{n_2}\right)} + z_{1-\beta} \sqrt{\frac{p_1(1-p_1)}{n_1} + \frac{p_2(1-p_2)}{n_2}} </math> Where: * <math>z_{1-\alpha/2}</math>: Critical value for the significance level. * <math>z_{1-\beta}</math>: Quantile for the desired power. * <math>p_0=p_1=p_2</math>: When assuming the null is correct. == See also == * [[Normal distribution]] * [[Standard normal table]] * [[Standard score]] * [[Student's t-test|Student's ''t''-test]] ==References== {{reflist}} ==Further reading== * {{cite book |last=Sprinthall |first=R. C. |year=2011 |title=Basic Statistical Analysis |edition=9th |publisher=Pearson Education |isbn=978-0-205-05217-2 }} * [[George Casella|Casella, G.]], [[Roger Lee Berger|Berger, R. L.]] (2002). ''Statistical Inference''. Duxbury Press. {{isbn|0-534-24312-6}}. *Douglas C.Montgomery, George C.Runger.(2014). ''Applied Statistics And Probability For Engineers''.(6th ed.). John Wiley & Sons, inc. {{ISBN|9781118539712|9781118645062}}. {{Statistics}} {{Public health}} [[Category:Statistical tests]] [[Category:Normal distribution]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cn
(
edit
)
Template:ISBN
(
edit
)
Template:Isbn
(
edit
)
Template:Main
(
edit
)
Template:Nofootnotes
(
edit
)
Template:Public health
(
edit
)
Template:Redirect-multi
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Statistics
(
edit
)