When you're only interested in the sample size to have enough power for
your z coefficient, you could use power.t.test() to calculate the sample
size. If every x is measured at z0 and z1, the power of a paired t-test
will be the same as the power for the z coefficient in the linear
regression. When measuring at more than two points along z (again each x
measured at each z), using power.t.test() will underestimate the power.
This underestimation will be rather small, when the number of different
points along z is small.
The big advantage of power.t.test() is that it's fast to calculate and
gives a conservative estimate of the required sample size. In the worst
case your sample size will be larger than needed.
I'm afraid you'll need simulations if you want a more accurate
estimation of the sample size.
Cheers,
Thierry
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be
Do not put your faith in what statistics say until you have carefully
considered what they do not say. ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney
-----Oorspronkelijk bericht-----
Van: r-help-bounces op stat.math.ethz.ch
[mailto:r-help-bounces op stat.math.ethz.ch] Namens John Sorkin
Verzonden: dinsdag 21 november 2006 2:13
Aan: r-help op stat.math.ethz.ch
Onderwerp: [R] sample size for linear regression
Is there an R function that can be used to calculate a sample size for a
linear regression:
i.e.
Given a linear regression:
y=f(x,z)
i.e. fit1<-lm(y~x+z)
is there a function which can be passed coef(z), SE(z), and other
parameters to determine a sample size based on z, SEz and other
information from the regression?
Thanks,
John
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC,
University of Maryland School of Medicine Claude D. Pepper OAIC,
University of Maryland Clinical Nutrition Research Unit, and
Baltimore VA Center Stroke of Excellence
University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
jsorkin op grecc.umaryland.edu
Confidentiality Statement:
This email message, including any attachments, is for the\ s...{{dropped}}