我正在处理一个响应为二进制0或1的空间数据集。我想估计beta系数并说明空间自相关,因此我尝试使用CARBayes软件包{{1} }和S.CARleroux
。但是,有时当我执行此操作时,结果是系数的分布,但是对于其他数据集(格式相同),迹线图保持平坦,有效样本数family="binomial"
为0。
例如,在这种情况下,似乎采样正在运行,然后实质上失败了:
我使用的代码是:n.effective
在第二种情况下,输出为
car.prox <- S.CARleroux(formula=f, data = df, W=W, family="binomial",burnin=burn.in, n.sample=n.sample,thin=20, trials=rep(1,nrow(df)), rho = 1, verbose=TRUE)
我该如何解决这一问题并以考虑空间自相关的方式获得系数的分布?
可复制的示例:
#################
#### Model fitted
#################
Likelihood model - Binomial (logit link function)
Random effects model - Leroux CAR
Regression equation - y ~ var2 + var3 + var4 + var5 + var6 +
var7 + var8 + var9 + var10
Number of missing observations - 0
############
#### Results
############
Posterior quantities and DIC
Median 2.5% 97.5% n.sample % accept n.effective
(Intercept) -12.2061 -12.2061 -12.2061 10000 0.8 0.0
var2 -1.7098 -1.7098 -1.7098 10000 0.8 0.0
var3 6.2169 6.2169 6.2169 10000 0.8 0.0
var4 21.3834 21.3834 21.3834 10000 0.8 0.0
var5 -8.3727 -8.3727 -8.3727 10000 0.8 0.0
var6 7.8046 7.8046 7.8046 10000 0.8 0.0
var7 2.3668 2.3668 2.3668 10000 0.8 0.0
var8 -8.7651 -8.7651 -8.7651 10000 0.8 0.0
var9 -1.0197 -1.0197 -1.0197 10000 0.8 0.0
var10 -3.6726 -3.6726 -3.6726 10000 0.8 0.0
tau2 11022.7758 10122.9703 12068.6439 10000 100.0 4420.2
rho 1.0000 1.0000 1.0000 NA NA NA
Geweke.diag
(Intercept) NaN
var2 NaN
var3 NaN
var4 NaN
var5 NaN
var6 NaN
var7 NaN
var8 NaN
var9 NaN
var10 NaN
tau2 -2.3
rho NA
DIC = NaN p.d = NaN LMPL = -2871.75