Calculates Sample Size or Power for Simple Linear Regression
sampsi_reg [, null(#) alt(#) n1(#) sd1(#) alpha(#) power(#) solve(string) sx(#) sy(#) varmethod(string) yxcorr(#) onesided } ]
Description
sampsi_reg calculates the power and sample size for a simple linear regression. The theory behind this command is described in Dupont and Plummer (1998) Power and Sample Size Calculations for Studies involving Linear Regression, Controlled Clinical Trials 19:589-601.
The calculations require an estimate of the residual standard error. There are three methods for doing this: enter the estimate directly; enter the standard deviation of the Y's; or enter the correlation between Y and X values.
This command can be combined with samplesize in order to look at multiple calculations and to plot the results.
Updating this command
To obtain the latest version click the following to uninstall the old version ssc uninstall sampsi_reg And click here to install the new version ssc install sampsi_reg
Options
null(#) specifies the "null slope".
alt(#) specifies the "alternative slope".
n1(#) size of sample.
sd1(#) standard deviation of the residuals.
alpha(#) significance level of test; default is a(0.05).
power(#) power of test; default is p(0.9).
solve(string) specifies whether to solve for the sample size or power; default is s(n) solves for n and the only other choice is s(power) solves for power.
sx(#) the standard deviation of the X's.
sy(#) the standard deviation of the Y's.
yxcorr(#) the correlation between Y's and X's.
varmethod(string) specifies the method for calculating the residual standard deviation. varmethod(r) uses the Y-X correlation and varmethod(sdy) uses the standard deviation of the Y's, the default uses a direct estimate of the residual sd sd1(#).
onesided one-sided test; default is two-sided.
Examples
Calculate power for a two-sided test:
sampsi_reg, null(0) alt(0.25) n(100) sx(0.25) yxcorr(0.2) varmethod(r) s(power)
Compute sample size:
sampsi_reg, null(0) alt(0.25) sx(0.25) sy(1) varmethod(r) s(n)
When specifying the variance of the y's you must have a varmethod option WRONG: sampsi_reg, null(0) alt(5) sx(0.5) sy(12.3) CORRECT: sampsi_reg, null(0) alt(5) sx(0.5) sy(12.3) var(sdy)
Author
Adrian Mander, MRC Biostatistics Unit, Cambridge, UK.
Email adrian.mander@mrc-bsu.cam.ac.uk
See Also Related commands:
sampsi, samplesize (if installed), sampclus (if installed), xsampsi (if installed), artmenu (if installed)