楼主: 文雅13
18838 124

[问答] R2winbugs到出数据时出现错误 [推广有奖]

61
文雅13 发表于 2012-12-17 16:20:52
[code] we might assume that F{θ; xi (t)} follows a marginalized transition
model (MTM) , with marginal mean g{μ (t)} = xi (t)β,文献中就是这样提了下,具体程序中就是那样了

62
epoh 发表于 2012-12-17 16:27:41
文雅13 发表于 2012-12-17 16:11
是在文献中找到的程序,程序就是那样的
那你就向文献的作者要要看
看他是否愿意提供
否则你就要依需求,自行编程

# MTM1Delta is a function written in the WinBUGS development         
# interface for computing the intercept delta[i,j] to satisfy
# marginal mean and serial dependence simultaneously

# Mv is a function written in the WinBUGS development
# interface for computing smooth function estimates
# with low-rank thin-plate bases

63
文雅13 发表于 2013-1-17 09:09:13
epoh 发表于 2012-12-17 16:27
那你就向文献的作者要要看
看他是否愿意提供
否则你就要依需求,自行编程
老师,在检验Winbugs模型时出现loop name already used in outer loop是什么问题?

64
epoh 发表于 2013-1-17 15:36:26
文雅13 发表于 2013-1-17 09:09
老师,在检验Winbugs模型时出现loop name already used in outer loop是什么问题?
for (i in 1:n) // outer loop
{
    for (i in 1:p) // inner loop
    {
    //...do something
    }
//...do something else
}

loop name already used in outer loop

65
文雅13 发表于 2013-1-17 16:05:54
epoh 发表于 2013-1-17 15:36
for (i in 1:n) // outer loop
{
    for (i in 1:p) // inner loop
老师,我没太看明白这些code是什么意思?

66
文雅13 发表于 2013-1-17 16:10:32
就是for (i in 1:n) 地方有错误

67
文雅13 发表于 2013-1-17 19:46:33
epoh 发表于 2013-1-17 15:36
for (i in 1:n) // outer loop
{
    for (i in 1:p) // inner loop
老师,没明白您的意思,能说的详细点吗?

68
epoh 发表于 2013-1-17 20:42:27
文雅13 发表于 2013-1-17 19:46
老师,没明白您的意思,能说的详细点吗?
也就是outer loop 用i,inner loop 就要用j,不能用相同的i

69
文雅13 发表于 2013-1-17 21:05:43
epoh 发表于 2013-1-17 20:42
也就是outer loop 用i,inner loop 就要用j,不能用相同的i
用的就是i ,但鼠标还指着这里面的ifor (i in 1:n),在Winbugs中 gamma as a matrix (two indices)and a
vector (one index)
是指什么?

70
文雅13 发表于 2013-1-17 21:10:25
epoh 发表于 2013-1-17 20:42
也就是outer loop 用i,inner loop 就要用j,不能用相同的i
  1.   y[i,j]~dbern(p[i,j])
  2.                  logit(p[i,j])<-delta[i,j]+gamma[i,j]*y[i,j-1]
  3.                  etaM[i,j]<-beta0all[i]+beta1all[i]*t[(sumn[i]-nobs[i]+j)]
  4.            
  5.                
  6.                   delta[i,j]<- -log((-b[i,j]+sqrt(b[i,j]*b[i,j]-4*a[i,j]*c[i,j]))/(2*a[i,j]))
  7.                      
  8.                   
  9.                   a[i,j]<-exp(-gamma[i,j])*exp(etaM[i,j])/(1+exp(etaM[i,j]))

  10.                   b[i,j]<-(exp(etaM[i,j])/(1+exp(etaM[i,j]))+exp(etaM[i,j-1])/(1+exp(etaM[i,j-1]))-1)*exp(-gamma[i,j])+exp(etaM[i,j])/(1+exp(etaM[i,j]))-exp( etaM[i,j-1])/(1+exp(etaM[i,j-1]))

  11.                   c[i,j]<- exp(etaM[i,j])/(1+exp(etaM[i,j]))-1
复制代码
比如这个code。gamman有矢量也有矩阵吗?不会看,哎

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 13:53