[R] (No Subject)

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Sep 30 20:26:19 CEST 2001


"Husam  Alqamy" <alqamy at lycos.com> writes:

> Dear all I am very beginner user of R I want to calculate the power
> of t-test using power.t.test function. It is stated in the manual
> that the argument (n) is the number of observations per group.
> Infact I have a differens number of observations in each group(ie
> n1<>n2) and another thing is SD the pooled standard deviation of the
> observations in the two data sets under investigation.

Power.t.test assumes equal group sizes so you have to look inside of
it to figure out what to change. The actual power calculation is 

        nu <- (n - 1) * tsample
        pt(qt(sig.level/tside, nu, lower = FALSE), nu, ncp =
            sqrt(n/tsample) * 
            delta/sd, lower = FALSE)

where tsample is 2 for a two-sample test. To generalize this to two
unequal samples, nu should be n1+n2-2 and ncp should be
sqrt(1/(1/n1+1/n2)) * delta/sd

Power calculations do not refer to actual sample values, the sd that
enters is in principle known in advance. There's no "right" way to
plug in an estimate. However, it is a basic assumption that the two
groups have the same theoretical standard deviation.
 
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list