FAQ/unpinR - CBU statistics Wiki

You can't save spelling words.

Clear message
location: FAQ / unpinR

Equal samples t test for a given power in R

For a two-tailed test with type I error, alp, with inputted mean and average group sd will have power equal to pow.

[TYPE INTO R THE DESIRED INPUTS ALPHA, MEAN, SD AND N USING VALUES IN FORM BELOW].

The R syntax below

pow <- 0.8
beta <- 0.05
mdiff <- 2
sd <- 4

the the below will give the equal samples in nout.

fn <- function(n) {
(pow - (1 - pt(abs(qt(beta/2,(2*n)-2)),(2*n)-2,mdiff/sqrt(2*sd*sd/n))) )^2
 }

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

This can be run in SPSS 16 using R integrator plug-in (see here).

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