[R] Censoring in R2OpenBUGS

arnabkm2007 maity at math.niu.edu
Thu Feb 12 16:05:13 CET 2015


Hi, 

I am trying to run the following model for OpenBUGS and want to use
R2OpenBUGS package. The model specifies weibull distribution for censored
data. 

  
  weibull.model <- function() 
  { 
    
    for(i in 1:n) 
    { 
      
      exp.alpha[i] ~ dgamma(a.alpha, b.alpha) 
      alpha[i] <- log(exp.alpha[i]) 
      
      linear.part[i] <- alpha[i] + inprod(nu[ ], x[i, ]) 
      lambda[i] <- exp(linear.part[i]) 
      
      time[i] ~ (dweib(shape, lambda[i]) C(censored.time[i], )) 
      
    } 
    
    shape ~ dgamma(a.shape, b.shape) 
    
    for(j in 1:p) 
    { 
      
      beta[j]  ~ dnorm(prior.mean, prior.tau) 
      gamma[j] ~ dbern(pi[j]) 
      pi[j]    ~ dbeta(1, 1) 
      nu[j]   <- beta[j] * gamma[j] 
      
    } 
    
  } 
  


But R is throwing the following error. 

Error: unexpected symbol in: 
"       
      time[i] ~ (dweib(shape, lambda[i]) C" 

Any help regarding this will be appreciated. 

Thanks & Regards, 
Arnab 


Arnab Kumar Maity 
Graduate Teaching Assistant 
Division of Statistics 
Northern Illinois University 
DeKalb, IL 60115 
Email: maity at math.niu.edu 
Ph:     779-777-3428 



--
View this message in context: http://r.789695.n4.nabble.com/Censoring-in-R2OpenBUGS-tp4703160.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list