Skip to content

power.t.test formula

7 messages · Usuario R, Peter Dalgaard, Greg Snow +1 more

#
Usuario R wrote:
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. Formulas based on the normal
distribution assumes the variance to be known, which overestimates small n.
#
Peter Dalgaard:
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).
#
Usuario R wrote:
The error message pretty much says it: uniroot is looking for a root
between 2 and 1e7 and complains that the root is not properly bracketed.
 If the root is supposed to be AT 2, then this easily happens due to
rounding issues. (This could have better error trapping, but you're
really not expected to be planning studies with such low n.)
#
Look at the pwr package, it has functions for 2 samples of different sizes.

Hope this helps,
#
Greg Snow:
Great! Thanks.