It’s possible to automatise this (using a loop, a function or something)? Currently I’m doing all the work “manually” (in other words, step by step), and it’s very annoying for me. I use kstest().
Consider the null hypothesis H0 : X ∼ N(0, 1).
For different values of µ (for instance µ = 0, 0.25, 0.50, 0.75, 1,) and for different values of n (for instance n = 25, 50, 100), do the following steps:
- Generate 1000 samples from N(µ, 1).
- For each sample, test the hypothesis H0 : X ∼ N(0, 1).
- Obtain the frequency of rejections in each case.
- Check that the level is well approximated when the null hypothesis is true
(example, take α = 0.10, 0.05, 0.01).
Thank you so much.
I wrote a function to get the proportion of number for accepting null hypothesis, when you input the $\mu$, n and $\alpha$: