我正在尝试为我运行的三个模型找到贝叶斯因子(下面的代码)。
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)
但是,当我使用包时
library(BayesFactor)
BayesFactorDV1 <- BayesFactor (DV1.1, DV1.2, DV1.3)
我得到错误代码:
Error in BayesFactor(DV1.1, DV1.2, DV1.3) : argument not of class mcmc
有人可以帮助我吗?谢谢
我的数据结构如下所示:
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)