Diff for "FAQ/power/runpegn" - CBU statistics Wiki
location: Diff for "FAQ/power/runpegn"
Differences between revisions 3 and 4
Revision 3 as of 2008-02-29 10:05:10
Size: 819
Editor: PeterWatson
Comment:
Revision 4 as of 2013-03-08 10:17:56
Size: 819
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

R code Power for unequal groups unpaired t-test

Delta is the ratio of group 2 to group 1, alpha is (two-tailed) type I error, group means, mean1 and mean2, with standard deviations, sd1 and sd2, and n1 is the number in group 1. Power is outputted.

[COPY AND PASTE INTO R]

fn <- function (alpha,delta,mean1,mean2,sd1,sd2,n1) {
mdiff <- mean1 - mean2
sd <- sqrt((n1*sd1*sd1+n1*delta*sd2*sd2)/(n1+delta*n1-2))
pow <- 1 - pt(abs(qt(beta/2, n1+(delta*n1)-2)), n1+(delta*n1)-2,
mdiff/sqrt((sd*sd)/n1+(sd*sd)/(n1*delta)))
cat("Power for (two-tailed) unequal sized groups unpaired t-test =")
print(pow)
 }

[THEN ENTER INPUTS IN FORM BELOW]

delta <- 2
alpha <- 0.05
mean1 <- 2
mean2 <- 0
sd1 <- 4
sd2 <- 5
n1 <- 45

AND RUN

fn(alpha,delta,mean1,mean2,sd1,sd2,n1)

None: FAQ/power/runpegn (last edited 2013-03-08 10:17:56 by localhost)