Multilevel Mediation with continous predictor

Hi all,

Let me preface this by saying that I am a beginner to R and am still learning.

I want to run a multilevel mediation and after trouble shooting 1 million problems I think I am almost there! But there is still one issue.

My data:

Individuals are nested within countries(country level), I want to see if mediator y mediates the relationship between a country level variable and an individual level outcome.

In short:

Predictor: X (country level)

Mediator: Y (individual level)

Outcome: Z (individual level)

To do this, I have closely followed the paper mediation: R Package for Causal Mediation Analysis from Tingley et al. and have tried to recreate their code for multilevel mediation (section 4):

medfit <- lmer(Y~X + (1 | Nationality_Living), data=Datacomplte)

outfit<- lmer(Z~ X*Y +(1 | Nationality_Living), data=Datacomplte)

medout <- mediate(medfit, outfit, treat = "X", mediator = "Y",sims = 100)

summary (medout)

However, unlike in the example in the paper, my treatment variable is continous and not binary (ranging from -1 to 2). Hence, the output I get comparing the effect of the treatment to the control is not what I want. In the example in 4.2 they use a continous treatment and suggest to adapt the medout function as follows:

R> med.out <- mediate(medfit, outfit, treat = "free", mediator = "smorale",

  • control.value = 3, treat.value = 4, sims = 100).

I ahve tried this but it did not help. Can someone help?

In short: How do I specificy a 2-1-1 multilevel mediation model in R with a contrinous treatment variable?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.