Advanced Statistics 201-337 • CEGEP, Montreal

Corrected practice final exam in advanced statistics (201-337)

This is a practice final exam with full solutions for 201-337, Advanced Statistics, the CEGEP statistics course that covers descriptive statistics, probability and distributions, estimation, hypothesis testing and regression.

It is calibrated on a real final exam: 12 exercises, 100 marks, 3 hours. The difference from the chapter sets is deliberate, and it is the whole point of the exercise: every question draws on several parts of the course and none announces its method. It is up to you to recognize whether you need an interval, a test, a discrete distribution or a regression, which is exactly the skill the final exam assesses.

Four parts of 25 marks. Part A describes and models data: a sample confronted with a normal model (exercise 1), Chebyshev's inequality when normality cannot be assumed (exercise 2) and the sample size of a survey (exercise 3). Part B is on probability and distributions: Bayes' theorem on a screening test (exercise 4), the binomial, Poisson and normal distributions for the same count (exercise 5) and the central limit theorem applied to a game of chance (exercise 6). Part C is on deciding under uncertainty: type I and type II errors and power (exercise 7), the duality between confidence interval and test (exercise 8) and the chi-square goodness-of-fit test (exercise 9). Part D holds three synthesis problems: Simpson's paradox (exercise 10), regression with its confidence and prediction intervals (exercise 11) and five misleading claims to correct (exercise 12).

All the critical values you need are given in the statements, so there is no table to look up.

12 corrected exercises • 100 points • 180 minutes

This chapter is part of 201-337, every chapter with its set and sheet

Self-checking set Type 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.

Course recap

  • • Sample standard deviation: s=∑(xi−x‾)2n−1s=\sqrt{\frac{\sum(x_{i}-\overline{x})^{2}}{n-1}}. z-score: z=x−x‾sz=\frac{x-\overline{x}}{s}.
  • • Chebyshev's inequality: for ANY distribution and any k>1k>1, at least 1−1k21-\frac{1}{k^{2}} of the data lie within kk standard deviations of the mean. The 68-95-99.7 rule is more precise, but it requires normality.
  • • Standard error of the mean: σn\frac{\sigma}{\sqrt{n}}. Sample size for a margin EE: n=(zσE)2n=\left(\frac{z\sigma}{E}\right)^{2} for a mean, n=(zE)2p(1−p)n=\left(\frac{z}{E}\right)^{2}p(1-p) for a proportion, with p=0.5p=0.5 in the worst case.
  • • Validity conditions: Poisson approximation if n≥50n\geq 50 and p≤0.1p\leq 0.1; normal approximation to the binomial if np≥5np\geq 5 AND n(1−p)≥5n(1-p)\geq 5.
  • • Type I error: rejecting H0H_{0} when it is true, with probability α\alpha. Type II error: not rejecting H0H_{0} when it is false, with probability β\beta. The power is 1−β1-\beta, and it is always computed against a specific value of the alternative hypothesis.
  • • Chi-square: χ2=∑(O−E)2E\chi^{2}=\sum\frac{(O-E)^{2}}{E}. For a goodness-of-fit test with kk categories, the number of degrees of freedom is k−1k-1.
  • • Regression: b=SxySxxb=\frac{S_{xy}}{S_{xx}}, a=y‾−bx‾a=\overline{y}-b\overline{x}, r=SxySxxSyyr=\frac{S_{xy}}{\sqrt{S_{xx}S_{yy}}} and se=Syy−bSxyn−2s_{e}=\sqrt{\frac{S_{yy}-bS_{xy}}{n-2}}.
  • • A confidence interval brackets the MEAN of yy for a given xx; a prediction interval brackets ONE future observation, and it is always wider.

Part A: Describing and modelling (/25)

Exercise 1: From a raw sample to the model that describes it

The durations, in minutes, of twelve home-to-work commutes are recorded: 18, 22, 25, 25, 27, 28, 30, 31, 33, 35, 38, 44.

Recall that for the standard normal distribution, P(Z>1.44)≈0.0749P(Z>1.44)\approx 0.0749 and P(Z>2.00)≈0.0228P(Z>2.00)\approx 0.0228.

The graph below shows the data.

15202530354045min
  • a) Compute the mean and the standard deviation of this sample, rounded to the thousandth.
  • b) An employer claims that the commute time follows a normal distribution with the same parameters. Under this model, what is the probability that a commute takes more than 40 minutes?
  • c) What proportion of the sample actually exceeds 40 minutes? Compare with b) and comment.
  • d) Compute the z-score of the 44-minute commute. Should it be treated as an outlier?

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
Show the solution

Answers

  • a) x‾≈29.667\overline{x}\approx 29.667 min and s≈7.165s\approx 7.165 min.
  • b) z≈1.44z\approx 1.44, so P(X>40)≈0.0749P(X>40)\approx 0.0749, about 7.5%.
  • c) One commute out of twelve, that is 8.3%. Close to the 7.5%, but twelve observations validate nothing.
  • d) z≈2.00z\approx 2.00, right at the limit of the usual criterion. It is not discarded: 44 minutes is plausible.
a)

The sum is 356, so x‾=35612≈29.667\overline{x}=\frac{356}{12}\approx 29.667 minutes. The sum of the squared deviations is about 564.667564.667, and dividing by n−1=11n-1=11 gives a variance of about 51.33351.333, so s≈7.165s\approx 7.165 minutes.

b)

Compute the z-score of the cutoff: z=40−29.6677.165≈1.44z=\frac{40-29.667}{7.165}\approx 1.44. So P(X>40)=P(Z>1.44)≈0.0749P(X>40)=P(Z>1.44)\approx 0.0749, about 7.5%.

c)

Only one commute out of twelve exceeds 40 minutes, that is 112≈0.0833\frac{1}{12}\approx 0.0833, about 8.3%. The two values are close, which is rather reassuring for the model. But the conclusion must stay cautious: with twelve observations, a single commute more or less above 40 minutes would move the empirical proportion to 0 or to 16.7%. A sample of this size can neither seriously confirm nor seriously refute a normality assumption.

d)

