How to calculate a test statistic for a mean or proportion

A sample mean or proportion usually differs a little from the value in the null hypothesis. The test statistic tells us how far away it is in standard errors. We’ll choose the tail from the alternative hypothesis, then work out which formula to use.

Use the alternative hypothesis to choose the tails

Let θ stand for the population mean or proportion and θ0 be the value we’re testing. Choose the alternative before looking at the sample results. The direction in the alternative tells us which values of the test statistic count as evidence against the null.

Which tail goes with each alternative
AlternativeTest
Ha:θ≠θ0Two-tailed
Ha:θ>θ0Upper-tailed
Ha:θ<θ0Lower-tailed

The one-sided null includes equality and the opposite direction. For example, H0:θ≤θ0 goes with Ha:θ>θ0. We use the boundary value θ0 when we calculate the statistic.

Find the critical values from the significance level

The significance level α is the total rejection area under the null. For a two-tailed test at α=0.10, divide that area between the two tails. On a standard normal table that gives cumulative area to the left, look up 0.0500 and 0.9500. Those areas give critical values of about -1.645 and 1.645.

Two rejection tails on the standard normal curveThe left tail beyond negative 1.645 and the right tail beyond positive 1.645 are each shaded. Each has five percent of the area.5%5%−1.64501.645
For a two-tailed z test at the 10% level, each shaded tail has area 5%.

For an upper-tailed test at the same level, all 0.10 goes in the right tail, so use left area 0.9000 and critical value 1.282. For a lower-tailed test, use left area 0.1000 and critical value -1.282. For a t test, use the t distribution with the appropriate degrees of freedom.

Choose the formula for a mean or a proportion

For a single population mean, x¯ is the sample mean, μ0 is the hypothesized mean, and n is the sample size. If we know the population standard deviation σ, use the mean z statistic. If σ is unknown, use the sample standard deviation s and the one-sample t statistic with n-1 degrees of freedom.

z=x¯-μ0σ/nt=x¯-μ0s/n

These formulas assume independent observations from a random sample. A normal population supports the mean tests even for small samples. With a larger sample, the sampling distribution of the mean can be close to normal. How large a sample we need depends on the population’s shape and the presence of outliers.

For a single population proportion, let pˆ be the sample proportion and p0 the hypothesized proportion. The standard error for this test uses p0. For the normal approximation, a common rule is that both expected counts, np0 and n(1-p0), should be at least 10.

z=pˆ-p0p0(1-p0)/n

For example, if 110 out of 200 independent observations have the trait we’re testing for, then pˆ=110/200=0.55. To test p0=0.50, the null predicts 100 observations in each group. Plugging in gives

z=0.55-0.500.50(1-0.50)/200≈1.4142

Calculate a t statistic for monthly sales

A dealership claims it averages $1,000,000 in sales each month. A random sample of 40 months has a mean of $985,000 and a sample standard deviation of $200,000. For a test of whether the true mean differs from the claim in either direction, use H0:μ=1000000 and Ha:μ≠1000000, with sales measured in dollars.

Assume the sampled monthly totals are independent and the sample is large enough for the usual t approximation. We have the sample standard deviation, so we use t with 39 degrees of freedom.

t=985000-1000000200000/40t=-34040≈-0.4743

The sample mean is about 0.4743 standard errors below the hypothesized mean. We’d compare that statistic with the two critical t values for the chosen significance level.