Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Multilevel Mediation Analysis for Repeated Measure...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-17-2013 04:20 PM

Hi SAS Users,

I am trying to do a multilevel mediation analysis using a 2x4 RCT design, where there are 2 conditions (control vs. experimental) and 4 time points (baseline, 1 month, 3 month and 6 month). A cut of the person-time dataset is shown below.

Obs | Idnum | cond | time | Mediator | Outcome |
---|---|---|---|---|---|

1 | 20001 | 1, control | 0 Baseline | 40 | 6.75 |

2 | 20001 | 1, control | 1 month | 38 | 6.75 |

3 | 20001 | 1, control | 3 month | 38 | 7.75 |

4 | 20001 | 1, control | 6 month | 20 | 5.50 |

5 | 20005 | 1, control | 0 Baseline | 6 | 3.25 |

6 | 20005 | 1, control | 1 month | 4 | 2.25 |

7 | 20005 | 1, control | 3 month | 2 | 2.50 |

8 | 20005 | 1, control | 6 month | 12 | 1.75 |

9 | 20006 | 1, control | 0 Baseline | 12 | 6.00 |

10 | 20006 | 1, control | 1 month | 14 | 6.00 |

11 | 20006 | 1, control | 3 month | 12 | 6.50 |

12 | 20006 | 1, control | 6 month | 12 | 5.25 |

13 | 20007 | 1, control | 0 Baseline | 10 | 7.75 |

14 | 20007 | 1, control | 1 month | 8 | 7.00 |

15 | 20007 | 1, control | 3 month | 2 | 7.00 |

16 | 20007 | 1, control | 6 month | 6 | 7.50 |

17 | 20008 | 2, experimental | 0 Baseline | 34 | 5.00 |

18 | 20008 | 2, experimental | 1 month | 40 | 7.50 |

19 | 20008 | 2, experimental | 3 month | 38 | 5.25 |

20 | 20008 | 2, experimental | 6 month | 40 | 4.25 |

21 | 20009 | 1, control | 0 Baseline | 12 | 3.75 |

22 | 20009 | 1, control | 1 month | 2 | 3.25 |

23 | 20009 | 1, control | 3 month | 20 | 4.75 |

24 | 20009 | 1, control | 6 month | 20 | 4.00 |

25 | 20010 | 2, experimental | 0 Baseline | 20 | 6.25 |

26 | 20010 | 2, experimental | 1 month | 20 | 5.75 |

27 | 20010 | 2, experimental | 3 month | 18 | 2.25 |

28 | 20010 | 2, experimental | 6 month | 10 | 4.75 |

The intervention cond id coded as 0 and 1; putative mediator and outcome were measured at baseline and all follow ups.

Is there a way to evaluate mediation effects using this longitudinal data set with time varying measures?

If so, what is the best way of measuring the direct and indirect effects?

I used a random residual statement to account for within subject correlation, but the issue is that this solution of fixed effects is the marginal means. I need to evaluate the temporal effects as well, i.e., intervention -> mediates the intermediary putative mediator between 1 and 3 month -> changes outcome at 6 month.

This may be complicated but any help is much appreciated!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-18-2013 01:51 PM

Can you share the GLIMMIX/GENMOD code that you are currently using? At least for me, it is easier to adapt what you already have in hand, rather than starting from square one. The mediator variable intrigues me--it is a response variable, but is also a covariate of sorts. There might be a way to use PROC PHREG, since it is set up for time-dependent covariates, but we are rapidly moving towards the edge of my experience.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-18-2013 02:38 PM

Steve,

The code I am tying to test is below. Also there is a correction in the post, the condition is codes 1 and 2 not 0 and 1.

/*-----------------------------------------------------*/

/* Mediation model 1 */

/* Intervention on Outcome */

/*-----------------------------------------------------*/

proc glimmix data=work;

class idnum cond time;

model outcome = cond time cond*time / s;

random time/ subject=idnum type=un residual;

lsmeans cond*time;

run;

/*-----------------------------------------------------*/

/* Mediation model 2 */

/* Intervention on Mediator */

/*-----------------------------------------------------*/

proc glimmix data=work;

class idnum cond time;

model mediator = cond time cond*time / s;

random time/ subject=idnum type=un residual;

lsmeans cond*time;

run;

/*-----------------------------------------------------*/

/* Mediation model 3 */

/* Intervention and Mediator on Outcome*/

/*-----------------------------------------------------*/

proc glimmix data=work;

class idnum cond time;

model outcome = cond time cond*time mediator mediator*time / s;

random time/ subject=idnum type=un residual;

lsmeans cond*time;

lsmeans mediator*time;

run;

I have added the interaction terms with time to test the time dependent fixed effects.