z=44−29.6677.165≈2.00z=\frac{44-29.667}{7.165}\approx 2.00. The usual criterion puts the boundary at ∣z∣>2|z|>2, sometimes at ∣z∣>3|z|>3: the value is therefore right at the limit, and certainly not beyond all suspicion. It must not be discarded. A value is not an outlier because it is large, but because there is a reason to believe it comes from a measurement error or from another population. Here, 44 minutes is a perfectly plausible commute time.

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.

Exercise 2: When the empirical rule is not allowed

A production line fills bags. The mass has a mean of 500 grams and a standard deviation of 80 grams, but the distribution is clearly skewed: nothing allows us to assume it is normal.

Recall that for a normal distribution, P(∣Z∣<2)≈0.9545P(|Z|<2)\approx 0.9545 and P(∣Z∣<3)≈0.9973P(|Z|<3)\approx 0.9973.

  • a) State Chebyshev's inequality and apply it with k=2k=2. What interval of masses do you get, and what minimum proportion of the bags lies in it?
  • b) Do the same with k=3k=3.
  • c) Compare, for k=2k=2 and then k=3k=3, Chebyshev's bound with the exact value a normal distribution would give. What does giving up the normality assumption cost?
  • d) A bag weighs 740 grams. What can be said about how often such deviations occur, with and without the normality assumption?
  • e) A quality inspector writes: “since 95% of the bags are between 340 and 660 grams, production is compliant.” Correct the sentence.

Type your answers, the page tells you right or wrong 0/15

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) [340,660][340, 660] g, at least 75% of the bags.
  • b) [260,740][260, 740] g, at least 88.9% of the bags.
  • c) Normal: 95.45% and 99.73%. Beyond three standard deviations, Chebyshev allows 11.1% against 0.27%, forty times more.
  • d) z=3z=3: at most 11.1% of the bags deviate that much, against 0.27% under the normal.
  • e) Chebyshev gives at least 75%, not 95%. And compliance is judged against tolerances set in advance, not against the observed spread.
a)

Chebyshev's inequality states that for any distribution, whatever its shape, and for any k>1k>1, the proportion of data within kk standard deviations of the mean is at least 1−1k21-\frac{1}{k^{2}}. With k=2k=2: the interval is 500±2×80500\pm 2\times 80, that is [340,660][340, 660] grams, and it contains at least 1−14=0.751-\frac{1}{4}=0.75, so at least 75% of the bags.

b)

With k=3k=3: the interval is 500±240500\pm 240, that is [260,740][260, 740] grams, and it contains at least 1−19≈0.88891-\frac{1}{9}\approx 0.8889, so at least 88.9% of the bags.

c)

For k=2k=2, Chebyshev guarantees 75% whereas the normal distribution would give 95.45%. For k=3k=3, Chebyshev guarantees 88.9% against 99.73%. The gap is considerable, especially in the tails: beyond three standard deviations, the normal distribution leaves 0.27% of the data, while Chebyshev allows up to 11.1%, about forty times more. Giving up normality is therefore very costly in precision. In return, Chebyshev's bound holds without any condition, and that is its whole point: it can never be proved wrong.

d)

740 grams corresponds exactly to z=740−50080=3z=\frac{740-500}{80}=3. Without any assumption on the shape of the distribution, only one thing can be stated: at most 11.1% of the bags lie more than three standard deviations from the mean, in either direction, so at most 11.1% weigh more than 740 grams or less than 260. If the distribution were normal, these two tails together would hold only 0.27%, and a 740-gram bag would be a remarkable event. Here it is not necessarily one.

e)

Two mistakes. First, Chebyshev's inequality does not give 95% but at least 75%: the inspector applied the empirical rule, which assumes normality, whereas the statement rules it out. Second, and more serious, compliance has nothing to do with this calculation: it is judged against tolerances set in advance, not against the observed spread. A very irregular production always satisfies Chebyshev; that does not make it compliant.

200300400500600700800k = 2: at least 75%k = 3: at least 88.9%740 g bagg

Exercise 3: How many observations do you really need?

A polling institute is preparing two surveys, both at the 95% confidence level, for which z=1.96z=1.96.

The first is about a mean, monthly income, whose standard deviation is known from earlier records to be about 15 units. The second is about a proportion, that of people in favour of a measure.

  • a) What sample size is needed to estimate mean income with a margin of error of 2 units?
  • b) What size is needed to estimate the proportion with a margin of 3 percentage points, without any prior information on pp?
  • c) A pilot survey suggests that pp is around 0.2. Recompute the required size and comment on the difference with b).
  • d) The institute is considering running survey b) in Quebec, which has about 9 million inhabitants, rather than in a province of 150,000 inhabitants, and thinks the larger population will require a larger sample. Is it right?

Type your answers, the page tells you right or wrong 0/10

a)
b)
c)
d)
Show the solution

Answers

  • a) n=216.09n=216.09, so 217 people.
  • b) With p=0.5p=0.5: n=1067.11n=1067.11, so 1068 people.
  • c) With p=0.2p=0.2: n=682.95n=682.95, so 683 people, that is 36% fewer.
  • d) No: the population size appears nowhere. 1068 respondents give the same margin everywhere.
a)

Isolate nn in E=zσnE=\frac{z\sigma}{\sqrt{n}}, which gives n=(zσE)2=(1.96×152)2=(14.7)2=216.09n=\left(\frac{z\sigma}{E}\right)^{2}=\left(\frac{1.96\times 15}{2}\right)^{2}=\left(14.7\right)^{2}=216.09. A sample size is always rounded UP, otherwise the target margin is not reached: 217 people are needed.

b)

Here n=(zE)2p(1−p)n=\left(\frac{z}{E}\right)^{2}p(1-p), and without information on pp we take the value that maximizes p(1−p)p(1-p), namely p=0.5p=0.5, which gives p(1−p)=0.25p(1-p)=0.25. Then n=(1.960.03)2×0.25≈4268.44×0.25≈1067.11n=\left(\frac{1.96}{0.03}\right)^{2}\times 0.25\approx 4268.44\times 0.25\approx 1067.11, so 1068 people. This is the famous “plus or minus 3%” of opinion polls, which corresponds to about a thousand respondents.

c)

