Calculate sample size for testing mediation effect based on Sobel's test.
ssMediation.Sobel(power,
theta.1a,
lambda.a,
sigma.x,
sigma.m,
sigma.epsilon,
n.lower = 1,
n.upper = 1e+30,
alpha = 0.05,
verbose = TRUE)
power of the test.
regression coefficient for the predictor in the linear regression linking the predictor \(x\) to the mediator \(m\) (\(m_i=\theta_0+\theta_{1a} x_i + e_i, e_i\sim N(0, \sigma^2_e)\)).
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_a m_i+ \lambda_2 x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma^2_{\epsilon})\)).
standard deviation of the predictor.
standard deviation of the mediator.
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_a m_i+ \lambda_2 x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma^2_{\epsilon})\)).
lower bound of the sample size.
upper bound of the sample size.
type I error rate.
logical. TRUE
means printing power; FALSE
means not printing power.
sample size.
results of optimization to find the optimal sample size.
The sample size 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_{1a} x_i + e_i, e_i\sim N(0, \sigma^2_e)$$ $$y_i=\gamma+\lambda_a 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}_{1a}\hat{\lambda_a}}{\hat{\sigma}_{\theta_{1a}\lambda_a}} $$ where \(\hat{\sigma}_{\theta_{1a}\lambda_a}\) is the estimated standard deviation of the estimate \(\hat{\theta}_{1a}\hat{\lambda_a}\) using multivariate delta method: $$\sigma_{\theta_{1a}\lambda_a}=\sqrt{\theta_{1a}^2\sigma_{\lambda_a}^2+\lambda_a^2\sigma_{\theta_{1a}}^2}$$ and \(\sigma_{\theta_{1a}}^2=\sigma_e^2/(n\sigma_x^2)\) is the variance of the estimate \(\hat{\theta}_{1a}\), and \(\sigma_{\lambda_a}^2=\sigma_{\epsilon}^2/(n\sigma_m^2(1-\rho_{mx}^2))\) is the variance of the estimate \(\hat{\lambda_a}\), \(\sigma_m^2\) is the variance of the mediator \(m_i\).
From the linear regression \(m_i=\theta_0+\theta_{1a} 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_{1a}, \lambda_a}\) to $$\sigma_{\theta_{1a}\lambda_a}=\sqrt{\theta_{1a}^2\frac{\sigma_{\epsilon}^2}{n\sigma_m^2(1-\rho_{mx}^2)}+\lambda_a^2\frac{\sigma_{m}^2(1-\rho_{mx}^2)}{n\sigma_x^2}}$$
Sobel, M. E. Asymptotic confidence intervals for indirect effects in structural equation models. Sociological Methodology. 1982;13:290-312.
# NOT RUN {
ssMediation.Sobel(power=0.8, theta.1a=0.1701, lambda.a=0.1998,
sigma.x=0.57, sigma.m=0.61, sigma.epsilon=0.2,
alpha = 0.05, verbose = TRUE)
# }
Run the code above in your browser using DataLab