Here is the scenario: lets assume that the intervention changes the mediator at 3 months which then mediates a change in the outcome at 6 months. If I set the reference category to baseline, it is possible to test the fixed effects for these changes: (1) cond*time (where cond=experimental and time=6 month in Model 1); (2) cond*time (where cond=experimental and time=3 month in Model 2) and (3) mediator*time in Model 3.

However, it is complicated to get the direct and indirect effects from this.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-18-2013 03:04 PM

Parts 1 and 2 certainly make sense to me. In model 3, however, we run into the problem that mediator is a continuous covariate. Consequently, I would attack things just a bit differently.

First, since we are in GLIMMIX, I would use type=chol for the Cholesky root of the unstructured matrix--guarantees positive semidefinite G matrix.

Second, I would have the second lsmeans statement with multiple AT mediator= values, if the time by mediator interaction is significant:

lsmeans time/AT mediator=mean;

lsmeans time/AT mediator=<lowest value observed>;

lsmeans time/AT mediator=<highest value observed>;

If the time by mediator interaction is not significant, well, then I would seriously consider dropping it from the model, as now the slopes are parallel, so comparisons will not depend on the values that mediator takes on.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-03-2014 12:54 PM

Thank You Steve! Is there any way to get the direct and indirect effects? Otherwise, I might just have to report the betas and p-values.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-03-2014 02:46 PM

Look at the solution vector (the betas). Which do you consider direct? I would say condition and time and their interaction. To get the indirect effect, look at the change in these betas when mediator is added in (this includes all mediator and mediator interaction terms). If this is missing your point entirely, then I think you may need to work this through a structural equation model approach (PROC CALIS for example, or PROC MODEL in SAS/ETS) that specifies direct and indirect effects more specifically.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-24-2014 02:32 PM

Hello Steve,

Sorry for not following up on this earlier.

I took your suggestion and tried two methods: (1) using a person time data set and modeled the time, cond and mediator interaction using GLIMMIX. I used a random residual statement to account for within subject correlation (code shown below).

/*-----------------------------------------------------*/

/* Mediation model 1 */

/* Intervention on Outcome */

/*-----------------------------------------------------*/

proc glimmix data=work;

class idnum cond time;

model &outcome = cond|time/s;

random time/ subject=idnum type=chol residual;

lsmeans cond*time;

run;

/*-----------------------------------------------------*/

/* Mediation model 2 */

/* Intervention on Mediator */

/*-----------------------------------------------------*/

proc glimmix data=work;

class idnum cond time;

model &med = cond|time / s;

random time/ subject=idnum type=chol residual;

lsmeans cond*time;

run;

/*-----------------------------------------------------*/

/* Mediation model 3 */

/* Intervention and Mediator on Outcome*/

/*-----------------------------------------------------*/

proc glimmix data=work;

class idnum cond time;

model &outcome = cond|time|&med / s;

random time/ subject=idnum type=chol residual;

lsmeans cond*time;

lsmeans time/AT &med=12.9236111 /*mean*/;

lsmeans time/AT &med=12 /*median*/;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-24-2014 02:41 PM

The solution of fixed effects and type II test of fixed effects from the final model (Model 3) is shown below. The reference was set as baseline and DASS_anxiety is the mediator.

Solutions for Fixed Effects | |||||||

Effect | Condition | time | Estimate | Standard Error | DF | t Value | Pr > |t| |

Intercept | 4.9622 | 0.121 | 667 | 41.01 | <.0001 | ||

cond | 1, control | -0.057 | 0.1681 | 667 | -0.34 | 0.7347 | |

cond | 2, experimental | 0 | . | . | . | . | |

time | 1 month | -0.5048 | 0.1092 | 1691 | -4.62 | <.0001 | |

time | 3 month | -0.6054 | 0.127 | 1691 | -4.77 | <.0001 | |

time | 6 month | -0.8472 | 0.1357 | 1691 | -6.24 | <.0001 | |

time | Baseline (reference group) | 0 | . | . | . | . | |

cond*time | 1, control | 1 month | 0.2916 | 0.1501 | 1691 | 1.94 | 0.0522 |

cond*time | 1, control | 3 month | 0.1661 | 0.1754 | 1691 | 0.95 | 0.3437 |

cond*time | 1, control | 6 month | 0.5023 | 0.1857 | 1691 | 2.71 | 0.0069 |

cond*time | 1, control | Baseline (reference group) | 0 | . | . | . | . |

cond*time | 2, experimental | 1 month | 0 | . | . | . | . |

cond*time | 2, experimental | 3 month | 0 | . | . | . | . |

cond*time | 2, experimental | 6 month | 0 | . | . | . | . |

