Computing power for one-way ANOVA in R
For type I error, alpha, regression degrees of freedom (= k-1 for k groups) and dfc covariates with a total sample size, ntot, a test to detect a R-squared of rsq has power, pow.
[COPY AND PASTE THE BELOW INTO R, ADJUST AS DESIRED]
alpha <- 0.05 dfreg <- 2 dfc <- 1 ntot <- 23 rsq <- 0.2
[COPY AND PASTE THE BELOW INTO R]
pow <- 1 - pf(abs(qf(1-alpha,dfreg,ntot-dfreg-dfc-1)),dfreg,ntot-dfreg-dfc-1, ntot*rsq/(1-rsq)) print(pow)