# power.SLR: Power for testing slope for simple linear regression In powerMediation: Power/Sample Size Calculation for Mediation Analysis

## Description

Calculate power for testing slope for simple linear regression.

## Usage

 ```1 2 3 4 5 6``` ```power.SLR(n, lambda.a, sigma.x, sigma.y, alpha = 0.05, verbose = TRUE) ```

## Arguments

 `n` sample size. `lambda.a` regression coefficient in the simple linear regression y_i=γ+λ x_i + ε_i, ε_i\sim N(0, σ_{e}^2). `sigma.x` standard deviation of the predictor sd(x). `sigma.y` marginal standard deviation of the outcome sd(y). (not the marginal standard deviation sd(y|x)) `alpha` type I error rate. `verbose` logical. `TRUE` means printing power; `FALSE` means not printing power.

## Details

The power is for testing the null hypothesis λ=0 versus the alternative hypothesis λ\neq 0 for the simple linear regressions:

y_i=γ+λ x_i + ε_i, ε_i\sim N(0, σ^2_{e})

## Value

 `power ` power for testing if b_2=0. `delta ` λσ_x√{n}/√{σ_y^2-(λσ_x)^2}. `s` √{σ_y^2-(λσ_x)^2}. `t.cr` Φ^{-1}(1-α/2), where Φ is the cumulative distribution function of the standard normal distribution. `rho` correlation between the predictor x and outcome y =λσ_x/σ_y.

## Note

The test is a two-sided test. For one-sided tests, please double the significance level. For example, you can set `alpha=0.10` to obtain one-sided test at 5% significance level.

## Author(s)

Weiliang Qiu stwxq@channing.harvard.edu

## References

Dupont, W.D. and Plummer, W.D.. Power and Sample Size Calculations for Studies Involving Linear Regression. Controlled Clinical Trials. 1998;19:589-601.

`minEffect.SLR`, `power.SLR.rho`, `ss.SLR.rho`, `ss.SLR`.
 ```1 2``` ``` power.SLR(n=100, lambda.a=0.8, sigma.x=0.2, sigma.y=0.5, alpha = 0.05, verbose = TRUE) ```