预期逗号

时间:2019-05-14 20:32:47

标签: winbugs r2winbugs

我的模型中不断出现“预期的逗号”错误,我不知道如何解决它,仍然获得ypred.basement和ypred.firstfloor的预测值。为了获得合适的模型以运行MCMC和收敛诊断,我在做什么错了?

我试图更改变量名称,删除逗号和

LMxM.model <- function(){
  # Data Likelihood 
  for (i in 1:n){
    log.activity[i] ~dnorm(mu[i], sigma.e)
    mu[i] <- int + beta[floor[i] ] + beta[county.id[i]]
  }


  # Prior distributions for location parameters
  int ~ dnorm(0,0.0001)
  for (j in 2:p){
    beta[j] ~ dnorm(0, 0.0001)
  }
  for ( j in 1:q){
    b[j] ~dnorm(0,tau.b)    
  } 

  # Prior distribution for VC
  tau.e  <- pow(sigma.e, -2)
  sigma2.e <- pow(sigma.e, 2)
  sigma.e ~ dunif(0,1000)       # As recommended by Gelman 2006

  tau.b  <- pow(sigma.b, -2)
  sigma2.b <- pow(sigma.b, 2)
  sigma.b  ~ dunif(0,1000)      # As recommended by Gelman 2006

  corr <- sigma2.u / (sigma2.u + sigma2.e)  



  # Posterior predictions
  b.pred ~ dnorm(0, tau.b)
  ypred.basement ~ dnorm(int + beta[2] + b.pred, tau.b)
  ypred.firstfloor ~ dnorm(int + beta[1] + b.pred, tau.b)


}

0 个答案:

没有答案