0

I'm trying to find the bayesfactor for three models which I've run (code below).

library(Zelig)
DV1.1 <- zelig(as.factor(DV1) ~ IV1, model = "oprobit.bayes", mcmc=500000, data = DataCL)
DV1.2 <- zelig(as.factor(DV1) ~ IV1 + IV2, model = "oprobit.bayes", mcmc=500000, data = DataCL)
DV1.3 <- zelig(as.factor(DV1) ~ IV1 + IV2 + IV3 , model = "oprobit.bayes", mcmc=500000, data = DataCL)

However, when I use the package

library(BayesFactor)

BayesFactorDV1 <- BayesFactor (DV1.1, DV1.2, DV1.3)

I get the error code:

 Error in BayesFactor(DV1.1, DV1.2, DV1.3) : argument not of class mcmc

Would anyone be able to help me please? Thank you

My data structure is something like below:

DV1 = c(1, 2, 3, 4, 1, 2, 3, 4)
IV1 = c(1, 2, 1, 2, 2, 1, 1, 2)
IV2 = c(0, 49, 23, 5, 1, 6, 8, 17)
IV3 = c(5, 7, 0, 10, 0, 0, 4, 14)
df = data.frame(DV1, IV1, IV2, IV3)
Isobel
  • 41
  • 1
  • 3
  • Please create a minimal working example: that includes sample data and packages loaded/used. `zelig` is easy enough to figure out but `BayesFactor` could refer to a number of different packages. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – emilliman5 Mar 13 '18 at 16:22
  • I have hopefully made the changes you suggested - let me know if they're not sufficient though and I can add more as required. – Isobel Mar 13 '18 at 16:50

0 Answers0