minEffect.VSMc {powerMediation} | R Documentation |
Calculate minimal detectable slope given sample size and power for simple linear regression.
minEffect.VSMc(n, power, sigma.m, sigma.e, corr.xm, alpha = 0.05, verbose = TRUE)
n |
sample size. |
power |
power for testing b_2=0 for the linear regression y_i=b0+b1 x_i + b2 m_i + \epsilon_i, \epsilon_i\sim N(0, \sigma_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 + \epsilon_i, \epsilon_i\sim N(0, \sigma_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.
|
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 + \epsilon_i, \epsilon_i\sim N(0, \sigma^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.
b2 |
minimum absolute detectable effect. |
res.uniroot |
results of optimization to find the optimal sample size. |
The test is a two-sided test. Code for one-sided tests will be added later.
Weiliang Qiu stwxq@channing.harvard.edu
Vittinghoff, E. and Sen, S. and McCulloch, C.E.. Sample size calculations for evaluating mediation. Statistics In Medicine. 2009;28:541-557.
powerMediation.VSMc
,
ssMediation.VSMc
minEffect.VSMc(n=100, power=0.8, sigma.m=0.1, sigma.e=0.2, corr.xm=0.5, alpha = 0.05, verbose = TRUE)