# testMediation.Sobel: P-value and confidence interval for testing mediation effect... In powerMediation: Power/Sample Size Calculation for Mediation Analysis

## Description

Calculate p-value and confidence interval for testing mediation effect based on Sobel's test.

## Usage

 1 2 3 4 5 testMediation.Sobel(theta.1.hat, lambda.hat, sigma.theta1, sigma.lambda, alpha = 0.05) 

## Arguments

 theta.1.hat estimated regression coefficient for the predictor in the linear regression linking the predictor x to the mediator m (m_i=θ_0+θ_1 x_i + e_i, e_i\sim N(0, σ^2_e)). lambda.hat estimated regression coefficient for the mediator in the linear regression linking the predictor x and the mediator m to the outcome y (y_i=γ+λ m_i+ λ_2 x_i + ε_i, ε_i\sim N(0, σ^2_{ε})). sigma.theta1 standard deviation of \hat{θ}_1 in the linear regression linking the predictor x to the mediator m (m_i=θ_0+θ_1 x_i + e_i, e_i\sim N(0, σ^2_e)). sigma.lambda standard deviation of \hat{λ} in the linear regression linking the predictor x and the mediator m to the outcome y (y_i=γ+λ m_i+ λ_2 x_i + ε_i, ε_i\sim N(0, σ^2_{ε})). alpha significance level of a test.

## Details

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

m_i=θ_0+θ_1 x_i + e_i, e_i\sim N(0, σ^2_e)

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

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

Z=\frac{\hat{θ}_1\hat{λ}}{\hat{σ}_{θ_1λ}}

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

σ_{θ_1λ}=√{θ_1^2σ_{λ}^2+λ^2σ_{θ_1}^2}

and \hat{σ}_{θ_1} is the estimated standard deviation of the estimate \hat{θ}_1, and \hat{σ}_{λ} is the estimated standard deviation of the estimate \hat{λ}.

## Value

 pval  p-value for testing the null hypothesis θ_1λ=0 versus the alternative hypothesis θ_{1a}λ_a\neq 0. CI.low  Lower bound of the 100 (1-α)\% confidence interval for the parameter θ_1λ. CI.upp  Upper bound of the 100 (1-α)\% confidence interval for the parameter θ_1λ.

## 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.

powerMediation.Sobel, ssMediation.Sobel

## Examples

 1 2  testMediation.Sobel(theta.1.hat=0.1701, lambda.hat=0.1998, sigma.theta1=0.01, sigma.lambda=0.02, alpha=0.05) 

### Example output

$pval [1] 0$CI.low
[1] 0.02625328

\$CI.upp
[1] 0.04171868


powerMediation documentation built on March 24, 2021, 1:06 a.m.