Megan Owen
Megan Owen

Reputation: 11

Mediation modal with 5000 bootstrap using psych

I am trying to Conduct a mediation model with 5,000 bootstrap samples using the 'psych' package. gender is be the predictor, sexual disgust is the mediator, and Political Orientation: social issues isbe the dependent variable.

I have both codes and both will not work, but it did yesterday and I already ran R again to see if that would solve the issue and it did not.

require(psych) #doing mod
mediationmodel1<-mediate(PolOri_Social~Gender+(Sexual_Disgust), std=T, data=Tyburdata, n.iter=10000, plot=F)

require(psych)
set.seed(12345)
mediate(PolOri_Social~Gender+(Sexual_Disgust), std=T, data= Tyburdata, n.iter=10000)

The error I keep getting is:

Error in inherits(model.y, "gam") : 
  argument "model.y" is missing, with no default

Upvotes: 0

Views: 337

Answers (1)

Larissa
Larissa

Reputation: 1

I had the same issue but solved it by writing psych:: in front of the equation. (I think it's because I had also activated other packages using the 'mediate' command).

Thus: library(psych)

mediationmodel1<-psych::mediate(PolOri_Social~Gender+(Sexual_Disgust), std=T, data=Tyburdata, n.iter=10000, plot=F)

should work :)

Upvotes: 0

Related Questions