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.