# powerMediation.Sobel: Power for testing mediation effect (Sobel's test) In powerMediation: Power/Sample Size Calculation for Mediation Analysis

## Description

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

## Usage

 1 2 3 4 5 6 7 8 powerMediation.Sobel(n, theta.1a, lambda.a, sigma.x, sigma.m, sigma.epsilon, alpha = 0.05, verbose = TRUE) 

## Arguments

 n sample size. theta.1a regression coefficient for the predictor in the linear regression linking the predictor x to the mediator m (m_i=θ_0+θ_{1a} x_i + e_i, e_i\sim N(0, σ^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=γ+λ_{a} m_i+ λ_2 x_i + ε_i, ε_i\sim N(0, σ^2_{ε})). 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 x and the mediator m to the outcome y (y_i=γ+λ_a m_i+ λ_2 x_i + ε_i, ε_i\sim N(0, σ^2_{ε})). alpha type I error. verbose logical. TRUE means printing power; FALSE means not printing power.

## Details

The power is for testing the null hypothesis θ_1λ=0 versus the alternative hypothesis θ_{1a}λ_a\neq 0 for the linear regressions:

m_i=θ_0+θ_{1a} x_i + e_i, e_i\sim N(0, σ^2_e)

y_i=γ+λ_a m_i+ λ_2 x_i + ε_i, ε_i\sim N(0, σ^2_{ε})

Test statistic is based on Sobel's (1982) test:

Z=\frac{\hat{θ}_{1a}\hat{λ_a}}{\hat{σ}_{θ_{1a}λ_a}}

where \hat{σ}_{θ_{1a}λ_a} is the estimated standard deviation of the estimate \hat{θ}_{1a}\hat{λ_a} using multivariate delta method:

σ_{θ_{1a}λ_a}=√{θ_{1a}^2σ_{λ_a}^2+λ_a^2σ_{θ_{1a}}^2}

and σ_{θ_{1a}}^2=σ_e^2/(nσ_x^2) is the variance of the estimate \hat{θ}_{1a}, and σ_{λ_a}^2=σ_{ε}^2/(nσ_m^2(1-ρ_{mx}^2)) is the variance of the estimate \hat{λ_a}, σ_m^2 is the variance of the mediator m_i.

From the linear regression m_i=θ_0+θ_{1a} x_i+e_i, we have the relationship σ_e^2=σ_m^2(1-ρ^2_{mx}). Hence, we can simply the variance σ_{θ_{1a}, λ_a} to

σ_{θ_{1a}λ_a}=√{θ_{1a}^2\frac{σ_{ε}^2}{nσ_m^2(1-ρ_{mx}^2)}+λ_a^2\frac{σ_{m}^2(1-ρ_{mx}^2)}{nσ_x^2}}

## Value

 power  power of the test for the parameter θ_{1a}λ_a delta  θ_1λ/(sd(\hat{θ}_{1a})sd(\hat{λ}_a))

## 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 [email protected]

## References

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

ssMediation.Sobel, testMediation.Sobel

## Examples

 1 2 3  powerMediation.Sobel(n=248, 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) 

### Example output

[1] 0.6876486


powerMediation documentation built on Feb. 9, 2018, 6:10 a.m.