Dear All,
Could we specify the multinomial distribution in R when doing Bayesian
data analysis through R2WinBUGS?
See below for my issues.
t2[i,1:2] ~ dmulti(p2[i,1:2],n2[i]) #t2[] is a matrix with two columns, the
problem is how to specify it in R
p2[i,1] <- (p[i] * s1[t[i]] * s2[t[i]] + (1 - p[i]) * (1 - c1[t[i]]) * (1 -
c2[t[i]]))/p1[i]
p2[i,2] <- (p[i] * s1[t[i]] * (1 - s2[t[i]]) +(1 - p[i]) * (1 - c1[t[i]]) *
c2[t[i]])/p1[i]
t2<-modeldata[,c(6,7)] #This is the method that i used. Unfortunately, it
seems not to work.
data<-list("m",...,"t2") #data[[10]] is just
"t2"
The error information is :Error in is.finite(x) : default method not
implemented for type 'list'
when using traceback(), i get:
6: FUN(X[[10L]], ...) #so, i guess i didnot specify "t2" correctly
5: lapply(data.list, formatC, digits = digits, format = "E")
4: write.datafile(lapply(data.list, formatC, digits = digits, format
"E"),
file.path(dir, data.file))
3: bugs.data(data, dir = getwd(), digits)
2: bugs(data, inits, model.file = "BayesGeostat.txt", parameters =
c("p",
"a", "u", "tau.u", "tau.s",
"phi", "t1.p"), n.chains = 3,
n.iter = 1000, OpenBUGS.pgm = "C:/Program Files
(x86)/OpenBUGS/OpenBUGS322/OpenBUGS.exe")
1: debug(bugs(data, inits, model.file = "BayesGeostat.txt", parameters
c("p",
"a", "u", "tau.u", "tau.s",
"phi", "t1.p"), n.chains = 3,
n.iter = 1000, OpenBUGS.pgm = "C:/Program Files
(x86)/OpenBUGS/OpenBUGS322/OpenBUGS.exe"))
Any guys have ever met this problem or know how to fix it?
Thanks a lot.
--
With Kind Regards,
oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::
[***********************************************************************]
ZhiJie Zhang,MD,PhD
Dept.of Epidemiology, School of Public Health,Fudan University
Office:Room 443, Building 8
Office Tel./Fax.:+86-21-54237410
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:epistat@gmail.com
[***********************************************************************]
oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::
[[alternative HTML version deleted]]