With p=0.2p=0.2, p(1−p)=0.16p(1-p)=0.16 and n≈4268.44×0.16≈682.95n\approx 4268.44\times 0.16\approx 682.95, so 683 people. That is 36% fewer than in b) for the same precision. Prior information, even approximate, saves about a third of the cost of the survey, because the variance of a proportion drops sharply as soon as you move away from 0.5.

d)

No, the institute is wrong. The formulas above nowhere contain the size NN of the population: precision depends on the number of people surveyed, not on the share of the population they represent. As long as the sample is less than 5% of the population, which is the case in both provinces, 1068 respondents give exactly the same margin of error. It is one of the most counter-intuitive results of the course, and it is the reason why a national poll and a municipal poll survey the same number of people.

Part B: Probability and distributions (/25)

Exercise 4: A screening test, from Bayes to the decision

A disease affects 0.8% of a population. A screening test detects 95% of the people who have the disease, and it comes out positive for 4% of healthy people.

Probabilities are rounded to four decimal places.

  • a) Translate the data of the statement into probabilities, clearly naming the events.
  • b) Compute the probability that a person chosen at random gets a positive result.
  • c) A person tests positive. What is the probability that this person actually has the disease?
  • d) A person tests negative. What is the probability that this person is actually healthy?
  • e) The test is described as “95% reliable.” Explain why this wording is misleading, then say what would change if the test were applied only to a high-risk population in which the disease affects 30% of people.

Type your answers, the page tells you right or wrong 0/12

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) P(D)=0.008P(D)=0.008, sensitivity 0.950.95, false positives 0.040.04, specificity 0.960.96.
  • b) P(T)=0.008(0.95)+0.992(0.04)=0.0473P(T)=0.008(0.95)+0.992(0.04)=0.0473.
  • c) 0.00760.04728≈0.1607\dfrac{0.0076}{0.04728}\approx 0.1607: more than four positives out of five are false alarms.
  • d) P(T‾)=0.9527P(\overline{T})=0.9527 and the probability of being healthy is 0.99960.9996: the test reassures well but alarms poorly.
  • e) “95% reliable” is the sensitivity, not the predictive value. In the high-risk population, the latter rises to 0.91050.9105.
a)

Let DD be the event “the person has the disease” and TT the event “the test is positive.” The statement gives P(D)=0.008P(D)=0.008, the sensitivity P(T∣D)=0.95P(T\mid D)=0.95, and the false positive rate P(T∣D‾)=0.04P(T\mid\overline{D})=0.04, which is equivalent to a specificity P(T‾∣D‾)=0.96P(\overline{T}\mid\overline{D})=0.96.

b)

By the law of total probability: P(T)=0.008×0.95+0.992×0.04=0.0076+0.03968=0.04728P(T)=0.008\times 0.95+0.992\times 0.04=0.0076+0.03968=0.04728, about 4.73%.

c)

P(D∣T)=P(D∩T)P(T)=0.00760.04728≈0.1607P(D\mid T)=\frac{P(D\cap T)}{P(T)}=\frac{0.0076}{0.04728}\approx 0.1607. A person who tests positive therefore has only about a 16% chance of having the disease: more than four positives out of five are false alarms. The reason is arithmetic, not medical: healthy people are so numerous that their 4% of false positives, about 39.7 people per thousand, swamp the 7.6 true positives per thousand.

d)

P(T‾)=0.008×0.05+0.992×0.96=0.0004+0.95232=0.95272P(\overline{T})=0.008\times 0.05+0.992\times 0.96=0.0004+0.95232=0.95272, so P(D‾∣T‾)=0.952320.95272≈0.9996P(\overline{D}\mid\overline{T})=\frac{0.95232}{0.95272}\approx 0.9996. A negative result, on the other hand, is almost certain. The test is excellent at reassuring and poor at raising the alarm.

e)

“95% reliable” refers to the sensitivity, that is, a conditional probability GIVEN that the person has the disease. But the patient who receives the result is asking the reverse question: what is the probability of having the disease given that the test is positive? The two numbers, 95% and 16%, are both correct and do not describe the same thing; confusing them is the error of inverting conditional probabilities. In a high-risk population where P(D)=0.3P(D)=0.3, we would have P(T)=0.3×0.95+0.7×0.04=0.285+0.028=0.313P(T)=0.3\times 0.95+0.7\times 0.04=0.285+0.028=0.313 and P(D∣T)=0.2850.313≈0.9105P(D\mid T)=\frac{0.285}{0.313}\approx 0.9105. The same test, without any of its characteristics changing, then becomes highly conclusive. This is why a rare disease is not screened for in the general population: the value of a test depends as much on who is tested as on the test itself.

Exercise 5: Three distributions for the same count

A machine produces parts, 2% of which are defective, independently of one another. A batch of 200 parts is sampled and XX denotes the number of defective parts.

Recall that the Poisson approximation is accepted when n≥50n\geq 50 and p≤0.1p\leq 0.1, and the normal approximation when np≥5np\geq 5 and n(1−p)≥5n(1-p)\geq 5.

  • a) Justify that XX follows a binomial distribution and give its parameters, its expected value and its standard deviation.
  • b) Compute P(X=3)P(X=3) with the exact binomial distribution, to four decimal places.
  • c) Compute the same probability with the Poisson approximation and compare.
  • d) Can the normal approximation be used here? Justify with the conditions, without doing the calculation.
  • e) The machine goes out of adjustment and the defect rate rises to 40%. Redo questions c) and d): which of the two approximations becomes legitimate, and which one stops being so?

Type your answers, the page tells you right or wrong 0/15

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) X∼B(200,0.02)X\sim B(200, 0.02), E(X)=4E(X)=4 and σ≈1.9799\sigma\approx 1.9799.
  • b) (2003)=1 313 400\binom{200}{3}=1\,313\,400 and P(X=3)≈0.1963P(X=3)\approx 0.1963.
  • c) Poisson with λ=4\lambda=4: P(X=3)≈0.1954P(X=3)\approx 0.1954, within one thousandth of the exact value.
  • d) No: np=4<5np=4<5. The distribution is too skewed.
  • e) With p=0.4p=0.4: np=80np=80 and n(1−p)=120n(1-p)=120, the normal becomes legitimate; p>0.1p>0.1, so Poisson is no longer valid.
a)

