# Power analysis for linear regression

Stata’s `power` command performs power and sample-size analysis (PSS). Its features now include PSS for linear regression.

As with all other `power` methods, the new methods allow you to specify multiple values of parameters and to automatically produce tabular and graphical results.

#### Linear regression

Stata’s `power` command provides three new PSS methods for linear regression.

`power oneslope` performs PSS for a slope test in a simple linear regression. It computes one of the sample size, power, or target slope given the other two and other study parameters. See [PSS] power oneslope.

`power rsquared` performs PSS for an R2 test in a multiple linear regression. An R2 test is an F test for the coefficient of determination (R2). The test can be used to test the significance of all the coefficients, or it can be used to test a subset of them. In both cases `power rsquared` computes one of the sample size, power, or target R2 given the other two and other study parameters. See [PSS] power rsquared.

`power` pcorr performs PSS for a partial-correlation test in a multiple linear regression. A partial-correlation test is an F test of the squared partial multiple correlation coefficient. The command computes one of the sample size, power, or target squared partial-correlation coefficient given the other two and other study parameters. See [PSS] power pcorr.

Here, we demonstrate PSS for an R2 test of a subset of coefficients in a multiple linear regression.

Consider a test of the significance of two covariates in a multiple linear regression adjusting for three other covariates. We will call the two covariates the tested covariates and the three others control covariates. The reduced model with the control covariates has an R2 of 0.1, and the full model with all five covariates has an R2 of 0.2. We want to compute the required sample size for the two-sided R2 test to achieve 80% power with a 5% significance level—`power rsquared` defaults.

We need 81 observations.

Suppose that we want to investigate the impact of the effect size on the required sample size. We plot below the sample-size curve as a function of the R2 values of the full model.

As the R2 of the full model increases, the required sample size decreases. When the R2 is closer to 0.2, the curve is steeper.