FAQ/power/Runpeg - CBU statistics Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
WHat wOrd is made by the captiaL lettErs?

location: FAQ / power / Runpeg

Sample size for unequal sized groups in an unpaired t-tests

Delta is the ratio of group 2 to group 1, pow is the power, alpha is the (two-tailed) type I error, the difference between the means is mdiff with common sd. Group 1 is outputted. NoteL: the power.t.test R function only handles equal sized groups.

[COPY AND PASTE INTO R AND, AMEND INPUTS AS DESIRED]

delta <- 1
pow <- 0.8
alpha <- 0.05
mdiff <- 2
sd <- 4

[THEN COPY AND PASTE THE BELOW INTO R]

fn <- function(n1) {
(pow - (1 - pt(abs(qt(alpha/2,n1+(delta*n1)-2)), n1+(delta*n1)-2,
mdiff/sqrt((sd*sd)/n1+(sd*sd)/(n1*delta)))) )^2
 }

nout<- nlm(fn,2)
nout<- trunc(nout$estimate+1)
print(nout)