The same two-outcome trial, defective or not, is repeated 200 times with a constant probability and independent draws: XX follows the binomial distribution with parameters n=200n=200 and p=0.02p=0.02. Its expected value is np=4np=4 parts and its standard deviation np(1−p)=3.92≈1.9799\sqrt{np(1-p)}=\sqrt{3.92}\approx 1.9799.

b)

P(X=3)=(2003)(0.02)3(0.98)197P(X=3)=\binom{200}{3}(0.02)^{3}(0.98)^{197}. With (2003)=1 313 400\binom{200}{3}=1\,313\,400, we get P(X=3)≈0.1963P(X=3)\approx 0.1963.

c)

The Poisson approximation uses λ=np=4\lambda=np=4: P(X=3)≈e−4×433!=64 e−46≈0.1954P(X=3)\approx\frac{\mathrm{e}^{-4}\times 4^{3}}{3!}=\frac{64\,\mathrm{e}^{-4}}{6}\approx 0.1954. The gap with the exact value is less than one thousandth, a relative error of about 0.5%. The conditions are indeed met since n=200≥50n=200\geq 50 and p=0.02≤0.1p=0.02\leq 0.1.

d)

No. The condition np≥5np\geq 5 is not satisfied: np=4np=4. This is consistent with the shape of the distribution, which is very skewed here since it stops at zero on one side and spreads out on the other, whereas the normal distribution is symmetric. Approximating such a distribution by a normal one would even give nonzero probabilities to negative values of XX, which makes no sense for a count.

e)

With p=0.4p=0.4: np=80np=80 and n(1−p)=120n(1-p)=120, both far above 5, so the normal approximation becomes perfectly legitimate. On the other hand, the condition p≤0.1p\leq 0.1 no longer holds, and the Poisson approximation stops being valid. The two approximations are therefore complementary rather than competing: Poisson is for rare events over a large number of trials, the normal for situations where the expected value and its complement are both comfortably large. In between, the exact binomial is always available.

Exercise 6: From a probability distribution to the mean of a sample

A carnival game costs 2 units per play. It pays out 3 units with probability 0.3 and 12 units with probability 0.1; otherwise it pays nothing.

Let XX be the player's net gain for one play, that is, what the player receives minus what was staked.

Recall that P(Z<−0.28)≈0.3897P(Z<-0.28)\approx 0.3897.

  • a) Find the probability distribution of XX.
  • b) Compute the expected value and the standard deviation of XX. Is the game fair for the player?
  • c) A player plays 100 times. What is the approximate distribution of the player's MEAN gain per play, and why?
  • d) Compute the probability that this player ends up losing over the 100 plays as a whole.
  • e) The game's operator collects the plays of thousands of players. Explain why the operator's situation is not symmetric to the player's, even though the expected value per play has the same size for everyone.

Type your answers, the page tells you right or wrong 0/15

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) X=−2X=-2 with 0.60.6, X=1X=1 with 0.30.3, X=10X=10 with 0.10.1.
  • b) E(X)=0.1E(X)=0.1, E(X2)=12.7E(X^{2})=12.7, Var(X)=12.69\mathrm{Var}(X)=12.69, σ≈3.5623\sigma\approx 3.5623. The game is slightly favourable to the player.
  • c) Approximately normal, with expected value 0.10.1 and standard error 0.35620.3562, by the central limit theorem.
  • d) z≈−0.28z\approx -0.28, so about 0.38970.3897: nearly a 39% chance of walking away a loser.
  • e) The operator's standard error drops to 0.01130.0113, one ninth of the expected value: randomness disappears for the operator.
a)

The player stakes 2 units in every case. The player therefore gains 3−2=13-2=1 with probability 0.3, 12−2=1012-2=10 with probability 0.1, and 0−2=−20-2=-2 with the remaining probability 1−0.3−0.1=0.61-0.3-0.1=0.6. The distribution of XX thus takes the values −2-2, 11 and 1010 with respective probabilities 0.60.6, 0.30.3 and 0.10.1.

b)

E(X)=−2×0.6+1×0.3+10×0.1=−1.2+0.3+1=0.1E(X)=-2\times 0.6+1\times 0.3+10\times 0.1=-1.2+0.3+1=0.1 unit. Then E(X2)=4×0.6+1×0.3+100×0.1=2.4+0.3+10=12.7E(X^{2})=4\times 0.6+1\times 0.3+100\times 0.1=2.4+0.3+10=12.7, so Var(X)=12.7−0.12=12.69\mathrm{Var}(X)=12.7-0.1^{2}=12.69 and σ≈3.5623\sigma\approx 3.5623. Since the expected value is strictly positive, the game is even slightly favourable to the player, which is unusual. But the standard deviation is thirty-five times the expected value: the advantage is drowned in randomness.

c)

By the central limit theorem, the mean of 100 independent, identically distributed variables is approximately normal, whatever the original distribution, which here is clearly not normal since it takes only three values. This mean has expected value 0.10.1 and standard error 3.5623100≈0.3562\frac{3.5623}{\sqrt{100}}\approx 0.3562.

d)

Losing overall means that the mean gain is negative. Compute z=0−0.10.3562≈−0.28z=\frac{0-0.1}{0.3562}\approx -0.28, so the probability is about 0.38970.3897. In other words, despite a favourable game, the player has nearly a 39% chance of walking away a loser after a hundred plays.

e)

The expected value per play has the same size, but the opposite sign for the operator, who LOSES 0.1 unit on average per play made against them: as designed, this game is a losing one for the house. Above all, the standard error decreases like 1n\frac{1}{\sqrt{n}}: for the player and their 100 plays it is 0.356, three and a half times the expected value, whereas for the operator and their 100,000 plays it is 3.5623100 000≈0.0113\frac{3.5623}{\sqrt{100\,000}}\approx 0.0113, about one ninth of the expected value. Randomness dominates for one and vanishes for the other. This is exactly the mechanism casinos and insurance companies rely on: the same expected value becomes a near certainty once there are enough repetitions. Here it works against the operator, who is almost sure to lose about 0.1 unit per play over 100,000 plays; a real casino sets its prices so that this near certainty is a gain.

Part C: Deciding under uncertainty (/25)

Exercise 7: The two errors of a test, and what they cost

