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,
                  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 xx to the mediator mm (mi=θ0+θ1axi+ei,eiN(0,σe2)m_i=\theta_0+\theta_{1a} 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 xx and the mediator mm to the outcome yy (yi=γ+λami+λ2xi+ϵi,ϵiN(0,σϵ2)y_i=\gamma+\lambda_a m_i+ \lambda_2 x_i + \epsilon_i, \epsilon_i\sim N(0, \sigma^2_{\epsilon})).

sigma.x

standard deviation of the predictor.

sigma.m

standard deviation of the mediator.

sigma.epsilon

standard deviation of the random error term in the linear regression linking the predictor xx and the mediator mm to the outcome yy (yi=γ+λami+λ2xi+ϵi,ϵiN(0,σϵ2)y_i=\gamma+\lambda_a 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 θ1λ=0\theta_1\lambda=0 versus the alternative hypothesis θ1aλa0\theta_{1a}\lambda_a\neq 0 for the linear regressions:

mi=θ0+θ1axi+ei,eiN(0,σe2)m_i=\theta_0+\theta_{1a} x_i + e_i, e_i\sim N(0, \sigma^2_e)

yi=γ+λami+λ2xi+ϵi,ϵiN(0,σϵ2)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=θ^1aλa^σ^θ1aλaZ=\frac{\hat{\theta}_{1a}\hat{\lambda_a}}{\hat{\sigma}_{\theta_{1a}\lambda_a}}

where σ^θ1aλa\hat{\sigma}_{\theta_{1a}\lambda_a} is the estimated standard deviation of the estimate θ^1aλa^\hat{\theta}_{1a}\hat{\lambda_a} using multivariate delta method:

σθ1aλa=θ1a2σλa2+λa2σθ1a2\sigma_{\theta_{1a}\lambda_a}=\sqrt{\theta_{1a}^2\sigma_{\lambda_a}^2+\lambda_a^2\sigma_{\theta_{1a}}^2}

and σθ1a2=σe2/(nσx2)\sigma_{\theta_{1a}}^2=\sigma_e^2/(n\sigma_x^2) is the variance of the estimate θ^1a\hat{\theta}_{1a}, and σλa2=σϵ2/(nσm2(1ρmx2))\sigma_{\lambda_a}^2=\sigma_{\epsilon}^2/(n\sigma_m^2(1-\rho_{mx}^2)) is the variance of the estimate λa^\hat{\lambda_a}, σm2\sigma_m^2 is the variance of the mediator mim_i.

From the linear regression mi=θ0+θ1axi+eim_i=\theta_0+\theta_{1a} x_i+e_i, we have the relationship σe2=σm2(1ρmx2)\sigma_e^2=\sigma_m^2(1-\rho^2_{mx}). Hence, we can simply the variance σθ1a,λa\sigma_{\theta_{1a}, \lambda_a} to

σθ1aλa=θ1a2σϵ2nσm2(1ρmx2)+λa2σm2(1ρmx2)nσx2\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}}

Value

n

sample size.

res.uniroot

results of optimization to find the optimal sample size.

Note

The test is a two-sided test. For one-sided tests, please double the significance level. For example, you can set alpha=0.10 to obtain one-sided test at 5% significance level.

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

[Package powerMediation version 0.3.4 Index]