Poisson Lcg Tests
1. **Problem statement:** We have monthly injury data and want to test if it follows a Poisson distribution using chi-square tests at significance level $\alpha=0.05$.
---
**(i) Chi-square test for Poisson distribution (unknown mean):**
2. Calculate sample mean $\bar{x}$:
$$\bar{x} = \frac{0\times35 + 1\times40 + 2\times13 + 3\times6 + 4\times4 + 5\times1 + 6\times1}{100} = \frac{0 + 40 + 26 + 18 + 16 + 5 + 6}{100} = \frac{111}{100} = 1.11$$
3. Compute Poisson probabilities $P(X=k) = \frac{e^{-\lambda} \lambda^k}{k!}$ with $\lambda=1.11$ for $k=0,1,2,3,4,5,6$:
$$P(0) = e^{-1.11} \approx 0.329$$
$$P(1) = 1.11 \times 0.329 = 0.365$$
$$P(2) = \frac{1.11^2}{2} \times 0.329 = 0.202$$
$$P(3) = \frac{1.11^3}{6} \times 0.329 = 0.075$$
$$P(4) = \frac{1.11^4}{24} \times 0.329 = 0.021$$
$$P(5) = \frac{1.11^5}{120} \times 0.329 = 0.005$$
$$P(6) = \frac{1.11^6}{720} \times 0.329 = 0.001$$
4. Expected frequencies $E_k = 100 \times P(k)$:
$$E_0=32.9, E_1=36.5, E_2=20.2, E_3=7.5, E_4=2.1, E_5=0.5, E_6=0.1$$
5. Combine categories with expected frequencies less than 5 for chi-square validity:
Combine $k=4,5,6$:
$$E_{4+} = 2.1 + 0.5 + 0.1 = 2.7$$
Observed $O_{4+} = 4 + 1 + 1 = 6$
6. Chi-square statistic:
$$\chi^2 = \sum \frac{(O_k - E_k)^2}{E_k} = \frac{(35-32.9)^2}{32.9} + \frac{(40-36.5)^2}{36.5} + \frac{(13-20.2)^2}{20.2} + \frac{(6-7.5)^2}{7.5} + \frac{(6-2.7)^2}{2.7}$$
Calculate each term:
$$= \frac{2.1^2}{32.9} + \frac{3.5^2}{36.5} + \frac{7.2^2}{20.2} + \frac{1.5^2}{7.5} + \frac{3.3^2}{2.7}$$
$$= 0.134 + 0.336 + 2.565 + 0.3 + 4.033 = 7.368$$
7. Degrees of freedom $df = \text{number of categories} - 1 - \text{parameters estimated} = 5 - 1 - 1 = 3$
8. Critical value at $\alpha=0.05$ and $df=3$ is approximately 7.815.
9. Since $7.368 < 7.815$, we **fail to reject** the null hypothesis; data fits Poisson distribution.
---
**(ii) Chi-square test for Poisson with mean $\lambda=1.0$:**
10. Calculate Poisson probabilities with $\lambda=1.0$:
$$P(k) = e^{-1} \frac{1^k}{k!}$$
$$P(0)=0.368, P(1)=0.368, P(2)=0.184, P(3)=0.061, P(4)=0.015, P(5)=0.003, P(6)=0.0005$$
11. Expected frequencies:
$$E_0=36.8, E_1=36.8, E_2=18.4, E_3=6.1, E_4=1.5, E_5=0.3, E_6=0.05$$
12. Combine $k=4,5,6$:
$$E_{4+} = 1.5 + 0.3 + 0.05 = 1.85$$
Observed $O_{4+} = 6$$
13. Chi-square statistic:
$$\chi^2 = \frac{(35-36.8)^2}{36.8} + \frac{(40-36.8)^2}{36.8} + \frac{(13-18.4)^2}{18.4} + \frac{(6-6.1)^2}{6.1} + \frac{(6-1.85)^2}{1.85}$$
$$= \frac{1.8^2}{36.8} + \frac{3.2^2}{36.8} + \frac{5.4^2}{18.4} + \frac{0.1^2}{6.1} + \frac{4.15^2}{1.85}$$
$$= 0.088 + 0.278 + 1.584 + 0.002 + 9.301 = 11.253$$
14. Degrees of freedom $df = 5 - 1 = 4$ (no parameters estimated).
15. Critical value at $\alpha=0.05$ and $df=4$ is approximately 9.488.
16. Since $11.253 > 9.488$, we **reject** the null hypothesis; data does not fit Poisson with mean 1.0.
---
**(b) Linear Congruential Generator (LCG):**
17. Given $a=17$, $X_0=5$, $c=9$, $m=40$, generate first 8 values:
$$X_1 = (17 \times 5 + 9) \mod 40 = (85 + 9) \mod 40 = 94 \mod 40 = 14$$
$$X_2 = (17 \times 14 + 9) \mod 40 = (238 + 9) \mod 40 = 247 \mod 40 = 7$$
$$X_3 = (17 \times 7 + 9) \mod 40 = (119 + 9) \mod 40 = 128 \mod 40 = 8$$
$$X_4 = (17 \times 8 + 9) \mod 40 = (136 + 9) \mod 40 = 145 \mod 40 = 25$$
$$X_5 = (17 \times 25 + 9) \mod 40 = (425 + 9) \mod 40 = 434 \mod 40 = 34$$
$$X_6 = (17 \times 34 + 9) \mod 40 = (578 + 9) \mod 40 = 587 \mod 40 = 27$$
$$X_7 = (17 \times 27 + 9) \mod 40 = (459 + 9) \mod 40 = 468 \mod 40 = 28$$
$$X_8 = (17 \times 28 + 9) \mod 40 = (476 + 9) \mod 40 = 485 \mod 40 = 5$$
18. Sequence: $5,14,7,8,25,34,27,28,5...$ repeats at $X_8=5$.
19. Cycle length is 8.
20. Corresponding random numbers $R_i = X_i / 40$:
$$R = 0.35, 0.175, 0.2, 0.625, 0.85, 0.675, 0.7, 0.125$$
---
**(ii) Kolmogorov-Smirnov (K-S) test for uniformity:**
21. Sort $R_i$ ascending:
$$0.125, 0.175, 0.2, 0.35, 0.625, 0.675, 0.7, 0.85$$
22. Compute empirical CDF $F_n(x) = \frac{i}{n}$ for $i$th value, $n=8$.
23. Compute $D^+ = \max \left( \frac{i}{n} - R_i \right)$ and $D^- = \max \left( R_i - \frac{i-1}{n} \right)$:
| $i$ | $R_i$ | $i/n$ | $i/n - R_i$ | $R_i - (i-1)/n$ |
|---|-------|-------|-------------|-----------------|
|1 |0.125 |0.125 |0.000 |0.125 - 0 = 0.125|
|2 |0.175 |0.25 |0.075 |0.175 - 0.125=0.05|
|3 |0.2 |0.375 |0.175 |0.2 - 0.25 = -0.05|
|4 |0.35 |0.5 |0.15 |0.35 - 0.375= -0.025|
|5 |0.625 |0.625 |0.0 |0.625 - 0.5=0.125|
|6 |0.675 |0.75 |0.075 |0.675 - 0.625=0.05|
|7 |0.7 |0.875 |0.175 |0.7 - 0.75 = -0.05|
|8 |0.85 |1.0 |0.15 |0.85 - 0.875= -0.025|
24. $D^+ = \max(i/n - R_i) = 0.175$, $D^- = \max(R_i - (i-1)/n) = 0.125$
25. Test statistic $D = \max(D^+, D^-) = 0.175$
26. Critical value for $\alpha=0.05$ and $n=8$ is approximately $D_{crit} = 1.36/\sqrt{8} = 0.48$
27. Since $0.175 < 0.48$, we **fail to reject** the null hypothesis; the numbers are uniform.
---
**Final answers:**
- (i) Fail to reject Poisson distribution with estimated mean.
- (ii) Reject Poisson distribution with mean 1.0.
- (b)(i) Generated sequence: $5,14,7,8,25,34,27,28$ with cycle length 8.
- (b)(ii) K-S test shows uniformity of generated numbers.