簡體   English   中英

如何修復第4行中發生的“預期右括號”:winbugs中的tau0 *(t [j + 1] -t [j])

[英]How to fix the 'expected right parenthesis' happening in the 4th line : tau0*(t[j+1]-t[j]) in winbugs

我需要使用winbugs估計四個參數: tau[i], mu1[i],mu2[i]and tau0[i]

當我點擊檢查模型時,它顯示第4行中tau0*(t[j+1]-t[j])之間的expected right parenthesis 當我刪除(t[j+1]-t[j]) ,它顯示c<-(1-step( tau[i]-t[j]))之間相同的expected right parenthesis <-(1-step( tau[i]-t[j]))

model
{
#likelihood
   for(i in 1:n){   
    for(j in 1:m){      
 x[i,j]~ dnorm( mu[i,j],  tau0*(t[j+1]-t[j]))      
 mu[i,j]<- mu1*(t[j+1]-t[j])*a+mu1*(tau[i]-t[j])*b+mu2*(t[j+1]-tau[i])*b+mu2*(t[j+1]-t[j])*c       
 sigma <-1/sqrt(tau0)                                                                                       
 a<-step( tau[i]-t[ j+1] )
 b<-(step(tau[i]- t[j])-(step(tau[i]- t[j+1]))
 c<-(1-step( tau[i]-t[j]))
}
#prior
   tau[i]~dnorm(mutau,tautau)
   mutau~dorm(0,  0.001)
   tautau~dgamma(0.01, 0.01)
   sigmatau<-1/sqrt(tautau)
   mu1[i]~dnorm(mumu1, tau1)
   mumu1~dorm(0, 0.001)
   tau1~dgamma(0.01,0.01)
   sigmatau1<-1/sqrt(tau1)
   mu2[i]~dnorm(mumu2, tau2)
   mumu2~dorm(0, 0.001)
   tau2~dgamma(0.01,0.01)
   sigmatau2<-1/sqrt(tau2)

   tau0[i]~dgamma(alpha,beta)
   sigmatau0<-1/tau0
  }
}
DATA
list(n=5, m=16,   mutau=0, tautau=1,  mumu1=0, tau1=1,   mumu2=0, tau2=1, alpha=0.01, beta=0.01 )

我期望正確的模型語法

b < - (step(tau [i] - t [j]) - (step(tau [i] - t [j + 1]))

(
    step(
            tau[i]- t[j]
        )
    -
    (
    step(
            tau[i]- t[j+1]
        )
    )

4個支架開口,3個支架關閉。 第一個支架未關閉。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM