Distributions and hypothesis tests: binomial, normal, chi-squared and t
IB Math AI · Statistics and Probability
Binomial
$X\sim B(n,p)$ requires four conditions: a fixed number of trials, two outcomes, constant $p$, and independence. Then $E(X)=np$ and $\text{Var}(X)=np(1-p)$. On the GDC, binompdf gives $P(X=k)$ and binomcdf gives $P(X\le k)$; the distinction between $P(X\ge 5)=1-P(X\le 4)$ and $1-P(X\le 5)$ is a one-character error that changes the answer.
Normal
$X\sim N(\mu,\sigma^{2})$. Note the notation: the second entry is the variance, so $N(340,25^{2})$ has $\sigma=25$. Inverse normal answers "what value has this proportion below it".
The five steps of a test
Every hypothesis test in AI is marked on the same five steps: state $H_{0}$ and $H_{1}$; state the significance level; compute the statistic and the $p$-value on the GDC; compare $p$ with the level; write a conclusion in context.
Chi-squared
For a test of independence on an $r\times c$ table, $\text{df}=(r-1)(c-1)$, and expected values are $\dfrac{\text{row total}\times\text{column total}}{\text{grand total}}$. For goodness of fit, $\text{df}=(\text{number of categories})-1$ minus one further for each parameter estimated from the data. The test is invalid if any expected frequency is below $5$.
The $t$-test
Used to compare means. A two-tailed $p$-value is exactly twice the one-tailed value for the same data, so a result significant at $5\%$ two-tailed is significant at $2.5\%$ one-tailed.
Rejecting $H_{0}$ never proves $H_{1}$; and failing to reject never proves $H_{0}$.
Worked example: a chi-squared test for independence, all five steps
A school surveys $200$ learners about their choice of Mathematics course and gender, obtaining the following table.
| Male | Female | |
|---|---|---|
| Chose AA | $38$ | $22$ |
| Chose AI | $45$ | $35$ |
| Did not choose Math HL | $17$ | $43$ |
Test at the $5\%$ significance level whether the choice of course is independent of gender.
Solution
Step 1: hypotheses.
$H_{0}$: the choice of course is independent of gender. $H_{1}$: the choice of course is not independent of gender.
Step 2: significance level and degrees of freedom. The level is $5\%$; the table is $3\times 2$ so
$$\text{df}=(3-1)(2-1)=2$$Step 3: expected frequencies. The row totals are $60,\ 80,\ 60$; the column totals are both $100$; the grand total is $200$.
| Expected | Male | Female |
|---|---|---|
| AA | $30$ | $30$ |
| AI | $40$ | $40$ |
| Not HL | $30$ | $30$ |
Every expected count is greater than $5$, so the test can be used.
$$\chi^{2}=\frac{(38-30)^{2}}{30}+\frac{(22-30)^{2}}{30}+\frac{(45-40)^{2}}{40}+\frac{(35-40)^{2}}{40}+\frac{(17-30)^{2}}{30}+\frac{(43-30)^{2}}{30}$$$$\chi^{2}=2.133+2.133+0.625+0.625+5.633+5.633=16.78$$Step 4: compare. The critical value at the $5\%$ level with $\text{df}=2$ is $5.991$, and $p=0.000227$.
$$16.78>5.991\quad\text{and}\quad 0.000227<0.05$$Step 5: conclusion tied to the context. Reject $H_{0}$. There is very strong evidence at the $5\%$ level that the choice of Mathematics course is not independent of gender at this school.
More to read from the table, and this is the part problems often ask next: the cells contributing most to $\chi^{2}$ are the row “did not choose Math HL”, with $5.633$ in each column. The number of males in this group is $17$ against an expected $30$, while females are $43$ against an expected $30$. So the difference is concentrated in dropping Math HL altogether, not in choosing AA or AI; the first two rows contribute very little.
A final note: this conclusion is about this school, and it says only that there is an association, not that gender causes the choice.
Worked example: binomial and normal in a quality-control problem
A packaging line produces packs whose mass follows a normal distribution $N(340,\,25^{2})$ grams. A pack is rejected if it weighs more than $375$ g.
(a) Calculate the probability that a pack is rejected. (b) In a carton of $15$ packs, calculate the probability that exactly $5$ packs are rejected, given that the line's actual rejection rate is $0.28$. (c) Find the mass that $5\%$ of the packs exceed.
Solution
(a) Standardize and look up, or use the normal distribution function directly on the calculator:
$$z=\frac{375-340}{25}=1.4\;\Longrightarrow\;P(X>375)=1-0.9192=0.0808$$Note the notation: $N(340,\,25^{2})$ means $\sigma=25$. Anyone who reads $25$ as the variance will take $\sigma=5$, get $z=7$ and a probability almost equal to $0$, an error of thousands of times while the number is still “valid”.
(b) The number of rejected packs in a carton of $15$ is $Y\sim B(15,\,0.28)$:
$$P(Y=5)=\binom{15}{5}(0.28)^{5}(0.72)^{10}=0.193$$The four binomial conditions are met: $15$ packs is a fixed number, each pack is either rejected or not, the rate $0.28$ is constant, and the packs are independent. If the problem said the carton was drawn without replacement from a small batch, the independence condition would fail and the binomial model could no longer be used.
Reasonableness check: the expected value is $np=15(0.28)=4.2$, so $5$ lies right next to the most likely value, and a probability of about $0.19$ is exactly the magnitude to expect.
(c) We need the value $k$ such that $P(X>k)=0.05$, that is, $P(X\lt k)=0.95$. Use the inverse normal function:
$$k=340+25(1.6449)=381.1\ \text{g}$$The trap in this part is entering $0.05$ instead of $0.95$ into the inverse normal function, giving $298.9$ g. Recognize it immediately by common sense: the question says “heavier than”, so the answer must be greater than the mean of $340$ g.