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

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/powerMediation.R

Description

Calculate sample size for testing slope for simple linear regression.

Usage

1
2
3
4
5
6
7
8
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 λ=0 for the simple linear regression y_i=γ+λ x_i + ε_i, ε_i\sim N(0, σ_{e}^2).

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))

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.

Details

The test 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

n

sample size.

res.uniroot

results of optimization to find the optimal sample size.

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.

See Also

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

Examples

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

Example output

[1] 70.79538

powerMediation documentation built on March 24, 2021, 1:06 a.m.