cond*time | 2, experimental | Baseline (reference group) | 0 | . | . | . | . |

DASS_ANXIETY | 0.03509 | 0.008233 | 1691 | 4.26 | <.0001 | ||

DASS_ANXIETY*cond | 1, control | 0.0177 | 0.01172 | 1691 | 1.51 | 0.131 | |

DASS_ANXIETY*cond | 2, experimental | 0 | . | . | . | . | |

DASS_ANXIETY*time | 1 month | 0.01697 | 0.009498 | 1691 | 1.79 | 0.0741 | |

DASS_ANXIETY*time | 3 month | 0.01906 | 0.01159 | 1691 | 1.64 | 0.1004 | |

DASS_ANXIETY*time | 6 month | 0.02687 | 0.01274 | 1691 | 2.11 | 0.0352 | |

DASS_ANXIETY*time | Baseline (reference group) | 0 | . | . | . | . | |

DASS_ANXIE*cond*time | 1, control | 1 month | -0.01377 | 0.01297 | 1691 | -1.06 | 0.2886 |

DASS_ANXIE*cond*time | 1, control | 3 month | -0.01029 | 0.01591 | 1691 | -0.65 | 0.5178 |

DASS_ANXIE*cond*time | 1, control | 6 month | -0.02023 | 0.01675 | 1691 | -1.21 | 0.2274 |

DASS_ANXIE*cond*time | 1, control | Baseline (reference group) | 0 | . | . | . | . |

DASS_ANXIE*cond*time | 2, experimental | 1 month | 0 | . | . | . | . |

DASS_ANXIE*cond*time | 2, experimental | 3 month | 0 | . | . | . | . |

DASS_ANXIE*cond*time | 2, experimental | 6 month | 0 | . | . | . | . |

DASS_ANXIE*cond*time | 2, experimental | Baseline (reference group) | 0 | . | . | . | . |

Type III Tests of Fixed Effects | |||||||

Effect | Num DF | Den DF | F Value | Pr > F | |||

cond | 1 | 667 | 1.57 | 0.2105 | |||

time | 3 | 1691 | 17.53 | <.0001 | |||

cond*time | 3 | 1691 | 2.89 | 0.0344 | |||

DASS_ANXIETY | 1 | 1691 | 134.49 | <.0001 | |||

DASS_ANXIETY*cond | 1 | 1691 | 0.5 | 0.4776 | |||

DASS_ANXIETY*time | 3 | 1691 | 1.73 | 0.1581 | |||

DASS_ANXIE*cond*time | 3 | 1691 | 0.62 | 0.6036 |

Based on my understanding, if the type II tests of fixed effects for mediator*time is significant then mediation is present. The solution vectors are shown in solution for fixed effects, but for the life of me I can not figure out how best to present this finding or figure out a way to find direct/indirect effects.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-24-2014 02:50 PM

The F tests for mediator*time and mediator*condition*time are not significant, but the mediator "main effect" (which is really an intercept measure) is significant.

OK. I am walking out on a very thin limb here, and my interpretation may not fit your field. I would say that I see two populations, defined by the level of dass_anxiety, and the responses over time being essentially identical for those two. There seems to be an indication that the time course differs somewhat by condition as well. So, in a guess as to what is going on--direct effects are time and dass_anxiety, and condition an indirect effect on the time course of the response. Plots over time should make this apparent.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-24-2014 03:00 PM

Thanks for the suggestion Steve. I will try to look at the plots for interpretation. I also tried specifying line equations in proc CALIS (code shown below) which gives direct and indirect effects at each time point. The only issue is that I am not sure if I should specify a line equation for baseline as there should be no mediation at baseline in any case. However, that means baseline will be excluded from the error matrix.

ods html;

proc calis cov data=work_wide g4=1000 gconv=1e-10 all technique=levmar;

/*------------------------*/

LINEQS

outcome1_month = b1 cond + c1 mediator1_month + e11,

mediator1_month = a1 cond + e21,

outcome3_month = b2 cond + c2 mediator3_month + e12,

mediator3_month = a2 cond + e22,

outcome6_month = b3 cond + c3 mediator6_month + e13,

mediator6_month = a3 cond + e23

;

STD

cond=vartrt,

e11 = var11,

e21 = var21,

e12 = var12,

e22 = var22,

e13 = var13,

e23 = var23

;

COV

e11 e12 e13= COV1,

e21 e22 e23= COV2

;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-27-2014 10:00 AM

This is a case of statistics as art. I would fit it both ways, and hopefully find that the estimated values for mediation at baseline are zero.

And if they are NOT zero or nearly so, then I begin to wonder about "pathologies" in the data I am trying to model.

Steve Denham