--mediation

Switch

--mediation

Description

Mediation analysis considers three variables, as seen in the following figure: path start (also called the treatment), mediator and outcome.

Argument and Default Value

These variables can be located within a feature or outcome table. There are 4 switches to specify where the features will go within the mediation: --feat_as_path_start, --feat_as_outcome, --feat_as_control, --no_features. Once you specify which variable is in the feature table all other variables will be in the outcome table. There is the option to specify specific features or consider the entire feature table. For example, if your outcome variable is a feature you can run either of the following two commands:

Details

Mediation analysis considers three variables, as seen in the following figure: path start (also called the treatment), mediator and outcome.

These variables can be located within a feature or outcome table. There are 4 switches to specify where the features will go within the mediation: --feat_as_path_start, --feat_as_outcome, --feat_as_control, --no_features. Once you specify which variable is in the feature table all other variables will be in the outcome table. There is the option to specify specific features or consider the entire feature table. For example, if your outcome variable is a feature you can run either of the following two commands:
# Specify feature 1200 as the outcome ./fwInterface.py -d twitterGH -t messages_en -c cty_id -f 'feat$cat_met_a30_2000_cp_w$messages_en$cty_id$16to16' --mediation fwflag_path_start 'hsgradHC03_VC93ACS3yr$10' --mediators 'ucd_I25_1_atheroHD$0910_ageadj' --outcome_table nejm_intersect_small50k --outcomes '1200' --feat_as_outcome # Consider all features as outcomes ./fwInterface.py -d twitterGH -t messages_en -c cty_id -f 'feat$cat_met_a30_2000_cp_w$messages_en$cty_id$16to16' --mediation fwflag_path_start 'hsgradHC03_VC93ACS3yr$10' --mediators 'ucd_I25_1_atheroHD$0910_ageadj' --outcome_table nejm_intersect_small50k --feat_as_outcome The analysis is done using two methods. The first is the Baron and Kenny method with a Sobel test for significance. We first do three regressions (all of which are normalized):

Regress the outcome with the path start:

Regress the mediator with the path start:

Regress the outcome with the path start and the mediator:

We then check if , and are significant and that is smaller in absolute value than . The Sobel test score is calculated as

where and are the standard error of , , respectively.

The second analysis outputs the following varirables:
ACME (control) = Average Causal Mediation Effect with controls ACME (treated) = Average Causal Mediation Effect without controls ADE (control) = Average Direct Effect with controls ADE (treated) = Average Direct Effect without controls

When no controls are given then ACME (control) = ACME (treated) and ADE (control) = ADE (treated). In the case of linear models with no interactions involving the mediator, the results should be similar or identical to the earlier Barron:doc:fwflag_Kenny approach.

Other Switches

Required Switches: -d, -c, -t -f FEATURE_TABLE_NAME (note: this becomes optional if --no_features is used) --path_starts PATH_START_1 ... PATH_START_I --mediators MEDIATOR_1 ... MEDIATOR_J --outcomes OUTCOME_1 ... OUTCOME_K --outcome_table OUTCOME_TABLE_NAME Optional Switches: fwflag_controls CONTROL_1 ... CONTROL_L --group_freq_thresh GROUP_THRESH --feat_as_path_start or --feat_as_outcome or --feat_as_control or --no_features --p_value --mediation_boot --mediation_boot_num --output_name OUTPUT_FILE_NAME --mediation_no_summary --mediation_csv --mediation_method fwflag_no_bonferroni --p_correction Example Commands ================ .. code:doc:fwflag_block:: python

# Example # Since no mediators are given, this will consider every feature in the feature table as a mediator ./fwInterface.py -d twitterGH -t messages_en -c cty_id -f 'feat$cat_met_a30_2000_cp_w$messages_en$cty_id$16to16' --mediation fwflag_path_start 'hsgradHC03_VC93ACS3yr$10' --outcomes 'ucd_I25_1_atheroHD$0910_ageadj' --outcome_table nejm_intersect_small50k --mediation_csv --group_freq_thresh 40000 --output_name mediation_40k.csv --mediation_boot Part of Output: Mediation number 2000 out of 2000 Path Start: hsgradHC03_VC93ACS3yr$10, Mediator: 1051, Outcome: ucd_I25_1_atheroHD$0910_ageadj C: fwflag_0.134772542078, C_p: 6.8251850716e:doc:fwflag_07, C': fwflag_0.163575622445, C'_p: 2.05569898945e:doc:fwflag_08 C:doc:fwflag_C': 0.0288030803674, alpha*beta: 0.0288030803674 alpha: fwflag_0.36936035776, alpha_error: 0.0253295211266, alpha_p: 7.8905979142e:doc:fwflag_45 beta: fwflag_0.0779809737625, beta_error: 0.0289964186593, beta_p: 0.00724804697931 Sobel z:doc:fwflag_score: 2.64473000024, Sobel SE: 0.0108907451289, Sobel p: 0.00817561235516

Estimate P:doc:fwflag_value Lower CI bound Upper CI bound

Prop. mediated (average) fwflag_0.2121596 0.004 fwflag_0.4912299 fwflag_0.06154572 ACME (average) 0.02911135 0.004 0.008990151 0.0541393 ADE (average) fwflag_0.1630937 0 fwflag_0.2160734 fwflag_0.1054184 ACME (treated) 0.02911135 0.004 0.008990151 0.0541393 ACME (control) 0.02911135 0.004 0.008990151 0.0541393 ADE (treated) fwflag_0.1630937 0 fwflag_0.2160734 fwflag_0.1054184 ADE (control) fwflag_0.1630937 0 fwflag_0.2160734 fwflag_0.1054184 Total effect fwflag_0.1339823 0 fwflag_0.1848832 fwflag_0.0804331 Prop. mediated (treated) fwflag_0.2121596 0.004 fwflag_0.4912299 fwflag_0.06154572 Prop. mediated (control) fwflag_0.2121596 0.004 fwflag_0.4912299 fwflag_0.06154572