Use RRStudio to generate an iid sample of size 1000 from the
Use R/RStudio to generate an i.i.d. sample of size 1000 from the binomial distribution with parameters n = 5 and p = 0.4. Record the counts in the categories 0, 1, 2, 3, 4, and 5.
Now fit the binomial model to your sample. That is, pretend you didn
Solution
Let us find pdf for X assuming p =0.4
If chi square test is used for 1000 size df = 999x5
For example if we do a sample and get actuals for 2000 times as
154, 510, 650, 471, 164, 51
Then chi square table will be drawn as follows
As per prob binomial calculations for 2000 will be
df = 5x1
we calculate p value for this
0.3275 =p
At 0.05 p >0.3275
Hence accept null hypothesis
The sample is drawn from population.
This can be extended for 1000 samples with 999x5 df.
| x | 0 | 1 | 2 | 3 | 4 | 5 | Total |
| Prob | 0.0778 | 0.2592 | 0.3456 | 0.2304 | 0.0768 | 0.01024 | 1 |
