Statistical Tests Examples 59874B
1. **T-test for Single Sample Mean**
Problem: Test if the mean of a sample $\bar{x} = 105$ differs from hypothesized mean $\mu = 100$ with $s = 15$, $n = 25$, $\alpha = 0.05$, two-tailed.
Formula: $$t = \frac{|\bar{x} - \mu|}{s / \sqrt{n}}$$
Steps:
1. Calculate degrees of freedom: $df = n - 1 = 24$
2. Find critical value $t_{crit} = t_{0.025,24} \approx 2.064$
3. Calculate $t$-statistic: $$t = \frac{|105 - 100|}{15 / \sqrt{25}} = \frac{5}{3} = 1.667$$
4. Compare $t$ with $t_{crit}$: $1.667 < 2.064$, fail to reject $H_0$.
2. **T-test for Two Independent Samples**
Problem: Compare means $\bar{x}_1=50$, $\bar{x}_2=45$, $s_1=8$, $s_2=10$, $n_1=20$, $n_2=22$, $\alpha=0.05$, two-tailed.
Formula: $$t = \frac{|\bar{x}_1 - \bar{x}_2|}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}$$
Steps:
1. Degrees of freedom: $df = n_1 + n_2 - 2 = 40$
2. Critical value $t_{crit} = t_{0.025,40} \approx 2.021$
3. Calculate $t$: $$t = \frac{|50 - 45|}{\sqrt{\frac{64}{20} + \frac{100}{22}}} = \frac{5}{\sqrt{3.2 + 4.545}} = \frac{5}{2.83} = 1.767$$
4. Compare: $1.767 < 2.021$, fail to reject $H_0$.
3. **Paired T-test**
Problem: Differences $d_i$ have mean $\bar{d} = 2$, $s_d = 4$, $n=15$, $\alpha=0.05$, two-tailed.
Formula: $$t = \frac{|\bar{d}|}{s_d / \sqrt{n}}$$
Steps:
1. Degrees of freedom: $df = 14$
2. Critical value $t_{crit} = t_{0.025,14} \approx 2.145$
3. Calculate $t$: $$t = \frac{2}{4 / \sqrt{15}} = \frac{2}{1.033} = 1.935$$
4. Compare: $1.935 < 2.145$, fail to reject $H_0$.
4. **Chi-Square Goodness-of-Fit Test**
Problem: Observed $O = [30, 50, 20]$, expected $E = [33, 47, 20]$, $\alpha=0.05$, $k=3$.
Formula: $$X^2 = \sum \frac{(O_i - E_i)^2}{E_i}$$
Steps:
1. Degrees of freedom: $df = k - 1 = 2$
2. Critical value $X^2_{crit} = 5.991$
3. Calculate $X^2$: $$\frac{(30-33)^2}{33} + \frac{(50-47)^2}{47} + \frac{(20-20)^2}{20} = \frac{9}{33} + \frac{9}{47} + 0 = 0.273 + 0.191 = 0.464$$
4. Compare: $0.464 < 5.991$, fail to reject $H_0$.
5. **Chi-Square Test of Independence**
Problem: 2x2 table observed $O = \begin{bmatrix} 20 & 30 \\ 25 & 25 \end{bmatrix}$, $\alpha=0.05$.
Formula: $$X^2 = \sum \frac{(O_{ij} - E_{ij})^2}{E_{ij}}$$
Steps:
1. Calculate row sums: $50, 50$; column sums: $45, 55$; total $N=100$
2. Expected $E_{11} = \frac{50 \times 45}{100} = 22.5$, similarly $E_{12}=27.5$, $E_{21}=22.5$, $E_{22}=27.5$
3. Calculate $X^2$: $$\frac{(20-22.5)^2}{22.5} + \frac{(30-27.5)^2}{27.5} + \frac{(25-22.5)^2}{22.5} + \frac{(25-27.5)^2}{27.5} = 0.278 + 0.227 + 0.278 + 0.227 = 1.01$$
4. Degrees of freedom: $(2-1)(2-1)=1$, critical value $3.841$
5. Compare: $1.01 < 3.841$, fail to reject $H_0$.
6. **Analysis of Variance (ANOVA)**
Problem: Three groups with means $\bar{x}_1=10$, $\bar{x}_2=12$, $\bar{x}_3=15$, sizes $n_1=5$, $n_2=5$, $n_3=5$, total $N=15$, $\alpha=0.05$.
Steps:
1. Grand mean: $$\bar{x} = \frac{5\times10 + 5\times12 + 5\times15}{15} = \frac{185}{15} = 12.33$$
2. SSB: $$5(10-12.33)^2 + 5(12-12.33)^2 + 5(15-12.33)^2 = 5(5.44) + 5(0.11) + 5(7.11) = 27.22 + 0.56 + 35.56 = 63.34$$
3. Assume SSW = 40 (given or calculated from data)
4. Degrees freedom: $ndf = 3-1=2$, $ddf=15-3=12$
5. MSB = $63.34/2=31.67$, MSW = $40/12=3.33$
6. F-statistic: $$F = \frac{31.67}{3.33} = 9.51$$
7. Critical value $F_{crit} = F_{0.05,2,12} \approx 3.89$
8. Compare: $9.51 > 3.89$, reject $H_0$.
7. **Pearson’s R and Simple Linear Regression**
Problem: $n=5$, $\sum x=15$, $\sum y=20$, $\sum xy=70$, $\sum x^2=55$, $\sum y^2=90$, $\alpha=0.05$.
Formula for $r$:
$$r = \frac{n\sum xy - \sum x \sum y}{\sqrt{(n\sum x^2 - (\sum x)^2)(n\sum y^2 - (\sum y)^2)}}$$
Steps:
1. Calculate numerator: $5 \times 70 - 15 \times 20 = 350 - 300 = 50$
2. Calculate denominator: $$\sqrt{(5 \times 55 - 15^2)(5 \times 90 - 20^2)} = \sqrt{(275 - 225)(450 - 400)} = \sqrt{50 \times 50} = 50$$
3. Calculate $r = 50/50 = 1$
4. Degrees freedom: $df = n - 2 = 3$
5. Critical $t_{crit} = t_{0.025,3} \approx 3.182$
6. Calculate $t$-statistic: $$t = \frac{r}{\sqrt{(1-r^2)/(n-2)}} = \frac{1}{\sqrt{0/3}} = \infty$$
7. Since $t$ is infinite, reject $H_0$; perfect positive correlation.