Thank you for this great software! When testing for otu mediation between a multilevel factor (>2 levels) and an outcome, is there a clean way to separate out the mediation results of each level? For example, is this an appropriate call:
"factor" here is a 3 level variable composed of "Level1", "Level2", and "Level3." Level 3 is the reference.
Dear yijuanhu,
Thank you for this great software! When testing for otu mediation between a multilevel factor (>2 levels) and an outcome, is there a clean way to separate out the mediation results of each level? For example, is this an appropriate call:
"factor" here is a 3 level variable composed of "Level1", "Level2", and "Level3." Level 3 is the reference.
dat$factorLevel1 <- model.matrix(~factor,data=dat)[,"factorLevel1"] dat$factorLevel2 <- model.matrix(~factor,data=dat)[,"factorLevel2"]
ldm(formula=otu|factorLevel2~factorLevel1+outcome, data=dat, test.mediation=TRUE)
The goal here is to isolate the otus that mediate the association between Level1 vs. Level3 and the outcome.
Any guidance would be appreciated!
Vince