[R] power.t.test formula

Greg Snow Greg.Snow at imail.org
Fri Apr 24 23:20:17 CEST 2009


Look at the pwr package, it has functions for 2 samples of different sizes.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Karl Ove Hufthammer
> Sent: Friday, April 24, 2009 2:41 AM
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] power.t.test formula
> 
> Peter Dalgaard:
> 
> >> Does anyone of you knows a reference for the formula used in
> power.t.test
> >> function? And also why it uses the Student's distribution instead of
> >> Normal. (I know both of them can be used but don't see whether
> choose one
> >> or the other)
> >
> > It is  a straightforward first-principles calculation. The t
> > distribution calculation is exact for normally distributed data with
> the
> > same unknown variance in both groups.
> 
> I didn’t know about power.t.test. A very nice function, indeed. Is
> there a
> similar function that handles unequal number of observations for each
> group, and unequal variances?
> 
> The help file mislead me into thinking that power.t.test handles
> unequal
> number of observations, and for example  ‘power.t.test(c(10,3),1)’
> *does*
> give some output (and not a warning or error), just not the output I
> was
> expecting.
> 
> (It gives two power values, one for sample of size 10 (for each group)
> and
> one for samples of size 3 (for each group), while I was expecting the
> power
> for a sample size 10 for one group and 3 for the other group).
> 
> --
> Karl Ove Hufthammer
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list