楼主: Lisrelchen
2006 1

[Q & A]Dirichlet-Multinomial WinBUGS? [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4192份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

威望
0
论坛币
50278 个
通用积分
83.5106
学术水平
253 点
热心指数
300 点
信用等级
208 点
经验
41518 点
帖子
3256
精华
14
在线时间
766 小时
注册时间
2006-5-4
最后登录
2022-11-6

楼主
Lisrelchen 发表于 2014-6-30 23:09:29 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

So I'm trying to code a dirichlet-multinomial model using BUGS. Basically I have 18 regions and 3 categories per region. In example, Region 1: 0.50 belongs to Low, 0.30 belongs to Middle, and 0.20 belongs to High. The list goes on to Region 18 of course with varying proportions.The only code I got is as follows. I shortened it to 3 regions first just for example. It states 'Dirichlet36' after clicking 'gen inits'. Please help me to code this.

  1. model  {
  2. for (i in 1:N) {
  3. x[1:3] ~ dmulti(p[],n[i])
  4. p[1:3] ~ ddirch(alpha[])
  5. }
  6. for (k in 1:3) {
  7. alpha[k] <- 1
  8. }
  9. }
  10. 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)`
复制代码


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Multinomial Dirichlet winbugs WINBUG nomial example course trying

本帖被以下文库推荐

沙发
Lisrelchen 发表于 2014-6-30 23:10:56
This isn't clear - if the x are multinomial they should be integers. Also the code you've given doesn't reproduce the error you've stated. It looks like the x and the p need to be matrices, e.g. x[i,1:3], p[i,1:3], and if x is supposed to be a matrix, it needs to be defined in the data as something like structure(.Data=..., .Dim=c()) –

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-9 13:37