A machine is supposed to fill boxes with 500 grams. The standard deviation of the process is known and equals 8 grams. An inspector samples 25 boxes and wants to detect underfilling.

The inspector tests H0:μ=500H_{0}:\mu=500 against H1:μ<500H_{1}:\mu<500 at the significance level α=0.05\alpha=0.05, for which the critical value is z=−1.645z=-1.645.

Recall that P(Z>0.855)≈0.1963P(Z>0.855)\approx 0.1963 and P(Z>1.48)≈0.0694P(Z>1.48)\approx 0.0694.

  • a) Compute the standard error of the mean, then the mean mass below which the inspector will reject H0H_{0}.
  • b) Define the type I error in this precise context, and give its probability.
  • c) The machine is actually set to 496 grams. Define the type II error here, compute its probability, then the power of the test.
  • d) Redo c) if the machine is set to 495 grams. What do you notice?
  • e) The inspector wants to reduce both risks at once. What are the options, and which one is the only truly satisfactory one?

Type your answers, the page tells you right or wrong 0/14

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) Standard error 1.61.6 g, critical mass 497.368497.368 g.
  • b) Wrongly accusing a correctly set machine; probability α=0.05\alpha=0.05 by construction.
  • c) Letting real underfilling pass. z≈0.855z\approx 0.855, β≈0.1963\beta\approx 0.1963, power ≈0.8037\approx 0.8037.
  • d) z=1.48z=1.48, β≈0.0694\beta\approx 0.0694, power ≈0.9306\approx 0.9306: the power grows with the size of the misadjustment.
  • e) Lowering α\alpha or raising the detection threshold only slides the cursor. Only increasing nn reduces both risks.
a)

The standard error is σn=825=1.6\frac{\sigma}{\sqrt{n}}=\frac{8}{\sqrt{25}}=1.6 grams. The decision rule rejects H0H_{0} when x‾<500−1.645×1.6=500−2.632=497.368\overline{x}<500-1.645\times 1.6=500-2.632=497.368 grams.

b)

The type I error consists in concluding that the machine underfills when it is in fact correctly set to 500 grams. Its probability is α=0.05\alpha=0.05 by construction: the inspector chose it by setting the significance level. In concrete terms, a perfectly compliant machine will be wrongly accused once in twenty.

c)

The type II error consists in not rejecting H0H_{0}, and so letting the machine pass, when it really does underfill. If the true mean is 496, β=P(X‾>497.368 ∣ μ=496)=P(Z>497.368−4961.6)=P(Z>0.855)≈0.1963\beta=P\left(\overline{X}>497.368\ |\ \mu=496\right)=P\left(Z>\frac{497.368-496}{1.6}\right)=P(Z>0.855)\approx 0.1963. The power is therefore 1−β≈0.80371-\beta\approx 0.8037: the test detects this misadjustment about four times out of five.

d)

With μ=495\mu=495: z=497.368−4951.6=1.48z=\frac{497.368-495}{1.6}=1.48, so β≈0.0694\beta\approx 0.0694 and the power reaches about 0.93060.9306. The power increases as the misadjustment gets worse, which is reassuring and perfectly logical: the larger the gap to detect, the easier it is to detect. A test therefore never has ONE power, it has one for each value of the alternative hypothesis, and stating a power without saying against what makes no sense.

e)

Three options. Lowering α\alpha reduces the first risk but moves the cutoff down, and so increases β\beta: for a fixed sample size the two risks move in opposite directions, you only slide the cursor, and the trade-off is then settled by the cost of each error, a compliant machine wrongly accused against an underserved customer who goes unnoticed. Accepting a larger misadjustment as the detection threshold reduces β\beta but amounts to giving up on detecting small deviations. The only option that truly improves both at once is to INCREASE nn: the standard error decreases like 1n\frac{1}{\sqrt{n}}, the two distributions tighten and overlap less, so that α=0.05\alpha=0.05 can be kept while β\beta goes down. It is the only lever in statistics that trades no risk for another, and it is paid for in data collection.

492494496500502504cutoff 497.37H₀: 500H₁: 496αβmean of 25 boxes (g)

Exercise 8: Confidence interval and test: two ways of saying the same thing

A manufacturer advertises a mean lifetime of 100 hours. A laboratory tests 16 units and obtains a mean of 104.5 hours with a sample standard deviation of 8 hours. The population standard deviation is unknown.

For 15 degrees of freedom, the two-sided critical values are t=2.131t=2.131 at the 5% level and t=2.947t=2.947 at the 1% level.

  • a) Justify the choice of Student's t distribution rather than the normal distribution, then compute the test statistic for H0:μ=100H_{0}:\mu=100 against H1:μ≠100H_{1}:\mu\neq 100.
  • b) Conclude at the 5% level, then at the 1% level.
  • c) Build the 95% confidence interval for the mean lifetime, then the 99% one.
  • d) Compare the conclusions of b) with the intervals of c). State the general rule this comparison illustrates.
  • e) The sample has only 16 units. What additional assumption is then essential, and would it still be with 200 units?

Type your answers, the page tells you right or wrong 0/15

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) Student's t with 15 degrees of freedom, since σ\sigma is unknown. t=4.52=2.25t=\dfrac{4.5}{2}=2.25.
  • b) Reject at 5% since 2.25>2.1312.25>2.131; do not reject at 1% since 2.25<2.9472.25<2.947.
  • c) At 95%: [100.238,108.762][100.238, 108.762]. At 99%: [98.606,110.394][98.606, 110.394].
  • d) The two approaches agree: a two-sided test at level α\alpha rejects if and only if the 1−α1-\alpha interval excludes the tested value.
  • e) The population must be assumed normal. With 200 units, the central limit theorem would make the assumption unnecessary.
a)

The population standard deviation is unknown and replaced by the sample's: the statistic then follows a Student t distribution with n−1=15n-1=15 degrees of freedom, not a normal distribution. We compute t=x‾−μ0s/n=104.5−1008/4=4.52=2.25t=\frac{\overline{x}-\mu_{0}}{s/\sqrt{n}}=\frac{104.5-100}{8/4}=\frac{4.5}{2}=2.25.

b)

