⇤ ← Revision 1 as of 2008-01-29 16:21:26
Size: 537
Comment:
|
Size: 535
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 23: | Line 23: |
((pow) - (1 - pf(abs(qf(1-alpha,dfgp,n-dfgp-dfc-1)),dfgp, | (pow - (1 - pf(abs(qf(1-alpha,dfgp,n-dfgp-dfc-1)),dfgp, |
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)