Login
📚 Statistical Inference for Everyone
Chapters ▾

8.2 z-test

The z-test is the simplest test to use, and is perhaps the most common. It is used when we have the following assumptions:

  1. We are modeling the data as a true value, μ, with uncertainty
  2. We are modeling the as a Normal distribution with known deviation, σ, as in Normal(0,σ).
  3. We are assuming independence between the measurements.

The model of the data is

d a t a = μ + uncertainty with probability Normal( μ = 0 ,known  σ )

where μ represents the “true” value. The posterior distribution for μ also follows a Normal distribution, with a smaller uncertainty, σ/N where N is the number of data points.

To use the z-test, we perform the following steps:

  1. Calculate our best estimate for μ, denoted as μ^.
  2. Given the known uncertainty, σ of a single measurement, determine the range of credible values for μ within the uncertainty of the estimate for the N observations, σ/N.
  3. Test to see if the credible range includes zero.
  4. If so, then the test passes, and we can be reasonably confident that the parameter is non-zero - that the effect is real.
  5. If the test fails, i.e. the credible range does not include zero, then under the model the possibility of a zero-effect cannot be reasonably excluded.

There are several scenarios where we use the z-test, each with the same procedure, differing only in the method of estimating the “true” value μ.

  1. For N independent observations, x1,x2,,xN we have the best estimate given by the sample mean, and uncertainty related to the single-measurement deviation, σ, as

    μ^=x1+x2++xNN±σ/N

  2. When estimating a proportion, for a large number of events N of which a fraction fh/N are successful, we have

    μ^fσ/Nf(1f)/N

  3. For smallish data sets, 5<N<30, where the uncertainty is not known,

    μ^x1+x2++xNNσ/NkS/N

    where we replace the known σ/N from the previous case with an estimate using the sample standard deviation and an adjustment for small data set parameter k,

    S2=1N1((x1x¯)2++(xNx¯)2)k1+20N2

Adapted from Statistical Inference for Everyone, by Brian Blais (Bryant University), licensed under CC BY-SA 4.0 (dual-licensed under the GNU FDL 1.2 or later; this adaptation uses the CC BY-SA grant). Changes were made; this adaptation is distributed under the same license. License: CC-BY-SA-4.0.