ExamSaathi learning library · Government exams · SSC CGL quantitative foundations; published syllabus labelled 2024 · Quantitative aptitude

Hypothesis testing: errors, significance levels and large-sample z tests

Set up H0 and H1, choose a one-tailed or two-tailed critical region at a stated level of significance, and run large-sample z tests for one mean, two means and one proportion, keeping Type I error, Type II error and power in view.

Status: original pilot lesson. Teacher review is pending. It is not a complete course or official exam material.

You will learn to

Before you start

A hypothesis is a claim about a population figure, for example 'these tea packets average 250 g' or 'half the voters back the proposal'. A test asks whether a sample lies so far from the claim that the claim becomes hard to believe. You need the normal table, the mean and SD of a sample, square roots, and the standard error SD / sqrt(n). Notation: mu and sigma are the population mean and SD, n is the sample size, p is the sample proportion, P0 is the proportion named in the claim and Q0 = 1 - P0. Greek letters are written as words, and x stands only for multiplication. Everything here is for large samples (n of 30 or more), where the z statistic is close to normal; the data are invented for practice.

The core idea: H0, H1 and the critical region

The null hypothesis H0 puts the claimed value in an equation, such as H0: mu = 250. The alternative hypothesis H1 is the conclusion we move to if the data go against H0. When H1 says 'not equal to', a departure on either side counts, so the test is two-tailed. When H1 says 'less than' or 'greater than', only one side counts, so the test is one-tailed. The test statistic counts how many standard errors the sample result lies from the claimed value: z = (sample value - claimed value) / standard error. The level of significance, alpha, is the risk of rejecting a true H0 that we agree to run; it is fixed before seeing the data, usually at 5 percent or 1 percent, and it sets the critical value and so the critical (rejection) region. From the normal table: area 0 to 1.645 is 0.4500, leaving 5 percent in one tail; area 0 to 1.96 is 0.4750, leaving 2.5 percent in each tail; area 0 to 2.33 is 0.4901, leaving about 1 percent in one tail; area 0 to 2.58 is 0.4951, leaving about 0.5 percent in each tail. Hence 1.645 (one-tailed, 5 percent), 1.96 (two-tailed, 5 percent), 2.33 (one-tailed, 1 percent) and 2.58 (two-tailed, 1 percent). If z falls in the critical region, reject H0; if not, do not reject H0.

Three large-sample z tests

One mean: z = (sample mean - claimed mean) / (SD / sqrt(n)), testing H0: mu = claimed mean. Use sigma when it is known; with a large sample the sample SD can stand in for it. Two means from independent large samples: z = (mean 1 - mean 2) / sqrt(s1^2 / n1 + s2^2 / n2), testing H0: the two population means are equal. Add the two variance terms first and then take one square root. One proportion: z = (p - P0) / sqrt(P0 x Q0 / n), testing H0: P = P0. The standard error here uses the claimed P0, not the sample p, because it describes how p would vary if H0 were true. In every case compare z with the critical region: in a two-tailed test reject H0 when |z|, the size of z ignoring its sign, exceeds the critical value; in a one-tailed test reject only when z is beyond the critical value on the side named in H1.

A further case: wrong decisions and power

Any test can go wrong in two ways. A Type I error rejects H0 when H0 is in fact true; its probability is alpha, the level of significance. A Type II error accepts (does not reject) H0 when H0 is in fact false; its probability is called beta. The power of the test, 1 - beta, is the chance of rejecting H0 when it is false, that is, of catching a real change. So the four outcomes are: true H0 kept (right), true H0 rejected (Type I), false H0 rejected (right, with probability equal to the power) and false H0 kept (Type II). The two errors pull against each other: with the sample size fixed, a smaller alpha pushes the critical value outwards, real changes get missed more often, and beta rises. A larger sample narrows the standard error, so at the same alpha it lowers beta and raises the power; alpha itself stays where it was set, though a bigger sample also makes it affordable to choose a smaller alpha. This is also why 'do not reject H0' is never proof that H0 is true: a small or noisy sample can easily miss a real difference. The p-value in one line: it is the probability, worked out as if H0 were true, of a result at least as far from the claim as the one seen, on the side or sides that H1 counts, and H0 is rejected when it is below alpha.

Common mistakes

Writing the sample figure into H0, such as H0: mu = 248.5, instead of the claimed value. Taking 1.96 for a one-tailed test, or 1.645 for a two-tailed one. Ignoring the sign in a one-tailed test: if H1 is mu less than 250, a large positive z gives no reason to reject. Dividing by n instead of sqrt(n), or dropping the square root in sqrt(P0 x Q0 / n). Using the sample p instead of P0 in the standard error of a proportion test. Adding the two standard errors of a difference instead of adding the two variance terms. Comparing z with alpha itself, as in '2.1 is more than 0.05'. Calling 1 - alpha the power; the power is 1 - beta. Writing 'H0 is proved' after a test that merely failed to reject it.

A routine for a z test