At the 5% level, ∣t∣=2.25>2.131|t|=2.25>2.131: reject H0H_{0}, the mean lifetime differs significantly from 100 hours. At the 1% level, ∣t∣=2.25<2.947|t|=2.25<2.947: do not reject H0H_{0}. The conclusion therefore depends on the level, which is normal and must be stated, never hidden.

c)

The interval is x‾±t×sn\overline{x}\pm t\times\frac{s}{\sqrt{n}}, with sn=2\frac{s}{\sqrt{n}}=2. At 95%: 104.5±2.131×2=104.5±4.262104.5\pm 2.131\times 2=104.5\pm 4.262, that is [100.238,108.762][100.238, 108.762]. At 99%: 104.5±2.947×2=104.5±5.894104.5\pm 2.947\times 2=104.5\pm 5.894, that is [98.606,110.394][98.606, 110.394].

d)

The 95% interval does NOT contain the value 100, and the test at the 5% level rejects. The 99% interval contains 100, and the test at the 1% level does not reject. The two approaches agree perfectly, and this is no coincidence: a two-sided test at level α\alpha rejects H0:μ=μ0H_{0}:\mu=\mu_{0} if and only if the confidence interval at level 1−α1-\alpha does not contain μ0\mu_{0}. Both calculations handle the same quantity, one starting from μ0\mu_{0} and going toward the data, the other starting from the data to delimit the compatible values of μ0\mu_{0}. The interval is in fact more informative: it does not only say that 100 is rejected, it gives all the values that would not be.

e)

With n=16n=16, we must assume that the lifetime itself follows an approximately normal distribution in the population: Student's t distribution is exact only under this condition, and the central limit theorem has not had time to act on such a small sample. With n=200n=200, this assumption would become practically unnecessary, because the central limit theorem makes the mean approximately normal whatever the original distribution. This is the real issue with small samples: it is not only that the intervals are wide, it is that their very validity rests on an assumption that cannot be checked with so little data.

Exercise 9: Chi-square: is the die fair?

A six-sided die is rolled 120 times and the following frequencies are recorded: 15 times a 1, 18 times a 2, 24 times a 3, 27 times a 4, 14 times a 5 and 22 times a 6.

For a chi-square test with 5 degrees of freedom, the critical value at the 5% level is 11.070.

The graph below shows the data.

Face123456
Observed frequency151824271422
051015202530observed frequency151182243274145226face
  • a) State the two hypotheses of the test and compute the expected frequencies under H0H_{0}.
  • b) Compute the chi-square statistic and conclude at the 5% level.
  • c) The experiment is continued up to 600 rolls and exactly the same proportions are obtained, namely 75, 90, 120, 135, 70 and 110. Recompute the statistic and conclude.
  • d) The observed proportions are identical in both cases, and yet the conclusions differ. Explain precisely why.
  • e) This test is about a single variable. How does it differ, in its construction, from a chi-square test of independence between two variables?

Type your answers, the page tells you right or wrong 0/14

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) H0H_{0}: fair die, 16\frac{1}{6} per face. Expected frequency: 20 per face.
  • b) χ2=13420=6.7<11.070\chi^{2}=\dfrac{134}{20}=6.7<11.070: do not reject. Nothing allows us to claim the die is loaded.
  • c) Expected frequency 100, χ2=3350100=33.5>11.070\chi^{2}=\dfrac{3350}{100}=33.5>11.070: reject, the die is loaded.
  • d) At constant proportions, the statistic is proportional to nn: 5×6.7=33.55\times 6.7=33.5. The critical value does not move.
  • e) Goodness of fit: distribution given in advance, k−1k-1 degrees of freedom. Independence: expected frequencies from the marginal totals, (r−1)(c−1)(r-1)(c-1) degrees.
a)

H0H_{0}: the die is fair, each face has probability 16\frac{1}{6}. H1H_{1}: at least one face departs from this probability. Under H0H_{0}, the expected frequency is 120×16=20120\times\frac{1}{6}=20 for each of the six faces. The validity condition is satisfied since all the expected frequencies exceed 5.

b)

The squared deviations are 2525, 44, 1616, 4949, 3636 and 44, with a sum of 134. So χ2=13420=6.7\chi^{2}=\frac{134}{20}=6.7. Since 6.7<11.0706.7<11.070, we do not reject H0H_{0}: nothing allows us to claim that the die is loaded. Be careful with the wording: we do not conclude that the die is fair.

c)

The expected frequencies become 6006=100\frac{600}{6}=100. The squared deviations are 625625, 100100, 400400, 12251225, 900900 and 100100, with a sum of 3350, so χ2=3350100=33.5\chi^{2}=\frac{3350}{100}=33.5. This time 33.5>11.07033.5>11.070 and H0H_{0} is rejected by a wide margin: the die is loaded.

d)

Because the chi-square statistic is proportional to the sample size when the proportions stay constant. Multiplying the frequencies by 5 multiplies each deviation O−EO-E by 5 as well, and its square by 25, while the denominator EE is only multiplied by 5: the ratio is therefore multiplied by 5, and we do get 5×6.7=33.55\times 6.7=33.5. The critical value, for its part, depends only on the number of degrees of freedom and does not move. In other words, the same relative imbalance becomes detectable as soon as it is observed long enough: a test does not measure the size of a deviation, it measures our ability to rule out chance, and that ability grows with the data.

e)

The difference lies in how the expected frequencies are computed and in the number of degrees of freedom. In a goodness-of-fit test, the theoretical distribution is given in advance, here equal probabilities, and kk categories are compared, hence k−1=5k-1=5 degrees of freedom. In a test of independence, no distribution is supplied: the expected frequencies are built from the marginal totals of the table itself, by E=row total×column totalgrand totalE=\frac{\text{row total}\times\text{column total}}{\text{grand total}}, and the number of degrees of freedom becomes (r−1)(c−1)(r-1)(c-1), for rr rows and cc columns. The statistic is then computed the same way in both cases.

Part D: Synthesis problems (/25)

Exercise 10: Problem: Simpson's paradox

A university offers only two programs, A and B. The table gives, for each, the number of applications and the number of admissions, separately for men and for women.

An advocacy group accuses the university of discriminating against women in admissions.

