- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
正如这篇文章的标题所说,当我尝试使用 BRugsFit
(使用 coda=T
)从 R 运行在 WinBUGS 中正常工作的代码和数据时,我得到这些错误:
Error in glm.fit(x = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, :
NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning messages:
1: glm.fit: algorithm did not converge
2: glm.fit: algorithm did not converge
3: glm.fit: algorithm did not converge
4: glm.fit: algorithm did not converge
5: step size truncated due to divergence
当我对 coda 对象执行 tail()
时,我一遍又一遍地得到相同的数字。另一方面,当我运行 WinBUGS、保存尾声并将其加载到 R 中时,我得到了一些像我预期的随机变化,并且没有关于收敛的警告。
这是我的模型(它使用“ones 技巧”来查找 Logistic-Makeham 分布参数的后验)。
model {
for(i in 1:n){
ones[i]<-1;
# here I pre-calculate two quantities that occur several times
# in the PDF, to save a little processing time
expbx[i] <- exp(b*x[i]); expbx1[i]<- 1/(1+sd*(expbx[i]-1));
# below is the actual PDF
p[i]<-(c+a*expbx[i]*expbx1[i])*exp(-c*x[i])*pow(expbx1[i],1/s);
# the ones trick
ones[i]~dbern(p[i]);
}
b~dunif(0,1); d~dexp(1); c~dexp(1); s.raw~dflat();
# a (lambda) parametrized this way because it comes out more accurate
# s forced to be > 0
a<-b*d; s<-abs(s.raw);
# NOT a standard deviation, just s times d, to save processing time
sd<-s*d;
# I save all the parameters I'm interested in to one vector, for convenient
# viewing of them all in the same window.
out[1]<-a; out[2]<-b; out[3]<-c; out[4]<-s; out[5]<-d;
}
这是我的数据的典型示例:
list(n= 148 ,x=c( 1246,1175,1048,1169,1043,802,543,719,1296,817,1122,542,839,443,1536,700,834,232,596,1096,1118,957,974,1031,1149,1044,1108,
519,677,569,952,1243,970,1736,1262,1026,979,1543,1029,761,533,540,511,1150,1589,1169,1029,1248,1572,638,731,525,968,1467,1596,1077,712,1603,1
203,991,37,1775,893,993,913,1487,1186,1381,977,1247,857,786,615,733,1206,1059,1508,569,1205,754,886,1099,843,599,780,1294,1603,1242,883,1320,
507,1097,1193,218,1362,1181,1118,453,1291,972,787,1061,1097,1100,1117,1174,596,1305,1071,940,919,999,1209,1043,1161,1016,1025,750,423,732,
1389,907,1184,1275,944,1209,1073,1098,1348,976,817,557,211,961,880,1039,1287,736,1400,1757,1355,977,198,689,853,1251,767,768 ))
...和典型的初始化(我使用 4 个链,稀疏 20,老化 2000,20000 次迭代)
list( d=0.001738,b=0.0009672,c=0.002451,s.raw=0.001511 )
list( d=0.006217,b=0.005596,c=0.00777,s.raw=0.007019 )
list( d=1.504E-05,b=4.825E-06,c=2.172E-07,s.raw=6.104E-05 )
list( d=0.3011,b=0.03552,c=0.1274,s.raw=0.2549 )
OpenBUGS 是否只是四舍五入到比 WinBUGS 更少的有效数字,如果是这样,也许我可以更改一个设置以使其停止这样做?
最佳答案
我对此的初步回答似乎是......的某种组合
bugsInits()
和 bugsData()
命令的 format
参数设置为 fg
。对于建议关闭过度松弛的响应者:问题是我无法打开它,如果没有它,迭代将永远持续下去。但这似乎是目前唯一的选择。我希望 WinBUGS 手册能够更具体地说明谨慎使用此功能的含义。哦,好吧,我想我最终需要阅读他们引用的论文。但是,由于 OpenBUGS 中甚至不提供此功能,因此目前尚无实际意义。
我将暂时保留我的问题,以防有人提供比我所能提供的更好或更详细的答案。
关于r - OpenBUGS 无法收敛于 WinBUGS 中收敛的模型。精度极限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11379503/
我有一些简单的时间事件数据,没有协变量。我试图将 Weibull 分布拟合到它。所以我有以下代码。在我加载姓名首字母之前,一切看起来都很好。它说“这个链包含未初始化的变量”。但我不明白。我认为 Wei
我需要帮助才能在我的 WINBUGS 代码 (v. 1.4.3) 中找到错误。 在“模型规范”步骤中,模型在语法上看起来是正确的。但是,在我尝试加载数据时,出现此错误: 数组索引大于 phi3 的数组
我在 winbugs 中对这段代码有一些问题。该模型在本质上是正确的并且数据已加载,但是当我编译时,软件输出是“节点 Z 的多重定义”。我不知道如何解决问题。 这是模型: #BUGS Model mo
当我为带有附加模型的 3 个链加载初始化时,我得到“此链包含未初始化的变量”。我点击“gen init”继续。这是正确的做法吗?它不会发生在固定模型上,但往往会发生在随机模型上。请指教。 #BUGS
我有一个输入需求模型,数据不平衡。因变量为yijt,其中i表示生产函数(i=1,2,3)的输入,j code>表示公司(j=1,..,21),t表示时间(ti=1,..,Ti) .那么,由于面板是不平
我正在尝试使用 BUGS 编写狄利克雷多项式模型。 基本上我有 18 个区域和每个区域 3 个类别。例如, 区域 1:0.50 属于低,0.30 属于中,0.20 属于高。列表当然以不同的比例继续到区
首先,有人知道 WinBUGS 的开发人员指南吗?该网站充满了涂鸦的详细示例和模型语言的文档,但我还没有找到任何关于如何解释陷阱窗口的信息。 其次,有没有人找到任何方法来简化检查/加载/编译/初始化/
我正在使用 Kruschke 描述的分层建模框架在 JAGS 中建立两个模型之间的比较。该框架的想法是通过将每个版本指定为分类变量的一个级别来运行和比较模型的多个版本。该分类变量的后验分布可以解释为各
我有一个 OpenBUGS 模型,它使用随着时间的推移 (x.values) 观察到的数据 (y.values) 来模拟多次运行 (~100000),并对每次运行的 y 值 (y.est) 进行新的估
我用过 Winbugs来自 R通过 R2WinBUGS和 BRugs包,我写了模型,尝试运行,结果没出来,看了WinBUGS日志,似乎没有出错。 这是模型: require(BRugs) requir
我目前正在对多项临床试验的生存数据进行荟萃分析。 为此,我使用相同的方法从已发布的分析中获取代码。但是,当使用来自已发布分析的数据运行此代码时,我无法复制他们的结果。事实上,结果无法收敛到任何一种合理
我有一个与称为 BUGS 的 R 代码相关的问题。我已经在 WinBUGS 中运行了模型,它运行良好,给了我预期的结果。下面是当我有 Y 的单一结果或单变量数据时使用的自动化代码。现在我想将它用于多种
我是 WinBUGS 的新手,无法使用下面的代码。型号为syntactically correct (它是具有随机效应的分层 logit 模型),但是当我单击 load data 时出现的错误信息是
我是统计分析领域的新手,最近对 BUGS/JAGS/STAN 建模语言产生了兴趣。真正令我惊讶的是,我没有看到任何定义新函数或发行版以避免代码重复的示例。例如,假设我经常使用泊松分布的平方,是否可以执
我使用 R 中的 R2WinBUGS 包在 WinBUGS 中运行了一次漫长的计算(百万次迭代): bugs.object <- bugs(...) 但是 R 崩溃了。 如何在不再次运行 winbug
正如这篇文章的标题所说,当我尝试使用 BRugsFit (使用 coda=T)从 R 运行在 WinBUGS 中正常工作的代码和数据时,我得到这些错误: Error in glm.fit(x = st
我正在尝试在 JAGS 中实现为 WinBUGS 编写的以下模型: model { for (i in 1:N) { wtp[i] ~ dw
我有一个关于在 JAGS 和 BUGS 中运行模型的细节的快速问题。 假设我使用 n.burnin=5000、n.iter=5000 和 thin=2 运行模型。这是否意味着该程序将: 运行 5,00
我是一名优秀的程序员,十分优秀!