3

I have some simple time to event data, no covariates. I was trying to fit a Weibull distribution to it. So I have the following code. Everything looks good until I load my initials. It says "this chain contains uninitialized variables". But I don't understand. I think Weibull dist only has 2 parameters, and I already specified them all. Could you please advise? Thanks!

model
{   
    for(i in 1 : N) {                       
            t[i] ~ dweib(r, mu)I(t.cen[i],)
    }   
    mu ~ dexp(0.001)
    r ~ dexp(0.001)
}
# Data
list(
t.cen=c(0,3.91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21.95,23.98,33.08),
t=c(2.34,NA,5.16,5.63,6.17,6.8,7.03,8.05,8.13,8.36,8.83,10.16,
10.55,10.94,11.48,11.95,13.05,13.59,16.02,20.08,NA,NA,
NA),
N=23
)
# Initial values
list(
r=3,mu=3
)

1 Answers1

2

The other uninitialised variables are the missing (NA) values in the vector of t. Remember that the BUGS language makes no distinction between data and parameters, and that supplying something as data with the value NA is equivalent to not supplying it as data.

Matt Denwood
  • 2,537
  • 1
  • 12
  • 16
  • Thanks for your answer! So how should I resolve this? Should I click on "geninits" to make BUGS generate initials for me? I am afraid that it will try to generate those NA values.... – user3669725 Aug 01 '16 at 14:04
  • Yes, the best solution is probably to use gen inits, assuming that WinBUGS is smart enough to generate initial values that satisfy the interval censoring constraint. Otherwise you will have to specify your own initial values for the vector of t, making sure that observed values of t correspond to initial values of NA. Once the sampler is running it will quickly forget the initial values so it doesn't really matter how you do it. – Matt Denwood Aug 01 '16 at 15:24
  • Thanks very much! I will use gen inits. – user3669725 Aug 01 '16 at 16:11
  • No problem. Unless there is something else you are unsure of, it is a good idea to accept the answer so that the question is marked as answered (plus I get some credit for that!). – Matt Denwood Aug 01 '16 at 20:05