Re: [R] (No Subject)

About this list Date view Thread view Subject view Author view Attachment view

From: Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
Date: Mon 01 Oct 2001 - 04:26:19 EST


Message-id: <x2lmiw5yd0.fsf@blueberry.kubism.ku.dk>


"Husam Alqamy" <alqamy@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@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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Thu 17 Jan 2002 - 11:10:07 EST