FAQ/owanovR - CBU statistics Wiki
location: FAQ / owanovR

One-way AN(C)OVA in R

For type I error, alpha, dfgp-1 groups, with dfc covariates to detect a R-squared of size, rsq, wiuth power, pow requires a total sample size of n.

[COPY AND PASTE INTO R AND ADJUST AS DESIRED]

pow <- 0.9
alpha <- 0.05
dfgp <- 4
dfc <- 1
rsq <- 0.1

[COPY AND PASTE THE BELOW TO OUTPUT N]

n <- 2+dfgp+dfc

fn <- function(n) {
(pow - (1 - pf(abs(qf(1-alpha,dfgp,n-dfgp-dfc-1)),dfgp, 
n-dfgp-dfc-1,ncp=n*rsq/(1-rsq))))
 }

while (fn(n) > 0) n <- n + 1
print(n)

None: FAQ/owanovR (last edited 2013-03-08 10:17:30 by localhost)