ProgramMen: applicantsMen: admittedWomen: applicantsWomen: admitted
A40024010065
B10020400100
  • a) Compute, in each program separately, the admission rate of men and that of women. Who is favoured?
  • b) Now compute the overall admission rate of men and that of women, all programs combined. Who is favoured?
  • c) Answers a) and b) contradict each other. Compute the overall admission rate of each program, then how each sex's applications are split between the two programs.
  • d) Explain the mechanism of the reversal.
  • e) Is the accusation of discrimination in admissions justified? State what these data allow us to conclude, and what they do not.

Type your answers, the page tells you right or wrong 0/17

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) A: 60.0% against 65.0%. B: 20.0% against 25.0%. Women are favoured in BOTH programs.
  • b) Men 52.0%, women 33.0%: overall, the advantage goes to men.
  • c) A admits 61.0%, B only 24.0%. 80% of men's applications go to A, 80% of women's to B.
  • d) The overall rate is an average weighted by how the applications are distributed. This is Simpson's paradox.
  • e) The charge of discrimination IN ADMISSIONS is not justified. The 19-point gap comes from how the applications are distributed, and these data do not explain where that comes from.
a)

Program A: men obtain 240400=60.0%\frac{240}{400}=60.0\% and women 65100=65.0%\frac{65}{100}=65.0\%. Program B: men obtain 20100=20.0%\frac{20}{100}=20.0\% and women 100400=25.0%\frac{100}{400}=25.0\%. In each of the two programs, without exception, women are admitted more often than men.

b)

Overall, men total 240+20=260240+20=260 admissions for 400+100=500400+100=500 applications, that is 52.0%52.0\%. Women total 65+100=16565+100=165 admissions for 100+400=500100+400=500 applications, that is 33.0%33.0\%. Overall, then, it is men who are admitted far more often, and the gap is huge.

c)

Program A admits 305500=61.0%\frac{305}{500}=61.0\% of its applicants, program B only 120500=24.0%\frac{120}{500}=24.0\%: A is not very selective, B is highly selective. Now men submitted 400 of their 500 applications to A, that is 80%, while women submitted 400 of their 500 to B, also 80%, but in the difficult program.

d)

The overall rate of a group is an average of the rates per program, weighted by how its applications are distributed. Men applied massively where 61% of applicants are admitted, women where only 24% are. This difference in weighting, which is considerable, outweighs the five-point advantage women enjoy in each program. This is Simpson's paradox: an association observed in every subgroup can reverse in the aggregate, as soon as a third variable, here the choice of program, is linked both to the group and to the outcome.

e)

The accusation, as worded, is not justified: in admissions, that is, once the program is chosen, women are favoured everywhere. What the data show is an overall gap of 19 points produced entirely by how the applications are distributed. What the data cannot tell us is WHY this distribution is what it is, nor whether some upstream mechanism, academic guidance, information, stereotypes, steers women toward the more selective program. The question therefore remains open, but it moves from admission to application. The methodological lesson is general: never aggregate subgroups without checking whether membership in a subgroup itself depends on the variable under study.

020406080admission rate (%)60%65%Program A20%25%Program B52%33%Overallmenwomen

Exercise 11: Problem: from regression to prediction, with its uncertainty

For six students, the number of hours of study xx and the mark obtained yy out of 100 are recorded.

For 4 degrees of freedom, the two-sided critical value at the 5% level is t=2.776t=2.776.

The graph below shows the data.

Hours x2457810
Mark y525863707481
1234567891011124045505560657075808590hours of studymark
  • a) Compute SxxS_{xx}, SyyS_{yy} and SxyS_{xy}, then the equation of the least-squares line.
  • b) Compute the correlation coefficient and the coefficient of determination. Interpret the latter.
  • c) Compute the standard error of the estimate ses_{e}.
  • d) For 6 hours of study, give the 95% confidence interval for the MEAN mark, then the 95% prediction interval for the mark of ONE student. Explain why the second is wider.
  • e) A student plans to study for 20 hours. What does the model predict, and what should we make of it?

Type your answers, the page tells you right or wrong 0/17

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) Sxx=42S_{xx}=42, Syy≈573.333S_{yy}\approx 573.333, Sxy=155S_{xy}=155, so y^≈3.6905x+44.1905\hat{y}\approx 3.6905x+44.1905.
  • b) r≈0.99886r\approx 0.99886 and r2≈0.9977r^{2}\approx 0.9977: 99.8% of the variation explained, which is suspicious on six points.
  • c) Residual sum ≈1.3095\approx 1.3095, so se≈0.5722s_{e}\approx 0.5722 point.
  • d) y^≈66.333\hat{y}\approx 66.333. Confidence: ±0.648\pm 0.648. Prediction: ±1.716\pm 1.716, almost three times wider, because it adds the individual spread.
  • e) y^≈118\hat{y}\approx 118, impossible: extrapolation outside [2,10][2, 10] hours, and a mark levels off, which a straight line never does.
a)

We have x‾=366=6\overline{x}=\frac{36}{6}=6 and y‾=3986≈66.333\overline{y}=\frac{398}{6}\approx 66.333. Then Sxx=∑(x−x‾)2=16+4+1+1+4+16=42S_{xx}=\sum(x-\overline{x})^{2}=16+4+1+1+4+16=42, Syy≈573.333S_{yy}\approx 573.333 and Sxy=155S_{xy}=155. The slope is b=15542≈3.6905b=\frac{155}{42}\approx 3.6905 and the y-intercept a=66.333−3.6905×6≈44.1905a=66.333-3.6905\times 6\approx 44.1905. The line is therefore y^≈3.6905x+44.1905\hat{y}\approx 3.6905x+44.1905: each additional hour of study is worth about 3.7 points.

b)

r=SxySxxSyy=15542×573.333≈0.99886r=\frac{S_{xy}}{\sqrt{S_{xx}S_{yy}}}=\frac{155}{\sqrt{42\times 573.333}}\approx 0.99886, so r2≈0.9977r^{2}\approx 0.9977. About 99.8% of the variation in marks is explained by the variation in the number of hours. That is extraordinarily high for human data, and it should raise suspicion: the marks of a real group of students never line up this well, and a fit computed on only six points says nothing about whether the relationship stays linear outside the observed hours, nor whether it would hold up on another group.

c)

