Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test.TMint for mixed effects models #63

Open
anthonycrane opened this issue Oct 30, 2023 · 0 comments
Open

test.TMint for mixed effects models #63

anthonycrane opened this issue Oct 30, 2023 · 0 comments

Comments

@anthonycrane
Copy link

anthonycrane commented Oct 30, 2023

mediation/R/medtests.R

Lines 78 to 84 in a9a5c7b

d.diff <- x$d1 - x$d0
d.diff.sims <- x$d1.sims - x$d0.sims
# Format results in the htest format
pv <- pval(d.diff.sims, d.diff)
ci <- quantile(d.diff.sims, c((1 - conf.level)/2, (1 + conf.level)/2))

Hello,

I am performing a mediation analysis with mixed models in the presence of a (potential) treatment * mediator interaction. I would like to test if this interaction is significant. Is there anything wrong with using the same logic in this code to preform this test? My model.m and model.y that I provide to the mediate function are both lmer objects, and test.TMint says that it is not implemented for these models quite yet.

So my question is, is there anything theoretically wrong with this:

mod.m <- lmer(M ~ X + (1|id), data = data)
mod.y <- lmer(Y ~ M * X + (1|id), data = data)

med.results <- mediate(mod.m, mod.y, mediator = "M", treat = "X" )

acme_diff = med.results$d1.sims - med.results$d0.sims

quantile(acme_diff, probs = c(0.025, 0.975))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant