Diff for "FAQ/owanovR" - CBU statistics Wiki
location: Diff for "FAQ/owanovR"
Differences between revisions 1 and 2
Revision 1 as of 2008-01-29 16:21:26
Size: 537
Editor: PeterWatson
Comment:
Revision 2 as of 2008-01-29 16:23:13
Size: 535
Editor: PeterWatson
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)

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