Syy−bSxy=573.333−3.6905×155≈1.3095S_{yy}-bS_{xy}=573.333-3.6905\times 155\approx 1.3095, the residual sum of squares. So se=1.30956−2=0.3274≈0.5722s_{e}=\sqrt{\frac{1.3095}{6-2}}=\sqrt{0.3274}\approx 0.5722 point.

d)

The point prediction is y^=3.6905×6+44.1905≈66.333\hat{y}=3.6905\times 6+44.1905\approx 66.333, and since x0=x‾x_{0}=\overline{x} the term (x0−x‾)2(x_{0}-\overline{x})^{2} vanishes. The confidence interval for the mean is y^±t se1n=66.333±2.776×0.5722×0.4082≈66.333±0.648\hat{y}\pm t\,s_{e}\sqrt{\frac{1}{n}}=66.333\pm 2.776\times 0.5722\times 0.4082\approx 66.333\pm 0.648, that is [65.685,66.982][65.685, 66.982]. The prediction interval is y^±t se1+1n=66.333±2.776×0.5722×1.0801≈66.333±1.716\hat{y}\pm t\,s_{e}\sqrt{1+\frac{1}{n}}=66.333\pm 2.776\times 0.5722\times 1.0801\approx 66.333\pm 1.716, that is [64.618,68.049][64.618, 68.049]. The second is almost three times wider because it combines two uncertainties: the one about the position of the line, the only one present in the first, AND the individual spread of students around this line, measured by ses_{e}. That is the 1 under the square root. A mean can be known very precisely while an individual remains impossible to predict.

e)

The model gives y^=3.6905×20+44.1905≈118\hat{y}=3.6905\times 20+44.1905\approx 118, which exceeds the maximum of 100 and therefore makes no sense. Two mistakes add up. First, extrapolation: the data cover the range from 2 to 10 hours, and nothing guarantees that the relationship stays linear beyond it, whereas we would be doubling the observed range. Second, common sense: a mark is bounded, so the relationship must bend and then level off, which a straight line will never do. A regression model is valid only on the domain over which it was fitted, and a coefficient of determination of 99.8% says strictly nothing about what happens outside it.

1234567891011124045505560657075808590mean pointŷ = 44.19 + 3.69xhours of studymark

Exercise 12: Problem: five claims to check

Each of the following five claims is false or misleading. Explain precisely why, backing each answer with a calculation or a counterexample.

  • a) “The correlation coefficient is 0.90.9: so 90% of the variation in yy is explained by xx.”
  • b) “The 95% confidence interval obtained is [12,18][12, 18]: so the true mean has a 95% chance of lying between 12 and 18.”
  • c) “The p-value is 0.030.03: so there is only a 3% chance that the null hypothesis is true.”
  • d) “Our poll covers 1000 people in Quebec and 1000 in Estonia. The Quebec result is less reliable, because Quebec has more inhabitants.”
  • e) “The test does not reject H0H_{0}: so the two treatments are equivalent.”

Type your answers, the page tells you right or wrong 0/8

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) False: r2=0.81r^{2}=0.81, that is 81% and not 90%.
  • b) False: the true mean is a fixed number. It is the procedure that captures the parameter 95 times out of 100.
  • c) False: the p-value is P(data∣H0)P(\text{data}\mid H_{0}), not P(H0∣data)P(H_{0}\mid\text{data}).
  • d) False: the margin is about 3.1 points in both countries, because it depends on nn and not on the population.
  • e) False: not rejecting does not prove equivalence. Say “these data do not allow us to conclude that there is a difference.”
a)

False: it is the coefficient of DETERMINATION that is interpreted as a percentage of variation explained, and it equals r2=0.92=0.81r^{2}=0.9^{2}=0.81, that is 81% and not 90%. The confusion is all the more stubborn as the two numbers are close when rr is high, but it becomes glaring elsewhere: for r=0.5r=0.5, only 25% of the variation is explained, not half.

b)

False as stated. In the classical approach, the true mean is a fixed, unknown number: it is either in the interval or it is not, and there is no probability to assign to it. What is worth 95% is the reliability of the PROCEDURE: if the sampling were repeated a large number of times and such an interval built each time, 95% of them would contain the true mean. The correct wording is about the method, not about the particular interval in front of you.

c)

False, and it is the same inversion of conditional probabilities as in exercise 4. The p-value is the probability of observing data at least as extreme as ours IF H0H_{0} were true, that is P(data ∣ H0)P(\text{data}\ |\ H_{0}). The claim reads it as P(H0 ∣ data)P(H_{0}\ |\ \text{data}), which is an entirely different quantity and which, in the classical framework, does not even make sense since H0H_{0} is not a random variable.

d)

False. The margin of error depends on the size of the SAMPLE, not on that of the population, as long as the sample represents less than 5% of the population, which is very much the case here. With n=1000n=1000 in both countries, the margin is about 1.96×0.51000≈0.031\frac{1.96\times 0.5}{\sqrt{1000}}\approx 0.031, that is about 3.1 points, the same in both. This is exactly the point established in exercise 3.

e)

False, and it is the error with the heaviest consequences in the whole course. Not rejecting H0H_{0} means that the data do not provide sufficient evidence of a difference, which is not evidence that there is no difference. A test can fail to reject simply because it lacks power: in exercise 7, a real misadjustment of 4 grams went unnoticed nearly two times out of ten. To claim equivalence, you need either a specific equivalence test, or at the very least to show that the confidence interval for the difference lies entirely within a zone judged negligible. The correct wording is always: “these data do not allow us to conclude that there is a difference.”

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.

What is it about?
I read every request myself, nobody else sees it. No need to write your name or your school.
When your request is dealt with, you hear about it by email and in your space.

By sending, you agree that I read your request to answer it. It is kept with your account, erased with it, and never published: privacy policy.

© Ahmed Squalli Houssaini. Exercise set published at www.letuteurscientifique.ca/en/exercices/cegep-337-practice-final. Free for personal and classroom use; republishing it elsewhere requires written permission (legal notice).

See also

Looking for a statistics tutor in Montreal?

Get in touch for a first session. We work on complete papers calibrated to the real level of the final exam, and on the write-up, which is worth half the marks in inference.

Site by Studio Squalli