ssMediation.Sobel(power,
theta.1a,
lambda.a,
sigma.x,
sigma.m,
rho2.mx,
sigma.epsilon,
n.lower = 1,
n.upper = 1e+30,
alpha = 0.05,
verbose = TRUE)TRUE means printing power; FALSE means not printing power.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 $\sigma_{\theta_1}^2=\sigma_e^2/(n\sigma_x^2)$ is the variance of the estimate $\hat{\theta}_1$, and $\sigma_{\lambda}=\sqrt{\sigma_{\epsilon}^2/(n\sigma_m^2(1-\rho_{mx}^2))}$ is the variance of the estimate $\hat{\lambda}$, $\sigma_m^2$ is the variance of the mediator $m_i$.
From the linear regression $m_i=\theta_0+\theta_1 x_i+e_i$, we have the relationship $\sigma_e^2=\sigma_m^2(1-\rho^2_{mx})$. Hence, we can simply the variance $\sigma_{\theta_1, \lambda}$ to $$\sigma_{\theta_1\lambda}=\sqrt{\theta_1^2\frac{\sigma_{\epsilon}^2}{n\sigma_m^2(1-\rho_{mx}^2)}+\lambda^2\frac{\sigma_{m}^2(1-\rho_{mx}^2)}{n\sigma_x^2}}$$
powerMediation.Sobel,
testMediation.SobelssMediation.Sobel(power=0.8, theta.1a=0.1701, lambda.a=0.1998,
sigma.x=0.57, sigma.m=0.61, rho2.mx=0.3, sigma.epsilon=0.2,
alpha = 0.05, verbose = TRUE)Run the code above in your browser using DataLab