powerMediation.Sobel {powerMediation} | R Documentation |
Calculate power for testing mediation effect based on Sobel's test.
powerMediation.Sobel(n, theta.1a, lambda.a, sigma.x, sigma.m, rho2.mx, sigma.e, sigma.epsilon, alpha = 0.05, verbose = TRUE)
n |
sample size. |
theta.1a |
regression coefficient for the predictor in the linear regression linking the predictor x to the mediator m (m_i=\theta_0+\theta_1 x_i + e_i, e_i\sim N(0, \sigma^2_e)). |
lambda.a |
regression coefficient for the mediator in the linear regression linking the predictor x and the mediator m to the outcome y (y_i=\gamma+\lambda m_i+ \lambda_2 x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma^2_{\epsilon})). |
sigma.x |
variance of the predictor. |
sigma.m |
variance of the mediator |
rho2.mx |
square of the correlation between the predictor and the mediator. |
sigma.e |
standard deviation of the random error term in the linear regression linking the predictor x to the mediator m (m_i=\theta_0+\theta_1 x_i + e_i, e_i\sim N(0, \sigma^2_e)). |
sigma.epsilon |
standard deviation of the random error term in the linear regression linking the predictor x and the mediator m to the outcome y (y_i=\gamma+\lambda m_i+ \lambda_2 x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma^2_{\epsilon})). |
alpha |
type I error. |
verbose |
logical. TRUE means printing power; FALSE means not printing power.
|
The power is for testing the null hypothesis \theta_1\lambda=0 versus the alternative hypothesis \theta_{1a}\lambda_a\neq 0 for the linear regressions:
m_i=\theta_0+\theta_1 x_i + e_i, e_i\sim N(0, \sigma^2_e)
y_i=\gamma+\lambda m_i+ \lambda_2 x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma^2_{\epsilon})
Test statistic is based on Sobel's (1982) test:
Z=\frac{\hat{\theta}_1\hat{\lambda}}{\hat{\sigma}_{\theta_1\lambda}}
where \hat{\sigma}_{\theta_1\lambda} is the estimated standard deviation of the estimate \hat{\theta}_1\hat{\lambda} using multivariate delta method:
\sigma_{\theta_1\lambda}=\sqrt{\theta_1^2\sigma_{\lambda}^2+\lambda^2\sigma_{\theta_1}^2}
and \hat{\sigma}_{\theta_1}=\sigma_e^2/(n\sigma_x^2) is the estimated standard deviation of the estimate \hat{\theta}_1, and \hat{\sigma}_{\lambda}=\sigma_{\epsilon}^2/(n\sigma_m^2(1-\rho_{mx}^2)) is the estimated standard deviation of the estimate \hat{\lambda}.
power |
power of the test for the parameter \theta_1\lambda |
delta |
\theta_1\lambda/(sd(\hat{\theta}_1)sd(\hat{\lambda})) |
The test is a two-sided test. Code for one-sided tests will be added later.
Weiliang Qiu stwxq@channing.harvard.edu
Sobel, M. E. Asymptotic confidence intervals for indirect effects in structural equation models. Sociological Methodology. 1982;13:290-312.
ssMediation.Sobel
,
testMediation.Sobel
powerMediation.Sobel(n=100, theta.1a=0.1701, lambda.a=0.1998, sigma.x=0.57, sigma.m=0.61, rho2.mx=0.3, sigma.e=0.2, sigma.epsilon=0.2, alpha = 0.05, verbose = TRUE)