Corrected exercises: estimation and hypothesis testing (201-337)
Here are ten corrected exercises on estimation and hypothesis testing for the CEGEP Advanced Statistics course, 201-337, preceded by a list of calculations. The whole chapter rests on a single idea, the central limit theorem: the mean of a sample is itself a random variable, whose spread, the standard error, is n times smaller than that of the individual data. That reduction, and nothing else, is what allows a conclusion about an entire population from a few hundred observations. The set covers the confidence interval for a mean and for a proportion, the margin of error and the sample size, Student's t distribution when σ is unknown, hypothesis tests on a mean and on a proportion, the p-value, type I and type II errors, comparing two means and the chi-square test of independence.
Exercise 0.1 opens the set with eleven direct calculations on estimation and testing, as in textbook drill lists: the standard error of the mean, confidence intervals at 90%, 95% and 99% with σ known, with Student's t and for a proportion, the sample size for a fixed margin of error, then the z and t statistics of a test on a mean and the z statistic of a test on a proportion, each with a value to find that is checked as you type it.
By the end, you can interpret a 95% interval correctly, without saying “a 95% chance that μ is inside” (exercise 2), explain why the margin of a poll is almost always three points (exercise 3), write up a complete test in five steps (exercise 6), put p0 and not p^ in the standard error of a test on a proportion (exercise 7), compare two groups through the standard error of the difference, where the variances add up (exercise 8), and test whether passing and attendance are independent in a contingency table (exercise 9).
Exercise 4 holds the most instructive case of the chapter: a p-value of 0.0114 leads to REJECTING the hypothesis at the 5% level and to NOT REJECTING it at the 1% level. The same data, two opposite conclusions. Understanding why means understanding that a test proves nothing: it arbitrates between two risks chosen in advance. Exercise 10 closes the set on the other misunderstanding: a very large sample makes a difference of no practical importance significant, hence the effect size.
Self-checking setType your answers and check them question by question: the page tells you right or wrong before you open the solution. With an account, every answer right on the first try earns points, and your right answers stay filled in when you come back.
•Sampling distribution of the mean: μx=μ and σx=nσ. The latter is called the STANDARD ERROR.
•Central limit theorem: for n large enough, in practice n≥30, the distribution of x is approximately NORMAL, whatever the shape of the original population.
•Confidence interval for a mean, σ known: x±zα/2nσ. Usual values: z=1.645 at 90%, 1.96 at 95%, 2.576 at 99%.
•Confidence interval for a proportion: p^±zα/2np^(1−p^).
•Margin of error E: the half-width of the interval. To impose it, invert the formula: n≥(Ezσ)2 for a mean, and n≥(2Ez)2 for a proportion in the worst case p^=0.5.
•CORRECT INTERPRETATION of a 95% interval: if the sampling were repeated a large number of times, 95% of the intervals built this way would contain the true parameter. We do NOT say that there is a 95% chance that the parameter lies in THIS particular interval.
•Hypothesis test: H0 is the default hypothesis, H1 the one we are trying to establish. The P-VALUE is the probability of observing a result at least as extreme IF H0 is true. Reject H0 if p-value <α.
•Type I error: rejecting H0 when it is true, with probability α. Type II error: failing to reject H0 when it is false, with probability β. For a fixed n, reducing one increases the other.
•If σ is UNKNOWN, it is estimated by s and s/nx−μ follows a STUDENT t distribution with n−1 degrees of freedom, more spread out than the normal. Its critical values are therefore always larger than those of z, and they converge to them as n grows: that is where the threshold of 30 comes from.
•Test on a proportion: z=p0(1−p0)/np^−p0, with p0 IN THE DENOMINATOR because we reason under H0. In a confidence interval, p^ goes there instead, since there is no starting hypothesis.
•Difference of two independent means: σx1−x2=n1s12+n2s22. The VARIANCES add up even when the means are subtracted. A 95% interval that excludes zero is always equivalent to a two-sided p-value below 0.05.
•Chi-square test of independence: expected count =nrow total×column total, statistic χ2=∑E(O−E)2, degrees of freedom (r−1)(c−1). Condition: all EXPECTED counts at least 5. The test establishes an association, never causation.
Calculations: intervals and test statistics to compute
Exercise 0.1: Build confidence intervals and compute test statistics: eleven direct calculations
For each line, compute the requested quantity from the summary data given, without stating hypotheses or drawing a conclusion. Table values: z=1.645 at 90%, z=1.96 at 95% and z=2.576 at 99%; Student's t is given when it is needed. Bounds and statistics to the hundredth, bounds of a proportion to the thousandth, sample sizes as whole numbers.
A single move carries the whole list: compute the STANDARD ERROR first, nσ, ns or np(1−p). For an interval, multiply it by the z or the t of the required level and write estimate plus or minus margin; for a test statistic, divide the gap between the estimate and the hypothesized value by it. For a sample size, isolate n in the margin and always round UP.
a) σ=20, n=64: compute the standard error of the mean σx.
b) x=52, σ=10, n=25: build the 95% confidence interval for μ.
c) x=130, σ=24, n=36: build the 90% confidence interval for μ.
d) Same data as in c): build the 99% confidence interval for μ.
e) x=24.5, s=4, n=16, σ unknown, t=2.131 with 15 degrees of freedom: build the 95% confidence interval for μ.
f) 260 successes out of n=400: build the 95% confidence interval for the proportion p.
g) σ=15: what minimum sample size gives a margin of error of 2 on a mean, at 95%?
h) Estimated proportion p^=0.30: what minimum sample size gives a margin of error of 0.05, at 95%?
i) Test on a mean, μ0=80, x=83.2, σ=12, n=49: compute the z statistic.
j) Test on a mean, μ0=250, x=246.4, s=9, n=36: compute the t statistic.
k) Test on a proportion, p0=0.40, 156 successes out of n=300: compute the z statistic.
Show the solution
Answers
a)σx=820=2.5
b)52±3.92; [48.08,55.92]
c)130±6.58; [123.42,136.58]
d)130±10.30; [119.70,140.30]
e)24.5±2.131; [22.37,26.63]
f)0.65±0.0467; [0.603,0.697]
g)n≥216.09; n=217
h)n≥322.69; n=323
i)z=12/73.2≈1.87
j)t=1.5−3.6=−2.4
k)z=0.00080.12≈4.24
The move that decides everything: the standard error is computed ON ITS OWN, on a separate line, before any margin or statistic. It is what carries the n that people forget, and in a test on a proportion it is what takes p0 and not p^.
a)
σx=nσ=6420=820=2.5. Pitfall: dividing by n instead of n, which gives 0.3125.
b)
Standard error 2510=2, margin 1.96×2=3.92, so 52±3.92: the interval is [48.08,55.92].
c)
Standard error 3624=4, margin 1.645×4=6.58, so 130±6.58: the interval is [123.42,136.58]. Pitfall: taking 1.96, the 95% value, out of habit.
d)
Same standard error 4, margin 2.576×4=10.304, so 130±10.30: the interval is [119.70,140.30]. It is wider than the one in c): more confidence is paid for in precision.
e)
σ is unknown, so we use s and Student's t. Standard error 164=1, margin 2.131×1=2.131, so 24.5±2.131: the interval is [22.37,26.63]. Pitfall: taking z=1.96, which gives an interval that is too narrow.
f)
p^=400260=0.65. Standard error 4000.65×0.35=0.00056875≈0.02385, margin 1.96×0.02385≈0.0467, so 0.65±0.0467: the interval is [0.603,0.697].
g)
We require 1.96×n15≤2, so n≥21.96×15=14.7 and n≥14.72=216.09. Round up: n=217. Pitfall: rounding to the nearest integer, 216, which gives a margin slightly above 2.
h)
We require 1.96n0.30×0.70≤0.05, so n≥0.0521.962×0.21=0.00253.8416×0.21=322.69. Round up: n=323.
i)
Standard error 4912=712≈1.7143, so z=1.714383.2−80=1.71433.2≈1.87.
j)
Standard error 369=1.5, so t=1.5246.4−250=1.5−3.6=−2.4. The sign matters: the observed mean is below μ0. Pitfall: writing μ0−x in the numerator, which gives +2.4.
k)
p^=300156=0.52. Standard error UNDER H0: 3000.40×0.60=0.0008≈0.02828, so z=0.028280.52−0.40≈4.24. Pitfall: computing the standard error with p^=0.52, which gives 4.16.
Check: an interval is always centred on the estimate, so the average of the two bounds gives back x or p^. For a sample size, substitute the value found for n and check that the margin falls just under the target: in g), 1.96×21715≈1.996.
Tick the exercises you have done or want to review: a free account, no password, keeps your ticks and your right answers from one visit to the next, tells you which chapter to tackle next and lets you ask for the exercise you are missing. Create your space, an email is enough.
Part A: sampling, intervals and the logic of a test (/50)
Exercise 1: The central limit theorem and the standard error
The mean of a sample varies from one sample to the next. Its own distribution is much tighter than that of the data, and it is this tightening that makes inference possible.
The results of a national exam have a mean μ=70 and a standard deviation σ=12. A random sample of 36 exam papers is drawn.
a) Give the mean and the standard error of the distribution of x.
b) State the central limit theorem and explain why it applies here even if the individual results are not normally distributed.
c) Compute the probability that the sample mean exceeds 73.
d) The sample size is multiplied by four, to 144 papers. What happens to the standard error?
e) To divide the standard error by 10, by how much must the sample size be multiplied? What is the practical consequence?
Show the solution
Answers
a)μx=70 and σx=612=2.0.
b)For n≥30, x is approximately normal whatever the shape of the population. Here n=36.
c)z=1.50, so P≈0.0668. For a single paper, z=0.25 and the probability rises to 40%.
d)σx=1.0: multiplying n by four divides the standard error by 2, not by 4.
e)n must be multiplied by 100. Doubling the precision therefore roughly quadruples the budget.
a)
The mean of the sampling distribution is that of the population: μx=70. The standard error is σx=nσ=3612=612=2.0. Sample means are therefore six times less spread out than individual papers.
b)
The central limit theorem states that for n large enough, the distribution of x is approximately NORMAL, with mean μ and standard deviation nσ, WHATEVER the shape of the population distribution. Here n=36≥30: the usual practical threshold is reached. That is precisely the strength of the theorem: no assumption at all is needed about the distribution of the individual results, which may be skewed, bimodal or truncated.
c)
z=2.073−70=1.50. The table gives 0.9332 to the left, so P(x>73)=1−0.9332=0.0668, about 6.7%. Note that a SINGLE paper above 73 would be far more common: z=1273−70=0.25, that is 40%. The distinction between the standard deviation of the data and the standard error of the mean is the number one source of errors in the chapter.
d)
σx=14412=1212=1.0. Multiplying n by four has therefore DIVIDED the standard error BY TWO, not by four, because it is n and not n that appears in the denominator.
e)
n must be multiplied by 102=100. Going from 36 to 3600 papers only reduces the standard error by a factor of 10. The practical consequence is decisive: the precision of a poll improves very slowly with cost. Doubling the precision requires FOUR TIMES the sample, so roughly four times the budget. That is why almost all opinion polls stop at around 1000 people: beyond that, the gain in precision no longer justifies the expense.
Exercise 2: The confidence interval for a mean
A point estimate, a single number, says nothing about its own reliability. The confidence interval brackets the unknown parameter and states explicitly the risk that is accepted.
We go back to the sample of 36 papers, whose observed mean is x=70, with σ=12 known.
a) Build the 95% confidence interval for the population mean.
b) Build the 99% interval and compare the two widths. Explain what this difference means.
c) A student writes: “there is a 95% chance that μ lies between 66.08 and 73.92”. Correct this statement.
d) What sample size would give a margin of error of 2 points at 95%?
e) Why can a zero margin never be obtained, even with a very large sample?
Show the solution
Answers
a)70±3.92, that is [66.08,73.92], of width 7.84.
b)70±5.15, that is [64.85,75.15], of width 10.3: more confidence costs precision.
c)μ is fixed: it is the INTERVAL that is random. 95% of the intervals built this way would contain μ.
d)n≥138.3, so n=139 papers, rounded up.
e)The margin vanishes only at infinity; on top of it comes the non-sampling error, which the formula does not measure.
a)
x±znσ=70±1.96×2.0=70±3.92. The interval is therefore [66.08,73.92], of width 7.84.
b)
At 99%, z=2.576, so the margin is 2.576×2.0=5.15 and the interval is [64.85,75.15], of width 10.3. The 99% interval is therefore WIDER. This makes sense: demanding more certainty of capturing the true parameter forces us to cast a wider net. There is a permanent trade-off between CONFIDENCE and PRECISION, and both can be improved only by increasing n.
c)
The statement is incorrect because it treats μ as a random variable. But μ is a FIXED number, though unknown: it is either in the interval or it is not, and there is no probability involved. What is random is the INTERVAL, which changes with every sample. The correct statement is: “if the sampling were repeated a large number of times, 95% of the intervals built this way would contain μ”. In practice this is shortened to “I am 95% confident that μ lies between 66.08 and 73.92”, which is acceptable when speaking but must be justified correctly in a written answer.
d)
We require E=znσ≤2, hence n≥21.96×12=11.76 and n≥138.3. Since n is an integer and the condition must hold, we ROUND UP: n=139 papers. Rounding to 138 would give a margin slightly above 2, which would break the requirement; it is the only case in the course where rounding is never to the nearest value.
e)
Because the margin E=znσ vanishes only as n tends to infinity. As long as the sample is a proper subset of the population, an irreducible sampling uncertainty remains. The only way to reach a zero margin would be to survey the ENTIRE population, which is no longer sampling. On top of that, every real survey carries a share of non-sampling error, due to the wording of the questions, to non-response and to selection bias, which the formula does not measure at all and which a very large sample does nothing to improve.
Exercise 3: The confidence interval for a proportion, and the “plus or minus 3%”
The most quoted figure in all of applied statistics is the margin of error of polls. It takes three lines to compute, and the fact that it hardly changes from one poll to the next has a precise explanation.
A poll surveys 1000 people; 540 say they are in favour of a measure.
The figure below represents the situation.
a) Compute the observed proportion and the 95% confidence interval.
b) Give the margin of error in percentage points. Do you recognize this figure?
c) Can we claim that the measure has majority support? Justify using the interval.
d) What sample size would bring the margin down to 2 points?
e) Why is the stated margin almost always about 3 points, whatever the subject of the poll?
Show the solution
Answers
a)p^=0.540, standard error 0.01576, interval [0.509,0.571].
b)±3.1 points: the famous “plus or minus 3%” of polling firms.
c)Yes, but only just: the lower bound 0.509 is above 0.500 by only 0.9 points.
d)n≥2401: the sample must more than double to gain one point.
e)n is almost always close to 1000, and p^(1−p^) varies little, from 0.500 to 0.458 between p^=0.5 and p^=0.3.
a)
p^=1000540=0.540. The standard error is 10000.540×0.460=2.484×10−4=0.01576. The 95% margin is 1.96×0.01576=0.0309. The interval is therefore [0.509,0.571].
b)
The margin is 0.0309, that is about ±3.1 percentage points. This is exactly the “plus or minus 3 points” stated by every polling firm, and we have just recomputed it from scratch.
c)
Yes, but only just. The LOWER bound of the interval, 0.509, is above 0.500: even in the least favourable case compatible with the data at 95%, the measure keeps its majority. The conclusion is therefore supported, but with a margin of only 0.9 points above the decisive threshold. Had the poll given 52% instead of 54%, the interval would have contained 50% and we would have had to conclude that the poll does NOT settle the question, a statement the media almost always get wrong.
d)
In the worst case p^=0.5, we require 1.96n0.25≤0.02, hence n≥0.021.96×0.5=49 and n≥2401. The sample must therefore more than DOUBLE, from 1000 to 2401 people, to gain barely more than one point of precision.
e)
For two reasons that combine. First, the sample size is almost always chosen around 1000, a figure that comes from the cost-precision trade-off seen in d. Second, the factor p^(1−p^) varies very little: it is 0.500 at its maximum at p^=0.5, and still 0.458 for p^=0.30, barely 8% less. The margin is therefore very insensitive to the observed result, and for n=1000 it always stays close to 10001.96×0.5=0.031. Polling firms in fact publish the maximum margin, computed at p^=0.5, which makes it strictly constant for a given sample size.
Exercise 4: The logic of a hypothesis test
A hypothesis test proves nothing: it measures how surprising the data would be if the default hypothesis were true, and compares that surprise with a threshold set IN ADVANCE.
A manufacturer states that its bags weigh 500 g. An inspector weighs 40 bags and finds a mean of 494 g. The standard deviation of the process is known, σ=15 g.
The figure below represents the situation.
a) State H0 and H1, and justify the choice of a two-sided test.
b) Compute the test statistic.
c) Compute the p-value and state its exact meaning.
d) Draw a conclusion at the 5% level, then at the 1% level. Comment on the difference.
e) Define type I and type II errors in this concrete context, and say which one a consumer protection agency will try to minimize.
Show the solution
Answers
a)H0:μ=500 g against H1:μ=500 g. Two-sided: any labelling gap is a defect.
b)Standard error 2.372 g, so z=−2.530.
c)p-value =2(0.0057)=0.0114: the probability of such a gap IF the bags really weighed 500 g.
d)Rejected at 5%, not rejected at 1%. The level is set in advance, and the p-value is reported.
e)Type I: accusing an honest manufacturer. Type II: letting the deception through. The agency first minimizes type II.
a)
H0:μ=500 g, the manufacturer's statement is accurate. H1:μ=500 g. The test is TWO-SIDED because the inspector is checking that the labelling is accurate: a gap in either direction is a defect, a systematic overfilling also being a process anomaly. Had the mandate been to detect only fraud at the consumer's expense, we would have set H1:μ<500 and run a one-sided test.
b)
The standard error is nσ=4015=2.372 g. The statistic is z=2.372494−500=−2.530.
c)
Since the test is two-sided, the p-value is 2×P(Z<−2.530)=2×0.0057=0.0114. Exact meaning: IF the bags really weighed 500 g on average, then a sample of 40 bags differing from that value by at least 6 g, in either direction, would occur in only 1.14% of cases. The p-value is NOT the probability that H0 is true, a confusion that is the most widespread misinterpretation in statistics.
d)
At the level α=0.05: 0.0114<0.05, we REJECT H0 and conclude that the mean weight differs from 500 g. At the level α=0.01: 0.0114>0.01, we do NOT reject H0, for lack of sufficient evidence. The same data therefore lead to two opposite conclusions. There is no contradiction here: the significance level expresses the risk of a type I error we are willing to accept, and it is a decision made in advance, according to the consequences. This case shows why the p-value itself must ALWAYS be reported rather than the bare word “significant”, and why setting the level after seeing the data is a serious methodological fault.
e)
TYPE I error: concluding that the bags do not weigh 500 g when they actually do, so wrongly accusing an honest manufacturer. TYPE II error: concluding that nothing is wrong when the bags are actually underfilled, so letting a deception go through. A consumer protection agency will first try to minimize the TYPE II error, the one that lets fraud go unpunished, even if it means accepting a higher α. A court, bound by the presumption of innocence, would make the opposite trade-off. For a fixed n, reducing one automatically increases the other: the only way to reduce both at once is to INCREASE the sample.
Exercise 5: Student's t distribution: when the population standard deviation is unknown
Until now, σ was given. In reality it almost never is: it is estimated by the sample standard deviation s, and that estimate comes at a price. A laboratory measures the content of a product 12 times and obtains x=48.6 mg and s=3.2 mg. Useful critical values: t0.025=2.201 for 11 degrees of freedom and t0.025=2.045 for 29.
a) Why can the z-score not be used here? What is the distribution of s/nx−μ, and how many degrees of freedom does it have?
b) Build the 95% confidence interval for the true mean content of the product.
c) Compute the interval that would have been obtained by wrongly using z=1.96. By what percentage is the correct interval wider, and why must the gap go in this direction?
d) The laboratory raises its sample to 30 measurements, with the same x and s. Recompute the gap between the Student approach and the normal approach. What practical rule do you draw from it, and why is the threshold of 30 seen everywhere?
e) What condition must the population satisfy for this calculation to be valid on only 12 measurements? What should be done if it clearly does not?
Show the solution
Answers
a)The z-score requires σ known. Here, Student's t distribution with n−1=11 degrees of freedom, more spread out than the normal.
b)48.6±2.03, that is about [46.6,50.6] mg.
c)With z: ±1.81 mg. The correct interval is 12% wider, because t>z always.
d)At 29 degrees of freedom, the gap drops to 4%. Hence the threshold of 30, a convention of convenience.
e)The population must be normal. Otherwise: plot the data, transform the variable, or switch to a nonparametric method.
a)
Because the z-score assumes σ is KNOWN. Replacing it by s brings in a second source of variability: from one sample to the next, not only does x change, but s changes too, and an s that is too small would produce a misleadingly narrow interval. The ratio s/nx−μ therefore does not follow a normal distribution but a STUDENT t distribution with n−1=11 degrees of freedom, more spread out than the normal, with heavier tails. One degree of freedom is lost because s was computed from x, itself drawn from the same data.
b)
Standard error: ns=123.2≈0.924 mg. Margin: (2.201)(0.924)≈2.03 mg. Interval: 48.6±2.03, that is about [46.6,50.6] mg.
c)
With z=1.96: margin (1.96)(0.924)≈1.81 mg, so [46.8,50.4]. The correct interval is wider by the ratio 1.962.201≈1.12, that is about 12% more. The gap must go in this direction: Student's t distribution is MORE SPREAD OUT than the normal, so its critical values are always larger. Using z when σ is unknown amounts to claiming a precision you do not have, and therefore to being wrong more often than the stated confidence level suggests.
d)
With 29 degrees of freedom, t0.025=2.045 against z=1.96: the ratio drops to 1.962.045≈1.043, a gap of only 4%, against 12% with 12 measurements. Student's t distribution CONVERGES to the normal as the number of degrees of freedom grows, because s then estimates σ better and better. That is where the threshold of 30, found in every textbook, comes from: beyond it, the gap between the two distributions falls below a few percent, negligible compared with the other approximations of a real study. It is not a mathematical threshold but a convention of convenience; today, since software uses Student's t distribution whatever the size, the question only arises on exams.
e)
On such a small sample, validity rests on the NORMALITY of the original population, because the central limit theorem has not had time to act with only 12 data values. In practice, the Student procedure is robust: it copes well with a moderate departure from normality from about fifteen observations on, but it fails with strong skewness or with outliers. The reflex is therefore to PLOT the data before computing, with a box plot or a histogram. If the distribution is clearly skewed, two routes are open: transform the variable, for example by taking its logarithm, or turn to a nonparametric method, which assumes no shape for the distribution.
Part B: exam level (/50)
Exercise 6: A complete test, from the hypotheses to the write-up
On an exam, half of the marks for a test go to the WRITE-UP: stating the hypotheses, announcing the significance level, computing, deciding, and concluding in the words of the problem. The five steps always come in the same order.
A company claims that the mean waiting time at its telephone service does not exceed 4.0 minutes. A consumer association times 50 calls and obtains a mean of 4.4 minutes, with σ=1.5 minutes.
The figure below represents the situation.
a) State the five steps of a hypothesis test.
b) State H0 and H1 and justify that the test is right-tailed.
c) Carry out the complete test at the 5% level and write the conclusion.
d) Would the conclusion change with a two-sided test? Compute and comment.
e) The association has the budget for 200 calls instead of 50. Without redoing the whole calculation, explain how this would change the power of the test.
Show the solution
Answers
a)1: hypotheses. 2: level and conditions. 3: statistic. 4: p-value and decision. 5: conclusion in plain language.
b)H0:μ≤4.0 against H1:μ>4.0. Right-tailed: only a longer wait is a grievance.
c)Standard error 0.2121, z=1.886, p-value 0.0296<0.05: reject. The mean wait really exceeds 4.0 minutes.
d)Two-sided, p-value =0.0593>0.05: the conclusion is reversed. The direction of the test is set before collecting data.
e)Standard error divided by 2, z=3.77: the power increases, and it is the only way to reduce both types of error at once.
a)
Step 1: state H0 and H1. Step 2: set the significance level α and check the conditions. Step 3: compute the test statistic. Step 4: compute the p-value, or compare with the critical value, and decide. Step 5: conclude in plain language, in the words of the problem, without jargon.
b)
H0:μ≤4.0 minutes, the company's claim is true. H1:μ>4.0 minutes. The test is RIGHT-TAILED because the association is trying to establish only one thing: that the wait is LONGER than claimed. A waiting time shorter than promised is of no interest to it and would be no grievance. The alternative hypothesis must always reflect what we are trying to show.
c)
Conditions: n=50≥30, the central limit theorem applies and σ is known. The standard error is 501.5=0.2121 minutes. The statistic is z=0.21214.4−4.0=1.886. Since the test is right-tailed, the p-value is P(Z>1.886)=0.0296. As 0.0296<0.05, we REJECT H0. Written conclusion: at the 5% level, the data collected allow us to conclude that the mean waiting time really exceeds the 4.0 minutes claimed by the company; the observed gap of 0.4 minutes is too large to be put down to sampling chance alone.
d)
In a two-sided test, the p-value would double: 2×0.02967=0.0593. As 0.0593>0.05, we would NOT reject H0. The conclusion is therefore reversed. This shows that a one-sided test is more POWERFUL when there is a legitimate reason to orient the hypothesis, since it puts all of the risk α on one side. But it also shows the danger: choosing a one-sided test AFTER seeing the direction of the gap amounts to quietly doubling your significance level, which is a methodological fault. The direction of the test must be set before the data are collected.
e)
The power, that is 1−β, the probability of detecting a gap that is really there, would INCREASE. Going from 50 to 200 calls divides the standard error by 4=2, down to 0.106 minutes. The same observed gap of 0.4 minutes would then produce a statistic twice as large, z=3.77, and therefore a much smaller p-value. In other words, with 200 calls the association would detect SMALLER gaps than those it can establish with 50, and its conclusion would hold up whatever the significance level and whether the test is one-sided or two-sided. Increasing n is the only way to reduce both types of error at once.
Exercise 7: The test on a proportion
A manufacturer claims that 90% of its parts conform to specifications. A customer inspects 200 of them and finds only 172 that conform. The customer suspects the manufacturer of overstating its quality.
The figure below represents the situation.
a) Compute the observed proportion. State H0 and H1, and justify why the test is one-sided and in which direction.
b) Check the conditions of validity, then compute the standard error of the proportion UNDER H0 and the test statistic.
c) Compute the p-value and state precisely what it means here.
d) Draw a conclusion at the 5% level, then at the 1% level. What should be made of a difference between the two?
e) In the standard error, 0.90 was used and not the observed proportion 0.86. Justify this choice, and say why it is the other way round in a confidence interval.
Show the solution
Answers
a)p^=0.860. H0:p=0.90 against H1:p<0.90, left-tailed.
b)np0=180 and n(1−p0)=20, both ≥5. Standard error 0.0212, so z≈−1.89.
c)p-value ≈0.0297: the probability of a result this unfavourable IF p really were 0.90.
d)Rejected at 5%, not rejected at 1%: the evidence is moderate, so report the p-value rather than a verdict.
e)The test assumes H0 is true, so p0=0.90. The interval has no starting hypothesis, so p^=0.86, hence a standard error of 0.0245.
a)
p^=200172=0.860. Hypotheses: H0:p=0.90, the manufacturer's claim, which is the default hypothesis, rejected only on evidence; and H1:p<0.90. The test is LEFT-TAILED because the customer is only worried about a quality BELOW the claim: a proportion above 90% would be no ground for a dispute. The direction of H1 must be set before looking at the data, otherwise the significance level loses all meaning.
b)
Conditions: np0=(200)(0.90)=180≥5 and n(1−p0)=(200)(0.10)=20≥5, so the normal approximation is legitimate. Standard error under H0: σp^=np0(1−p0)=200(0.90)(0.10)=0.00045≈0.0212. Test statistic: z=σp^p^−p0=0.02120.860−0.900≈−1.89.
c)
Left-tailed test: p-value =P(Z<−1.886)≈0.0297, about 3.0%, keeping z unrounded; the table, read at z=−1.89, gives 0.0294, which changes nothing in what follows. Exact meaning: IF the manufacturer were telling the truth, that is, if the true proportion really were 0.90, then a sample of 200 parts would give a result this unfavourable or worse in 3% of cases. It is NOT the probability that the manufacturer is wrong: the p-value is computed assuming H0 is true, so it can say nothing about the probability of H0.
d)
At the 5% level: 0.0297<0.05, we REJECT H0, the data are significantly below the claim. At the 1% level: 0.0297>0.01, we do NOT reject. Such a difference is not a contradiction: it simply signals that the evidence is moderate, and that the conclusion depends on the standard of proof chosen. Good practice is to report the p-value itself rather than a yes-or-no verdict, so that readers can judge with their own level. It is also a reminder that the level must be set BEFORE the calculation: choosing it afterwards amounts to choosing the conclusion.
e)
In a TEST, we reason assuming H0 is true from start to finish: it is this hypothesis that supplies the value of p to use, hence 0.90. Using 0.86 would partly assume the very thing we are putting to the test. In a confidence INTERVAL, on the other hand, there is no starting hypothesis: we have only the sample, and the only value available to estimate the standard error is p^. The two procedures do not start from the same place, hence two formulas that look alike without being identical, and a very common confusion on exams.
Exercise 8: Comparing two means: the two-sample test
Two groups take the same course with different teaching methods. Group 1: 40 students, mean 74.2 and standard deviation 8.5. Group 2: 35 students, mean 70.1 and standard deviation 9.2. The two samples are independent and both sizes exceed 30.
The chart below represents the data.
a) State H0 and H1 to find out whether the two methods differ, and justify the two-sided choice.
b) Compute the standard error of the DIFFERENCE of the means. Why are the two terms added when the means are subtracted?
c) Compute the test statistic and the p-value.
d) Draw a conclusion at the 5% and 1% levels.
e) Build the 95% confidence interval for the difference μ1−μ2. Check that it agrees with the test, and say what the interval adds to the p-value.
Show the solution
Answers
a)H0:μ1=μ2 against H1:μ1=μ2, two-sided.
b)1.806+2.418≈2.055: the variances add up, even for a difference.
c)z=2.0554.1≈1.99, p-value ≈0.046.
d)Rejected only just at 5%, not rejected at 1%: a clue, not a proof.
e)4.1±4.03, that is [0.07,8.13]: it only just excludes zero, and gives the order of magnitude of the effect, from negligible to large.
a)
H0:μ1=μ2, that is μ1−μ2=0: the two methods give the same mean result. H1:μ1=μ2. The test is TWO-SIDED because the question asked is whether the methods DIFFER, without having decided in advance which one would be better. Choosing a one-sided test after noticing that group 1 has the higher mean would be a fault: it would amount to halving the p-value in light of the data.
b)
σx1−x2=n1s12+n2s22=4072.25+3584.64=1.806+2.418=4.225≈2.055. We add because it is the VARIANCES that add up for independent variables, whether these variables are added or subtracted. The intuition is simple: subtracting two uncertain quantities does not remove the uncertainty, it accumulates it, each of the two means contributing to the variation of the difference. The standard deviation of the difference is larger than each of the two taken separately, never smaller.
At the 5% level: 0.046<0.05, we reject H0, but only just. At the 1% level: 0.046>0.01, we do not reject. The result is therefore borderline: it is a clue, not a proof, and it calls for a replication on a larger sample rather than a firm conclusion. Announcing “method 1 is better” on this basis would go far beyond what the data allow.
e)
Interval: (74.2−70.1)±(1.96)(2.055)=4.1±4.03, that is about [0.07,8.13]. It excludes zero, only just, which agrees exactly with the narrow rejection at the 5% level: the two procedures are two readings of the same calculation, and a 95% interval that excludes zero is always equivalent to a p-value below 0.05 in a two-sided test. The interval nevertheless adds a great deal: it does not only say that a difference exists, it gives the set of plausible values of that difference, here between almost nothing and eight points. In other words, the data are compatible with a negligible effect as well as with a large one, which the bare statement “significant at 5%” would completely hide.
Exercise 9: The chi-square test of independence
We want to know whether passing a course is related to regular attendance. Out of 200 students: among the 120 who attend regularly, 90 passed and 30 failed; among the 80 who do not, 40 passed and 40 failed. Critical values of chi-square with 1 degree of freedom: 3.841 at the 5% level and 6.635 at the 1% level.
The chart below represents the data.
a) Draw up the contingency table with its totals, compute the pass rates of the two groups, and state H0 and H1.
b) Compute the EXPECTED counts under H0 and justify the formula used.
c) Compute the chi-square statistic and its number of degrees of freedom.
d) Draw a conclusion at the 5% and 1% levels. Check the conditions of validity of the test along the way.
e) Can we deduce that attending class makes students pass? Discuss, and suggest a competing explanation.
d)Rejected at 5% and at 1%. The smallest expected count is 28, well above 5.
e)No: association is not causation. Motivation, a confounding variable, would explain both attendance and passing.
a)
The table crosses attendance with passing: regular attenders, 90 passes and 30 failures, total 120; irregular attenders, 40 and 40, total 80. Column totals: 130 passes and 70 failures, for 200 students. Pass rates: 12090=75% among regular attenders against 8040=50% among the others, a gap of 25 points. H0: the two variables are INDEPENDENT, attendance has no link with passing. H1: they are related.
b)
Under H0, the pass rate must be the same everywhere, namely the overall rate 200130=65%. Among regular attenders we therefore expect (120)(0.65)=78 passes, which can be written 200(120)(130): EXPECTED count =grand totalrow total×column total. The four expected values are thus 78 and 42 for regular attenders, 52 and 28 for irregular attenders. Check: each row and each column adds back up to its original total, which must always be the case.
c)
χ2=∑E(O−E)2=78(90−78)2+42(30−42)2+52(40−52)2+28(40−28)2=1.846+3.429+2.769+5.143≈13.19. The gaps all equal 12 in absolute value, as is always the case in a 2 by 2 table, but they weigh more when the expected count is small, hence the division by E. Degrees of freedom: (2−1)(2−1)=1, because once one cell is fixed, the totals determine the other three.
d)
13.19>3.841: we reject H0 at the 5% level. 13.19>6.635: we also reject it at the 1% level, and by a wide margin, the p-value being of the order of 0.0003. The conclusion is therefore solid, unlike the borderline case of a narrow rejection. Conditions of validity: all EXPECTED counts must be at least 5; here the smallest is 28, so the condition is easily met. Note that it applies to the expected counts, never to the observed counts.
e)
No. The chi-square test establishes a statistical ASSOCIATION between two variables; it says nothing about the direction of causation, or even whether there is any. Three readings remain possible. Attendance may indeed help students pass, which is plausible. Passing may also feed attendance: a student who understands and succeeds takes a liking to the course and keeps coming, while one who falls behind stops showing up, so that the arrow would go from passing to attendance. Finally, a CONFOUNDING variable may produce both: motivation, personal organization, or simply not working thirty hours a week alongside one's studies, would explain both attendance and results, without either one causing the other. Only an experiment in which attendance was imposed at random could settle the matter, and it would hardly be practicable. It is exactly the same caution as the one a correlation coefficient demands.
Exercise 10: Problem: significant does not mean important
A very large sample makes almost any gap statistically significant, however tiny. Telling SIGNIFICANCE, which is a question of chance, from IMPORTANCE, which is a question of consequences, is the final skill of the course.
We go back to the bags labelled 500 g, with σ=15 g. This time the inspector weighs 10,000 bags and obtains a mean of 499.5 g.
a) Carry out the two-sided test at the 5% level and draw a conclusion.
b) The observed gap is 0.5 g out of 500. Express it as a percentage and comment on its practical importance.
c) Compute the effect size d=σ∣x−μ0∣ in this case and in that of exercise 4, where the gap was 6 g on 40 bags. Compare.
d) Explain the mechanism: why does a large n make a negligible gap significant?
e) What information must an honest statistical report publish, in addition to the p-value?
Show the solution
Answers
a)Standard error 0.15 g, z=−3.33, p-value 0.00086: very clear rejection.
b)5000.5=0.1%: significant and of no practical importance.
c)d=0.033 here against d=0.400 in exercise 4: twelve times smaller, despite a far more impressive p-value.
d)z=dn: the factor n has no bound, so every nonzero gap ends up significant.
e)Effect size, confidence interval, sample size, exact p-value, and the list of all the analyses carried out.
a)
The standard error is 1000015=0.15 g. The statistic is z=0.15499.5−500=−3.33, hence a two-sided p-value of 2×0.00043=0.00086. As 0.00086<0.05 and even <0.01, we REJECT H0 very clearly: the gap is highly significant.
b)
The relative gap is 5000.5=0.1%. Half a gram on a 500 g bag is completely negligible in practice: it is well below the tolerance of any commercial scale, below the variation due to ambient humidity, and has no effect whatsoever on the consumer. The result is therefore statistically significant AND of no practical importance. The two notions are independent.
c)
Here d=150.5=0.033. In exercise 4, d=156=0.400. The effect size in the present case is therefore TWELVE TIMES smaller, even though its p-value is far more impressive. This makes sense: the effect size does NOT depend on n, it measures the gap in units of the population standard deviation, whereas the p-value depends heavily on n. That is precisely why the effect size is the relevant indicator for judging importance.
d)
Because the test statistic can be written z=σ/nx−μ0=σx−μ0×n, that is, the effect size MULTIPLIED by n. The factor n has no bound: by making the sample large enough, z can be made as large as we like for any nonzero gap, however tiny. Since no real process is perfectly centred, every gap ends up significant if we measure enough. The question is therefore never “is there a gap”, to which the answer is always yes, but “is the gap large enough to care about”.
e)
At least four items. First, the EFFECT SIZE, the only measure of importance, insensitive to n. Second, the CONFIDENCE INTERVAL for the gap, which gives both the order of magnitude and its precision, and which contains far more information than a p-value. Third, the SAMPLE SIZE, without which a p-value cannot be interpreted. Fourth, the EXACT p-value, and not a bare “significant” or “p < 0.05”, so that readers can judge with their own level. To these must be added a statement of all the analyses carried out: testing twenty true null hypotheses at the 5% level produces one false positive on average, and publishing only that one is the practice known as p-hacking.
Something missing from this set?A type of exercise your teacher gives, a problem you are stuck on, a mistake you spotted: tell me, I read every request.
Sending goes through your free space: that is how I can answer you and tell you when the exercise is added. An email is enough, no password. Create your space.
Rather not create an account? Write to me directly.
Get in touch for a first session. Inference is the chapter where method matters more than calculation: five steps that never change, and half of the marks come from the write-up.