(View the complete code for this example.)
This example continues the analysis of Example 38.1; it illustrates the use of the EVALUATE statement for computing controlled direct effects and mediation effects conditional on covariate values.
The following code includes three EVALUATE statements that assign different values for the mediator Motivation:
proc causalmed data=Cognitive;
model CogPerform = Encourage | Motivation;
mediator Motivation = Encourage;
covar FamSize SocStatus;
evaluate 'Default Mean Value of Mediator' Motivation=mean;
evaluate 'High-Motivation Group' Motivation = 1(SD);
evaluate 'Low-Motivation Group' Motivation = -1(SD);
run;
The labels, which are enclosed in quotation marks, distinguish the three EVALUATE statements and the output that they produce. The first EVALUATE statement specifies the level of the mediator Motivation as its mean. This happens to be the default level, so you should expect this statement to produce the same evaluation of causal effects that PROC CAUSALMED produces by default. Output 38.2.1 displays the causal mediation effects that are evaluated by default, and Output 38.2.2 displays the causal mediation effects that are evaluated for the mediator level in the first EVALUATE statement. Clearly, these two tables are identical.
Output 38.2.1: Summary of Effects (Default)
| Summary of Effects | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.8421 | 0.1430 | 6.5618 | 7.1224 | 47.84 | <.0001 |
| Controlled Direct Effect (CDE) | 4.1797 | 0.04696 | 4.0876 | 4.2717 | 89.00 | <.0001 |
| Natural Direct Effect (NDE) | 4.1509 | 0.04706 | 4.0587 | 4.2432 | 88.21 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.3325 | 1.3704 | 36.6465 | 42.0184 | 28.70 | <.0001 |
| Percentage Due to Interaction | 0.4197 | 0.02367 | 0.3733 | 0.4661 | 17.73 | <.0001 |
| Percentage Eliminated | 38.9128 | 1.3574 | 36.2524 | 41.5733 | 28.67 | <.0001 |
Output 38.2.2: Replicating the Default Summary of Effects
| Summary of Effects: Default Mean Value of Mediator | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.8421 | 0.1430 | 6.5618 | 7.1224 | 47.84 | <.0001 |
| Controlled Direct Effect (CDE) | 4.1797 | 0.04696 | 4.0876 | 4.2717 | 89.00 | <.0001 |
| Natural Direct Effect (NDE) | 4.1509 | 0.04706 | 4.0587 | 4.2432 | 88.21 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.3325 | 1.3704 | 36.6465 | 42.0184 | 28.70 | <.0001 |
| Percentage Due to Interaction | 0.4197 | 0.02367 | 0.3733 | 0.4661 | 17.73 | <.0001 |
| Percentage Eliminated | 38.9128 | 1.3574 | 36.2524 | 41.5733 | 28.67 | <.0001 |
There might be situations in which you want to evaluate the causal effects at other mediator levels. The second and third EVALUATE statements set the mediator level at one standard deviation above and below the mean, respectively. PROC CAUSALMED computes the sample mean and standard deviation (SD) for Motivation and then computes the levels of motivation as
These values of are then used to evaluate the various causal mediation effects, which are displayed in Output 38.2.3 and Output 38.2.4.
Output 38.2.3: Evaluation of Effects for the High-Motivation Group
| Summary of Effects: High-Motivation Group | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.8421 | 0.1430 | 6.5618 | 7.1224 | 47.84 | <.0001 |
| Controlled Direct Effect (CDE) | 4.3403 | 0.04687 | 4.2484 | 4.4321 | 92.60 | <.0001 |
| Natural Direct Effect (NDE) | 4.1509 | 0.04706 | 4.0587 | 4.2432 | 88.21 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.3325 | 1.3704 | 36.6465 | 42.0184 | 28.70 | <.0001 |
| Percentage Due to Interaction | -1.9278 | 0.08279 | -2.0901 | -1.7656 | -23.29 | <.0001 |
| Percentage Eliminated | 36.5653 | 1.3995 | 33.8224 | 39.3082 | 26.13 | <.0001 |
Output 38.2.4: Evaluation of Effects for the Low-Motivation Group
| Summary of Effects: Low-Motivation Group | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.8421 | 0.1430 | 6.5618 | 7.1224 | 47.84 | <.0001 |
| Controlled Direct Effect (CDE) | 4.0190 | 0.04746 | 3.9260 | 4.1121 | 84.68 | <.0001 |
| Natural Direct Effect (NDE) | 4.1509 | 0.04706 | 4.0587 | 4.2432 | 88.21 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.3325 | 1.3704 | 36.6465 | 42.0184 | 28.70 | <.0001 |
| Percentage Due to Interaction | 2.7671 | 0.08527 | 2.6000 | 2.9343 | 32.45 | <.0001 |
| Percentage Eliminated | 41.2603 | 1.3189 | 38.6753 | 43.8454 | 31.28 | <.0001 |
Output 38.2.3 and Output 38.2.4 show that the total effect remains the same in the two evaluations, as expected. Because the controlled direct effect is defined at a particular level of the mediator level (), it is not surprising that the two evaluations lead to different estimates of the controlled direct effect.
At one standard deviation above the mean of Motivation, the controlled direct effect is 4.34. This is higher than the controlled direct effect at one standard deviation below the mean, which is 4.02. The percentages of the total effect that are due to interaction also differ for the two levels of Motivation. One percentage is –2% and the other is 3%, although both are small and negligible.
You can also use the EVALUATE statement to evaluate causal mediation effects for particular target groups. The following EVALUATE statements estimate causal mediation effects for small families (FamSize=3) and large families (FamSize=7):
proc causalmed data=Cognitive;
model CogPerform = Encourage | Motivation;
mediator Motivation = Encourage;
covar FamSize SocStatus;
evaluate 'Small Families' FamSize=3;
evaluate 'Large Families' FamSize=7;
run;
Output 38.2.5 and Output 38.2.6 display the corresponding effect summaries.
Output 38.2.5: Mediation Effects Conditional on Small Families
| Summary of Effects: Small Families | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.8495 | 0.1423 | 6.5705 | 7.1285 | 48.12 | <.0001 |
| Controlled Direct Effect (CDE) | 4.1797 | 0.04696 | 4.0876 | 4.2717 | 89.00 | <.0001 |
| Natural Direct Effect (NDE) | 4.1584 | 0.04707 | 4.0661 | 4.2506 | 88.34 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.2900 | 1.3732 | 36.5985 | 41.9815 | 28.61 | <.0001 |
| Percentage Due to Interaction | 0.5273 | 0.02278 | 0.4826 | 0.5719 | 23.15 | <.0001 |
| Percentage Eliminated | 38.9788 | 1.3492 | 36.3344 | 41.6233 | 28.89 | <.0001 |
Output 38.2.6: Mediation Effects Conditional on Large Families
| Summary of Effects: Large Families | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.8127 | 0.1457 | 6.5271 | 7.0982 | 46.77 | <.0001 |
| Controlled Direct Effect (CDE) | 4.1797 | 0.04696 | 4.0876 | 4.2717 | 89.00 | <.0001 |
| Natural Direct Effect (NDE) | 4.1215 | 0.04717 | 4.0290 | 4.2140 | 87.37 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.5025 | 1.3590 | 36.8389 | 42.1662 | 29.07 | <.0001 |
| Percentage Due to Interaction | -0.01090 | 0.07140 | -0.1508 | 0.1290 | -0.15 | 0.8787 |
| Percentage Eliminated | 38.6487 | 1.3905 | 35.9234 | 41.3740 | 27.80 | <.0001 |
The patterns of all causal effects are similar for small families and large families. Small families appear to have a slightly higher total effect. For both groups, the percentage of the total effect that is due to the interaction between Encourage and Motivation is very small. For both groups, about 40% of the total effect is due to the mediation of Motivation.
The next set of EVALUATE statements estimate causal mediation effects for subjects whose social status (SocStatus) is high or low.
proc causalmed data=Cognitive;
model CogPerform = Encourage | Motivation;
mediator Motivation = Encourage;
covar FamSize SocStatus;
evaluate 'High Social Status' SocStatus=1(SD);
evaluate 'Low Social Status' SocStatus=-1(SD);
run;
Output 38.2.7 and Output 38.2.8 display the corresponding effect summaries.
Output 38.2.7: Mediation Effects Conditional on High Social Status
| Summary of Effects: High Social Status | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.8894 | 0.1378 | 6.6193 | 7.1595 | 50.00 | <.0001 |
| Controlled Direct Effect (CDE) | 4.1797 | 0.04696 | 4.0876 | 4.2717 | 89.00 | <.0001 |
| Natural Direct Effect (NDE) | 4.1982 | 0.04746 | 4.1052 | 4.2912 | 88.47 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.0625 | 1.3935 | 36.3312 | 41.7938 | 28.03 | <.0001 |
| Percentage Due to Interaction | 1.1031 | 0.08592 | 0.9347 | 1.2715 | 12.84 | <.0001 |
| Percentage Eliminated | 39.3321 | 1.2980 | 36.7881 | 41.8760 | 30.30 | <.0001 |
Output 38.2.8: Mediation Effects Conditional on Low Social Status
| Summary of Effects: Low Social Status | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.7948 | 0.1482 | 6.5043 | 7.0854 | 45.84 | <.0001 |
| Controlled Direct Effect (CDE) | 4.1797 | 0.04696 | 4.0876 | 4.2717 | 89.00 | <.0001 |
| Natural Direct Effect (NDE) | 4.1037 | 0.04733 | 4.0109 | 4.1964 | 86.70 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.6062 | 1.3467 | 36.9667 | 42.2457 | 29.41 | <.0001 |
| Percentage Due to Interaction | -0.2733 | 0.1094 | -0.4877 | -0.05890 | -2.50 | 0.0125 |
| Percentage Eliminated | 38.4877 | 1.4190 | 35.7066 | 41.2688 | 27.12 | <.0001 |
Again, the patterns of all causal effects are similar for both groups. The high social status group appears to have a slightly higher total effect.
You can also combine the specifications of covariates to evaluate specific causal mediation effects. In the following EVALUATE statements, subjects are defined by a combination of levels of FamSize and SocStatus:
proc causalmed data=Cognitive;
model CogPerform = Encourage | Motivation;
mediator Motivation = Encourage;
covar FamSize SocStatus;
evaluate 'Most Favorable Environment' FamSize=-.5(SD) SocStatus=1(SD);
evaluate 'Least Favorable Environment' FamSize=.5(SD) SocStatus=-1(SD);
run;
The effects labeled 'Most Favorable Environment' are defined by FamSize at 0.5 standard deviation below the mean family size and SocStatus at 1 standard deviation above the mean social status rating. The effects labeled 'Least Favorable Environment' are defined by FamSize at 0.5 standard deviation above the mean family size and SocStatus at 1 standard deviation below the mean social status rating.
Output 38.2.9 and Output 38.2.10 display the corresponding effect summaries.
Output 38.2.9: Mediation Effects Conditional on Most Favorable Environment
| Summary of Effects: Most Favorable Environment | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.8969 | 0.1371 | 6.6281 | 7.1656 | 50.29 | <.0001 |
| Controlled Direct Effect (CDE) | 4.1797 | 0.04696 | 4.0876 | 4.2717 | 89.00 | <.0001 |
| Natural Direct Effect (NDE) | 4.2057 | 0.04755 | 4.1125 | 4.2989 | 88.45 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.0202 | 1.3963 | 36.2835 | 41.7570 | 27.94 | <.0001 |
| Percentage Due to Interaction | 1.2102 | 0.09789 | 1.0183 | 1.4020 | 12.36 | <.0001 |
| Percentage Eliminated | 39.3978 | 1.2900 | 36.8694 | 41.9261 | 30.54 | <.0001 |
Output 38.2.10: Mediation Effects Conditional on Least Favorable Environment
| Summary of Effects: Least Favorable Environment | ||||||
|---|---|---|---|---|---|---|
| Estimate | Standard Error |
Wald 95% Confidence Limits |
Z | Pr > |Z| | ||
| Total Effect | 6.7874 | 0.1489 | 6.4955 | 7.0793 | 45.58 | <.0001 |
| Controlled Direct Effect (CDE) | 4.1797 | 0.04696 | 4.0876 | 4.2717 | 89.00 | <.0001 |
| Natural Direct Effect (NDE) | 4.0962 | 0.04742 | 4.0033 | 4.1891 | 86.39 | <.0001 |
| Natural Indirect Effect (NIE) | 2.6912 | 0.1453 | 2.4065 | 2.9759 | 18.53 | <.0001 |
| Percentage Mediated | 39.6497 | 1.3438 | 37.0160 | 42.2835 | 29.51 | <.0001 |
| Percentage Due to Interaction | -0.3836 | 0.1222 | -0.6231 | -0.1441 | -3.14 | 0.0017 |
| Percentage Eliminated | 38.4201 | 1.4276 | 35.6221 | 41.2180 | 26.91 | <.0001 |
The patterns of all causal mediation effects are similar for the two groups. The total effect for 'Most Favorable Environment' is slightly larger than the total effect for 'Least Favorable Environment'.
Together, these evaluations show that about 40% of the effect of parental encouragement on cognitive development is mediated by children’s learning motivation. The interaction effect of parental encouragement and children’s learning motivation is small. And more importantly, these conclusions appear to hold for different family sizes and levels of social status.
For more information about setting the covariate levels, see the EVALUATE statement and the section Evaluating Causal Mediation Effects.