minEffect.VSMc: Minimum detectable slope for mediator in linear regression...

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

View source: R/power_VSMc_linear.R

Description

Calculate minimal detectable slope for mediator given sample size and power in simple linear regression based on Vittinghoff, Sen and McCulloch's (2009) method.

Usage

1
2
3
4
5
6
7
minEffect.VSMc(n, 
               power, 
               sigma.m, 
               sigma.e, 
               corr.xm, 
               alpha = 0.05, 
               verbose = TRUE)

Arguments

n

sample size.

power

power for testing b_2=0 for the linear regression y_i=b0+b1 x_i + b2 m_i + ε_i, ε_i\sim N(0, σ_e^2).

sigma.m

standard deviation of the mediator.

sigma.e

standard deviation of the random error term in the linear regression y_i=b0+b1 x_i + b2 m_i + ε_i, ε_i\sim N(0, σ_e^2).

corr.xm

correlation between the predictor x and the mediator m.

alpha

type I error rate.

verbose

logical. TRUE means printing minimum absolute detectable effect; FALSE means not printing minimum absolute detectable effect.

Details

The test is for testing the null hypothesis b_2=0 versus the alternative hypothesis b_2\neq 0 for the linear regressions:

y_i=b_0+b_1 x_i + b_2 m_i + ε_i, ε_i\sim N(0, σ^2_{e})

Vittinghoff et al. (2009) showed that for the above linear regression, testing the mediation effect is equivalent to testing the null hypothesis H_0: b_2=0 versus the alternative hypothesis H_a: b_2\neq 0, if the correlation corr.xm between the primary predictor and mediator is non-zero.

The full model is

y_i=b_0+b_1 x_i + b_2 m_i + ε_i, ε_i\sim N(0, σ^2_{e}).

The reduced model is

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

Vittinghoff et al. (2009) mentioned that if confounders need to be included in both the full and reduced models, the sample size/power calculation formula could be accommodated by redefining corr.xm as the multiple correlation of the mediator with the confounders as well as the predictor.

Value

b2

minimum absolute detectable effect.

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

Vittinghoff, E. and Sen, S. and McCulloch, C.E.. Sample size calculations for evaluating mediation. Statistics In Medicine. 2009;28:541-557.

See Also

powerMediation.VSMc, ssMediation.VSMc

Examples

1
2
3
4
  # example in section 3 (page 544) of Vittinghoff et al. (2009).
  # minimum effect is =0.1
  minEffect.VSMc(n = 863, power = 0.8, sigma.m = 1, 
    sigma.e = 1, corr.xm = 0.3, alpha = 0.05, verbose = TRUE)

Example output

[1] 0.0999804

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