全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件
1774 1
2009-03-11

Excuse me! Because the problem of  forum, I can not
type Chinese here.


How do define two dummy variables in my program, one is "male", the
other is "du"? if you know, please help me. you could type Chinese, thanks a lot.




model{
        for(i in 1:n){
            day ~ dnegbin( p.ind, r.ind )
            p.ind <- r.ind/( r.ind+theta.ind )
            log(theta.ind) <- beta[1] + beta[2] * sat +beta[3]*male +beta[4]*lan+beta[5]*du


            
 ## this part I do not understand how to define the winbugs code with two dummy varialbes

                        r.ind <- r[ male + 1 ]
                       
## ---------------------------------------------------------------------------------------------------------------
             

        
                     }    
       theta[1] <- exp(beta[1])
       theta[2] <- exp(beta[1]+beta[2])
       theta[3] <- exp(beta[1]+beta[2]+beta[3])
       theta[4] <- exp(beta[1]+beta[2]+beta[3]+beta[4])
       theta[5] <- exp(beta[1]+beta[2]+beta[3]+beta[4]+beta[5])
       
       expbeta2 <- exp(beta[2])
       expbeta3 <- exp(beta[3])
       expbeta4 <- exp(beta[4])
       expbeta5 <- exp(beta[5])
      
      

        for (j in 1:5){
             r[j] ~ dpois(1)
             beta[j] ~ dnorm( 0.0, 0.001 )
             di[j] <-(1+theta[j]/r[j])
             var[j] <- theta[j]*di[j]
             p[j] <- r[j]/(r[j]+theta[j])
        }
}


INITS
list(beta=c(0,0,0,0,0), r=c(1,1,1,1,1))

list(n=50)

day[]     sat[]     male[]    lan[]    du[]
4    73    1    42.45    1
4    73    1    46.82    0
2    76    0    43.57    1
3    74    0    43.57    1
3    73    0    27.25    1
13    62    0    48.41    0
11    66    0    40.74    0
7    72    1    15.36    0
10    63    1    52.12    0
9    68    1    42.45    1
4    72    0    36.45    1
5    74    1    13.13    0
5    72    0    62.27    1
3    74    0    44.66    1
1    76    1    25.25    1
0    76    1    61.04    0
1    75    0    49.47    1
0    74    0    65.56    1
2    75    1    46.82    1
24    55    1    6.75    0
2    75    0    42.45    0
0    76    1    64.87    1
1    76    1    55.34    1
0    76    1    44.66    1
8    71    0    38.35    0
3    67    1    50    0
7    70    1    6.75    1
0    76    0    40.15    0
2    74    1    57.55    1
0    77    1    71.83    1
0    77    1    45.21    0
1    76    0    35.13    1
3    32    1    46.82    0
0    77    1    46.82    0
0    77    1    46.29    0
28    49    0    47.35    0
8    71    1    49.47    1
5    72    1    61.04    1
2    75    1    1.01    1
27    46    0    52.12    1
5    72    0    35.13    0
18    59    0    38.35    0
19    57    0    58.69    1
9    67    1    42.45    1
9    68    1    1.01    1
4    75    0    32.28    0
2    75    1    57.55    0
3    68    1    41.31    1
9    68    1    24.17    0
20    56    0    59.26    1
END               

[此贴子已经被angelboy于2009-3-26 9:38:07编辑过]

二维码

扫码加我 拉你入群

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

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

全部回复
2009-3-11 18:32:00

请问高手, 因为感觉系统有问题,不能打中文,所以,我再说明一下我的问题,在负二项分配里,有两个DUMMY VARIABLES 要怎么去定义,程序其它部份都对,就是DUMMY
的部份不会定义,非常感谢!

[此贴子已经被angelboy于2009-3-26 9:38:49编辑过]

二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

分享

扫码加好友,拉您进群