0

I have the following code:

model.xy <- lm(Y ~  X, Htest)

model.mx <- lm(M  ~  X, Htest)

model.yxm <- lm(Y   ~  X + M, Htest)

These regressions are doing fine (also summary view) but then when I want to check for mediation effect the code is getting an error.

results <- mediate(model.mx, model.yxm, treat='X', mediator='M', boot=TRUE, sims=500)

The code above used to work last week and now I keep getting:

Error in mediate(model.mx, model.yxm, treat = "X", mediator = "M", boot = TRUE, : unused arguments (treat = "X", mediator = "M", boot = TRUE, sims = 500)

Can someone please tell me what might be wrong? I have the required packages and all variables exist and I have no typos.. it really worked last week. I am really confused.

Thanks!

StupidWolf
  • 45,075
  • 17
  • 40
  • 72
User100009
  • 103
  • 1
  • 1
  • 5

1 Answers1

0

Try restarting R -- the mediate function probably got overwritten somewhere along the way.

Souf Ee
  • 1,021
  • 1
  • 7
  • 7