ssMediation.Sobel {powerMediation}R Documentation

Sample size for testing mediation effectd (Sobel's test)

Description

Calculate sample size for testing mediation effect based on Sobel's test.

Usage

ssMediation.Sobel(power, theta.1a, lambda.a, sigma.x, sigma.m,
  rho2.mx, sigma.e, sigma.epsilon, n.lower = 1, n.upper = 1e+30, 
  alpha = 0.05, verbose = TRUE)

Arguments

power power of the test.
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})).
n.lower lower bound of the sample size.
n.upper upper bound of the sample size.
alpha type I error rate.
verbose logical. TRUE means printing power; FALSE means not printing power.

Details

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_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}.

Value

n sample size.
res.uniroot results of optimization to find the optimal sample size.

Note

The test is a two-sided test. Code for one-sided tests will be added later.

Author(s)

Weiliang Qiu stwxq@channing.harvard.edu

References

Sobel, M. E. Asymptotic confidence intervals for indirect effects in structural equation models. Sociological Methodology. 1982;13:290-312.

See Also

powerMediation.Sobel, testMediation.Sobel

Examples

 ssMediation.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.e=0.2, sigma.epsilon=0.2, 
   alpha = 0.05, verbose = TRUE)

[Package powerMediation version 0.0.6 Index]