[R] Sample size ANCOVA

Marc Schwartz marc_schwartz at me.com
Wed Jul 14 15:42:51 CEST 2010


On Jul 14, 2010, at 6:13 AM, Karl Knoblick wrote:

> Hallo!
> 
> Does anyone know a possibility to perform a sample size estimation for an 
> ANCOVA? Would be great! 
> 
> 
> Thanks
> Karl


I don't know of a function in R that performs this directly. However, if you Google:

  http://lmgtfy.com/?q=ancova+sample+size

There are various online resources, including the following online calculator:

  http://udel.edu/~mcdonald/statancova.html

This uses the method described in:

Borm, G.F., J. Fransen, and W.A.J.G. Lemmens. 2007. 
A simple sample size formula for analysis of covariance in randomized clinical trials. 
J. Clin. Epidem. 60: 1234-1238.


If you know how to read the page's HTML source code in your browser, you can view the JavaScript for the calculation and replicate it in R.

Using the default example on the page:

Diff in Y Intercepts: 0.2
Within Group SD: 1.23
Within Group r^2: 0.777
Alpha: 0.05
Power = 0.8
Two Sided

Sample size needed in each group: 133


I was able to replicate the results by using:

# See ?power.t.test

> (1 - 0.777) * power.t.test(delta = 0.2, sd = 1.23, power = 0.8)$n
[1] 132.6160


Testing the above with other inputs, I come up with consistent results as compared to the online calculator.

HTH,

Marc Schwartz



More information about the R-help mailing list