- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 BUGS 编写狄利克雷多项式模型。
基本上我有 18 个区域和每个区域 3 个类别。例如,
区域 1:0.50 属于低,0.30 属于中,0.20 属于高。列表当然以不同的比例继续到区域 18。我得到的唯一代码是这个
`model {
for (i in 1:N) {
x[1:3] ~ dmulti(p[],n[i])
p[1:3] ~ ddirch(alpha[])
}
for (k in 1:3) {
alpha[k] <- 1
}
}
DATA list(n=c(38483, 2259, 1900),x=c(29256.42719, 1857.431404, 1548.007808, 29256.42719, 1857.431404, 1548.007808, 29256.42719, 1857.431404, 1548.007808), N=3)`
最佳答案
这可能会有所帮助( source ):
Learning about the parameters of a Dirichlet distribution
Suppose as part of a model there are J probability arrays p[j, 1:K], j = 1, ..., J, where K is the dimension of each array and sum(p[j, 1:K]) = 1 for all j. We give each of them a Dirichlet prior:
p[j, 1:K] ~ ddirch(alpha[])
and we would like to learn about alpha[]. However, the parameters alpha[] of a Dirichlet distribution cannot be stochastic nodes. The trick is to note that if delta[k] ~ dgamma(alpha[k], 1), then the vector with elements delta[k] / sum(delta[1:K]), k = 1, ..., K, is Dirichlet with parameters alpha[k], k = 1, ..., K. So the following construction should allow learning about the parameters alpha[]:
for (k in 1:K) {
p[j, k] <- delta[j, k] / sum(delta[j,])
delta[j, k] ~ dgamma(alpha[k], 1)
}A prior can be put directly on the alpha[k]'s.
关于bayesian - 狄利克雷多项式 WinBUGS 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24349692/
我有一些简单的时间事件数据,没有协变量。我试图将 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
我是一名优秀的程序员,十分优秀!