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.
- 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)`


雷达卡


京公网安备 11010802022788号