1. Write H0 with the claimed value, and H1 with not equal to, less than or greater than. 2. Note alpha and the number of tails, and write down the critical value: 1.645, 1.96, 2.33 or 2.58. 3. Choose the standard error: SD / sqrt(n), sqrt(s1^2 / n1 + s2^2 / n2), or sqrt(P0 x Q0 / n). 4. Work out z and keep its sign. 5. See whether z lies in the critical region and write the decision in words: reject H0 or do not reject H0. 6. Say what the decision means in the setting, without claiming proof when H0 is not rejected.

Worked examples

  1. A tea factory in Jorhat, Assam, fills packets marked 250 g. Past records give an SD of 4 g for packet weight. An inspector weighs a random sample of 64 packets and finds a mean of 248.5 g. Test at the 5 percent level whether the mean packet weight differs from 250 g.

    1. Null hypothesis H0: mu = 250 g. Alternative hypothesis H1: mu not equal to 250 g, so the test is two-tailed.
    2. Two-tailed 5 percent critical value: 1.96 (table area from 0 to 1.96 is 0.4750). Critical region: z below -1.96 or above 1.96.
    3. Standard error = 4 / sqrt(64) = 4 / 8 = 0.5 g.
    4. z = (248.5 - 250) / 0.5 = -1.5 / 0.5 = -3.
    5. |z| = 3 is bigger than 1.96, so z lies in the critical region.

    Answer: z = -3, so reject H0 at the 5 percent level: the packets do not average 250 g, and the low sample mean points to underfilling.

  2. A random survey of 400 voters in a Nashik ward finds 220 who support a proposal for a new vegetable market. Test whether more than half of all voters in the ward support it, first at the 5 percent level and then at the 1 percent level.

    1. Null hypothesis H0: P = 0.5. Alternative hypothesis H1: P greater than 0.5 (one-tailed, upper side). So P0 = 0.5 and Q0 = 0.5.
    2. Sample proportion p = 220 / 400 = 0.55.
    3. Standard error = sqrt(0.5 x 0.5 / 400) = sqrt(0.000625) = 0.025.
    4. z = (0.55 - 0.5) / 0.025 = 0.05 / 0.025 = 2.
    5. 5 percent level: the one-tailed critical value is 1.645 (table area from 0 to 1.645 is 0.4500). 2 is above 1.645, so reject H0.
    6. 1 percent level: the one-tailed critical value is 2.33 (table area from 0 to 2.33 is 0.4901). 2 is below 2.33, so do not reject H0.
    7. p-value check: the table area from 0 to 2 is 0.4772, so the area beyond 2 is 0.5 - 0.4772 = 0.0228, which is below 0.05 but above 0.01.

    Answer: z = 2. At the 5 percent level reject H0, so the survey supports a majority in favour; at the 1 percent level do not reject H0.

  3. Monthly electricity use is noted for random samples of 100 households in Indore and 100 households in Bhopal. Indore: mean 182 units, SD 30 units. Bhopal: mean 176 units, SD 40 units. Test at the 5 percent level whether mean monthly use differs between the two cities.

    1. Null hypothesis H0: the two population means are equal. Alternative hypothesis H1: they differ (two-tailed), so the critical value is 1.96.
    2. Standard error of the difference = sqrt(30^2 / 100 + 40^2 / 100) = sqrt(9 + 16) = sqrt(25) = 5 units.
    3. z = (182 - 176) / 5 = 6 / 5 = 1.2.
    4. |z| = 1.2 is below 1.96, so z is outside the critical region.
    5. A gap of 6 units is well within what chance alone could produce with samples of this size. The test has not shown that the means are equal, only that the samples give no clear evidence of a difference.

    Answer: z = 1.2, so do not reject H0 at the 5 percent level: there is no significant difference, though this does not prove that the two means are equal.

Practice checks

  1. Before a gully cricket match in Kanpur, Ravi suspects that the coin used for the toss favours heads. He tosses it 5 times and will call it biased, rejecting H0: P = 0.5 (P is the chance of heads), only if all 5 tosses show heads. If in fact P = 0.8, what is the probability of a Type II error?
  2. A cement company in Satna says its bags hold 50 kg on average. A dealer weighs a random sample of 36 bags and finds a mean of 49.4 kg; the SD is 1.5 kg. Test H0: mu = 50 kg against H1: mu less than 50 kg at the 1 percent level.
  3. An old survey said that 40 percent of households in a block of Kota district own a two-wheeler. A new random sample of 600 households finds 264 owners. Test at the 5 percent level whether the share has changed.
  4. Random samples of phone batteries from two plants are tested. 100 batteries from plant A last 1,018 charge cycles on average with SD 80 cycles; 100 batteries from plant B last 1,000 cycles on average with SD 60 cycles. Test at the 5 percent level whether the mean lives differ.
  5. A tea packing machine in Jorhat is in fact filling correctly, with mean 250 g. By bad luck an inspector's sample gives a z beyond the critical value, and she rejects H0: mu = 250 g. What has happened?

Sources checked