If we are trying to find the power of a paired t-test, SAS offers this template (among others) in PROC POWER:

   proc power;
      pairedmeans test=diff
         meandiff = 7
         corr = 0.4
         stddev = 12
         npairs = 50
         power = .;

R, on the other hand, has this:

pwr.t.test(n = NULL, d = NULL, sig.level = 0.05, power = NULL, 
    type = c("two.sample", "one.sample", "paired"),
    alternative = c("two.sided", "less", "greater"))

where there is no way to specify the correlation. But the correlation makes a huge difference to the results. d (the effect size) is Cohen's d (difference in the means divided by pooled standard deviation).

Is this an error in the R program (that seems very unlikely) or have I missed something (far more likely) and, if I have missed something, what is it I have missed?

  • 1
    $\begingroup$ I presume you're using the function from the R package pwr. See the second example in the help of pwr.t.test (that sqrt(1-0.6) in the calculation of d is where the correlation comes in; the correlation in that example was 0.6). Compare against Cohen (1988) Statistical power analysis for the behavioral sciences (2ed.) as indicated in the help. $\endgroup$ – Glen_b Mar 4 at 4:53
  • $\begingroup$ Ah. Now I see. Thanks. I still think the SAS method is easier to use, but at least I realize that R is also correct (which I was pretty sure of, anyway). $\endgroup$ – Peter Flom Mar 4 at 11:15

The formula for the pooled standard deviation accounts for the covariance between time point 1 and time point 2. R requires Cohen's d, which makes use of the difference between the two means and the pooled standard deviation. R, perhaps, directly makes use of Cohen's d to calculate power. In SAS you can specify the correlation separately, but if you change your correlation, your SD will also change.

  • $\begingroup$ I am sure you are right, but I don't quite see it. The pooled sd includes the sample sizes of each sample and the variance of each sample. Where does the correlation come in? $\endgroup$ – Peter Flom Mar 3 at 20:16
  • 1
    $\begingroup$ If X1 and X2 are not independent, then Var(X1-X2) = Var(X1) + Var(X2) - 2 COV(X1, X2). COV(X1, X2) = SD(X1) SD(X2) COR(X1, X2). That's my understanding of it. I could be wrong. $\endgroup$ – NB21 Mar 7 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.