*! version 1.0 14 Mar 2019

Title

sampsi_reg -- Calculates Sample Size or Power for Simple Linear Regression

Syntax

sampsi_reg
[varlist]
[,
options]

Main
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.

power(#) power of test.

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.

onesided one-sided test; default is two-sided.

sx(#) the standard deviation of the X's.

sy(#) the standard deviation of the Y'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(#).

yxcorr(#) the correlation between Y's and X's.

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.

Options

Main

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.

power(#) power of test.

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.

onesided one-sided test; default is two-sided.

sx(#) the standard deviation of the X's.

sy(#) the standard deviation of the Y'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(#).

yxcorr(#) the correlation between Y's and X's.

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)

Stored results

Locals

r(power) the power

r(N_1) the first arm sample size

r(N_2) the second arm sample size

Author

Dr Adrian Mander, MRC Biostatistics Unit, University of Cambridge.

Email adrian.mander@mrc-bsu.cam.ac.uk

See Also

Related commands:

samplesize (if installed)ssc install samplesize (to install this command)
sampsi_fleming (if installed) ssc install sampsi_fleming (to install this command)
simon2stage (if installed) ssc install simon2stage (to install this command)