楼主: Lisrelchen
1829 1

[本週專題]WinBUGS: Undefined Real Result? [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4194份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

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

楼主
Lisrelchen 发表于 2014-6-26 20:59:01 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

I want to analyze a multilevel multidimensional model in WinBUGS. the model is as below (N=2362 students responding to K=45 items of a test, students are nested within J=116 schools):

  1. model{
  2.         #responses
  3. for(i in 1:N){
  4.         for(j in 1:K){
  5.         logit(p[i,j])<- a1[j]*t[i,1]+a2[j]*t[i,2]-b[j]
  6.         y[i,j]~dbern(p[i,j]  }#for j

  7.         t[i,1:2]~dmnorm(mu[sc,1:2],tau.p[1:2,1:2])
  8.                 }#for i

  9.         #school level
  10.     for(j in 1:J){  
  11.         mu[j,1:2]~dmnorm(m[j,1:2],tau.s[1:2,1:2])

  12.                 }#for j of school
  13.         #priors
  14.         for(j in 1:J){
  15.         m[j,1:2]~dmnorm(m0[1:2],cov[1:2,1:2])
  16.                #m0=c(0,0) #cov=diag(2)
  17.         }
  18.         tau.p[1:2,1:2]~dwish(cov[1:2,1:2],2)
  19.         tau.s[1:2,1:2]~dwish(cov[1:2,1:2],2)
  20.         sigma.p[1:2,1:2]<-inverse(tau.p[,])
  21.         sigma.s[1:2,1:2]<-inverse(tau.s[,])
  22.         s2p<-sum(sigma.p[,])
  23.         s2s<-sum(sigma.s[,])
  24.         rho<-(s2s)/(s2s+s2p)
  25.         a1[1]~dlnorm(0,4)
  26.         a2[1]<-0
  27.         b[1]~dnorm(0,1)
  28.         for(s in 2:K) {
  29.     a1~dlnorm(0,4)
  30.     a2~dlnorm(0,4)
  31.     b~dnorm(0,1)
  32.                     }#for s of items   
  33.         }#for model
复制代码


Also see next post

二维码

扫码加我 拉你入群

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

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

关键词:Undefined winbugs Defined DEFINE WINBUG schools nested within

沙发
Lisrelchen 发表于 2014-6-26 21:00:08
I've set these functions as initial values:
  1. ini<-function(){
  2. list(tau.p=matrix(rgamma(4,100,100),2,2),
  3. tau.s=matrix(rgamma(4,100,100),2,2),
  4. t=rmvnorm(N,mean=c(0,0),sigma=diag(2)),
  5. m=rmvnorm(J,mean=c(0,0),sigma=diag(2)),
  6. mu=rmvnorm(J,mean=c(0,0),sigma=diag(2)),
  7. a1=rlnorm(K,0, 0.4),
  8. a2=c(NA,rlnorm(K-1,0, 0.4)),
  9. b=rnorm(45,0,0.5))
  10. }
复制代码


I use rube package in R to check and run my analysis and everything looks fine. When I run the model I receive "Trap 66 (postcondition violated)" or "undefined real result". I think the problem is from the initials but I have no idea how to solve it.

Any idea?

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-18 11:00