Statistical power is the ability of a test to reject \(H_0\) when \(H_1\) is assumed to be true.
Suppose that \((X_1, \dots, X_{10})\) and \((Y_1, \dots, Y_{10})\) are two sets of independent, identically-distributed random variables \[X_i \sim \mathcal{N}(0, 1) \qquad Y_i \sim \mathcal{N}(\delta, 1)\] Choose for instance \(\delta = .3\). The random variable \(P\) is the \(p\) value calculated using Student’s \(t\) test to evaluate whether there’s a significant difference between the set of \(X\)s and the set of \(Y\)s.
Using simulations, calculate the statistical power of Student’s \(t\) test.
Using simulations, show how the statistical power depends on \(n\) the group size, on \(\alpha\) the significance level and \(\delta\) the effect size. (Vary one parameter at a time.)
(Document your work with knitr.)