# 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  0$CI.low
 0.02625328

\$CI.upp
 0.04171868


powerMediation documentation built on March 24, 2021, 1:06 a.m.
{"ft_lang_label":"__label__en","ft_lang_prob":0.5633345,"math_prob":0.98681605,"size":2672,"snap":"2022-40-2023-06","text_gpt3_token_len":896,"char_repetition_ratio":0.115442276,"word_repetition_ratio":0.3315508,"special_character_ratio":0.31961077,"punctuation_ratio":0.1507799,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9996948,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-01-31T21:26:01Z\",\"WARC-Record-ID\":\"<urn:uuid:7fa6c9b9-e5b3-4e95-ac05-17c85924336e>\",\"Content-Length\":\"44551\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6a601c27-97eb-4200-bef7-d5a2bdb5766e>\",\"WARC-Concurrent-To\":\"<urn:uuid:cf07f2ff-ed34-4bb1-9e77-41c5e2861a11>\",\"WARC-IP-Address\":\"51.81.83.12\",\"WARC-Target-URI\":\"https://rdrr.io/cran/powerMediation/man/testMediation.Sobel.html\",\"WARC-Payload-Digest\":\"sha1:BZPNR67I6ZTVC5D6NQ3A45XHXDIOJT77\",\"WARC-Block-Digest\":\"sha1:ULI4IPTXKQC22GGIMUAR2UHDK5VRYQ2C\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499890.39_warc_CC-MAIN-20230131190543-20230131220543-00863.warc.gz\"}"}