Learn R Programming

powerMediation (version 0.2.4)

ss.SLR: Sample size for testing slope for simple linear regression

Description

Calculate sample size for testing slope for simple linear regression.

Usage

ss.SLR(power, lambda.a, sigma.x, sigma.y, n.lower = 2.01, n.upper = 1e+30, alpha = 0.05, verbose = TRUE)

Arguments

power
power for testing if $\lambda=0$ for the simple linear regression $y_i=\gamma+\lambda x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma_{e}^2).$
lambda.a
regression coefficient in the simple linear regression $y_i=\gamma+\lambda x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma_{e}^2).$
sigma.x
standard deviation of the predictor.
sigma.y
standard deviation of the outcome.
n.lower
lower bound for the sample size.
n.upper
upper bound for the sample size.
alpha
type I error rate.
verbose
logical. TRUE means printing sample size; FALSE means not printing sample size.

Value

n
sample size.
res.uniroot
results of optimization to find the optimal sample size.

Details

The test is for testing the null hypothesis $\lambda=0$ versus the alternative hypothesis $\lambda\neq 0$ for the simple linear regressions: $$y_i=\gamma+\lambda x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma^2_{e})$$

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.

See Also

minEffect.SLR, power.SLR, power.SLR.rho, ss.SLR.rho.

Examples

Run this code
  ss.SLR(power=0.8, lambda.a=0.8, sigma.x=0.2, sigma.y=0.5, 
    alpha = 0.05, verbose = TRUE)

Run the code above in your browser using DataLab