Power calculation for interaction effect in 2x2 two-way ANOVA given effect sizes.
powerInteract2by2(n, tauBetaSigma, alpha = 0.05, nTests = 1, verbose = FALSE)
integer. Number of subjects per group.
Effect sizes \(\left(\tau\beta\right)_{ij}/\sigma, i=1, \ldots, a, j=1,\ldots, b\), where \(a=b=2\) and \(\sigma\) is
the standard deviation of random error. Rows are for factor 1 and columns are for factor 2. Note that \(\sum_{i=1}^a \left(\tau\beta\right)_{ij} = \sum_{j=1}^b \left(\tau\beta\right)_{ij}=0\). We can get
\(\left(\tau\beta\right)_{11}=\theta\),
\(\left(\tau\beta\right)_{12}=-\theta\),
\(\left(\tau\beta\right)_{21}=-\theta\),
\(\left(\tau\beta\right)_{22}=\theta\). So
tauBetaSigma=
\(\theta/\sigma\)
family-wise type I error rate.
integer. For high-throughput omics study,
we perform two-way ANOVA for each of 'nTests' probes.
We use Bonferroni correction to control for family-wise type I error rate.
That is, for each probe, type I error rate would be alpha/nTests
.
logical. Indicating if intermediate results should be printed out.
A list with 5 elements:
the power of the two-way ANOVA test
the first degree of freedom of the F test statistic (df1=(a-1)(b-1)
)
the second degree of freedom of the F test statistic (df1=a*b(n-1)
)
the rejection region boundary
the non-centrality parameter
We assume the following model: $$y_{ijk}=\mu+\tau_i + \beta_j + \left(\tau\beta\right)_{ij} + \epsilon_{ijk},$$ where \(i=1,\ldots, a, j=1,\ldots, b, k=1, \ldots, n\), \(\sum_{i=1}^{a}\tau_i = 0\), \(\sum_{j=1}^{b}\beta_j = 0\), \(\sum_{i=1}^{a} \left(\tau\beta\right)_{ij} = 0\), \(\sum_{j=1}^{b} \left(\tau\beta\right)_{ij} = 0\), and \(\epsilon_{ijk}\stackrel{i.i.d}{\sim} N\left(0, \sigma^2\right)\).
The group means are $$\mu_{ij} = \mu+\tau_i + \beta_j + \left(\tau\beta\right)_{ij}, i=1 \ldots, a, j=1,\ldots, b.$$ Note that \(\mu = \sum_{i=1}^{a}\sum_{j=1}^b \mu_{ij} / (ab)\), \(\tau_i = \sum_{j=1}^b \mu_{ij}/b - \mu\), and \(\beta_j = \sum_{i=1}^a \mu_{ij}/a - \mu\).
The null hypothesis \(H_0\): all \(\left(\tau\beta\right)_{ij}, i=1, \ldots, a, j=1,\ldots, b\) are equal to zero. The alternative hypothesis \(H_a\): at least one \(\left(\tau\beta\right)_{ij}\) is different from zero.
The F test statistic is $$F=MS_{AB}/MS_{E}\stackrel{H_a}{\sim} F_{(a-1)(b-1), ab(n - 1), ncp},$$
where ncp
is the
non-centrality parameter of the F test statistic:
$$ncp=n\sum_{i=1}^{a}\sum_{j=1}^{b}\left[\frac{\left(\tau\beta\right)_{ij}}{\sigma}\right]^2.$$
For the scenario \(a=b=2\), we have \(\left(\tau\beta\right)_{11}=\theta\), \(\left(\tau\beta\right)_{12}=-\theta\), \(\left(\tau\beta\right)_{21}=-\theta\), \(\left(\tau\beta\right)_{22}=\theta\). Hence, the non-centrality parameter can be simplified to $$ncp=4n\left(\frac{\theta}{\sigma}\right)^2.$$
The power for testing the null hypothesis \(H_0\) versus the alternative hypothesis \(H_a\) is $$power=Pr\left(F > F_0 | H_a\right),$$ where the rejection region boundary \(F_0\) satisfies: $$Pr\left(F > F_0 | H_0\right) = \alpha/nTests.$$
Chow SC, Shao J, and Wang H. Sample size calculations in clinical research. 2nd edition. Chapman & Hall/CRC. 2008
Montgomery DC. Design and Analysis of Experiments. 8th edition. John Wiley & Sons. Inc.
# NOT RUN {
n = 25
tauBetaSigma = 0.3
# power = 0.8437275
res2 = powerInteract2by2(n = n, tauBetaSigma = tauBetaSigma,
alpha = 0.05, nTests = 1, verbose = TRUE)
# }
Run the code above in your browser using DataLab