Multilevel Mediation Model with Mixed Effects

123 views
Skip to first unread message

Yukun Yang

unread,
Jun 22, 2022, 3:51:20 PM6/22/22
to lavaan
Hi all,

I'm doing an analysis that has census tract level data on some environments, racial composition (in %), demographics, and health outcomes. I want to build a mediation model to test the environmental factors can be a mediator for race and health outcomes.

I also want to have random intercepts for states, considering the baseline of the metrics might vary from state, so I used the cluster parameter. Now I have two ways to build models. 

The first kind is to build a model for each individual race. For example:

model_Black <- '
  # mediator
 prop_dilapbldg ~ a*Black + log.median.house.income + Pct_college + Age + Pct_Female + Pct_insurance + Pct_Owner + Pct_Vacant + Pct_SingleFam + Urban_Rural_New
 
  # full model
 mhlth_crud~ c*Black + log.median.house.income + Pct_college + Age + Pct_Female + Pct_insurance + Pct_Owner + Pct_Vacant + Pct_SingleFam + Urban_Rural_New + b*prop_dilapbldg
 
  # direct effect
  direct := c
 
  # indirect effect
  indirect := a*b
 
  # total effect
  total := c + (a*b)'

fit_Black <- sem(model_Black, data = df_sem_mhlth_crud, cluster = "State_fct")


The second is put all races in one model and define their direct/indirect effects all in one model.

model_All <- '
  # mediator
  prop_dilapbldg ~ a*Black + x*White + y*Hispanic + z*Asian + log.median.house.income + Pct_college + Age + Pct_Female + Pct_insurance + Pct_Owner + Pct_Vacant + Pct_SingleFam + Urban_Rural_New
 
  # direct effect
  mhlth_crud~ c*Black + x1*White + y1*Hispanic + z1*Asian +log.median.house.income + Pct_college + Age + Pct_Female + Pct_insurance + Pct_Owner + Pct_Vacant + Pct_SingleFam + Urban_Rural_New + b*prop_dilapbldg
 
  # direct effect
  direct_b := c
  direct_w := x1
  direct_h := y1
  direct_a := z1
 
  # indirect effect
  indirect_b := a*b
  indirect_w := x*b
  indirect_h := y*b
  indirect_a := z*b
 
  # total effect
  total_b := c + (a*b)
  total_w := x1 + (x*b)
  total_h := y1 + (y*b)
  total_a := z1 + (z*b)'

model_All <- sem(model_All, data = df_sem_mhlth_crud, cluster = "State_fct")

Is there anything I'm doing wrong with it? The effects of the two kinds of models are completely different for the same racial group. And how can I interpret the models where there is a mediator's coef in the path, but also there is a coef from the indirect effects.

Thanks in advance.

Terrence Jorgensen

unread,
Jun 23, 2022, 10:48:28 AM6/23/22
to lavaan
I also want to have random intercepts for states, considering the baseline of the metrics might vary from state, so I used the cluster parameter.

All you did was request cluster-robust SEs.  You need to specify level-specific models to fit a MLSEM.


 
The first kind is to build a model for each individual race. For example:

The second is put all races in one model and define their direct/indirect effects all in one model.

That's not what it looks like.  You fit both models to the same data, presumably all races.  You just included a single race's dummy code in the first model (Black), which means the slope is the adjusted mean difference between Blacks and the average of all other races combined.  In the second model (with dummy codes for all but 1 group, I assume), the slope for Black is the adjusted mean difference between Blacks and whichever group is the reference group.

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Terrence Jorgensen

unread,
Jun 24, 2022, 3:32:28 AM6/24/22
to lavaan
Actually, I don't know if I can create dummies for the race because all race variables are rates; they are the racial compositions of a place. They are not individual-level data so each observation's race is exclusive. 

Any thoughts on this?

Ah, I missed the (in %) part of your original post.  In that case, you have some interdependence of those different variables, because they all have to sum to 1.  So in places with more of one category, there will tend to be fewer of others.  You might want to review the literature about "compositional data analysis" (which I am unfamiliar with) to see how such predictors affect interpretations of parameters.
Reply all
Reply to author
Forward
0 new messages