interval censoring

  • Hi there,

    I know there have been a few previous threads that have dealt with dinterval()
    related questions and interval censoring but I am still having a lot of
    trouble with it and am hoping I can get some help. I am building a state space
    movement model of a process in which depth evolves through time, with a mean
    of depth at the previous time step and precision tau, but is restricted above
    and below between limits that change at each time step. Here is a toy version
    of my model, using JAGS 2.2.0 on a Mac with rjags in R version 2.13.0


    d<- 5

    for (t in 1:(tmax-1)) {

    d.censored ~ dinterval(d,lim)

    d ~ dnorm(d, tau)



    toydata <- list(tmax=10, lim=cbind(c(4.5,4.5,4.5,4.5,4.5,4.5,4.5,4.5,4.5,4.5),
    c(5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5)), tau=0.001)

    toyinits <- list(d=c(5,5,5,5,5,5,5,5,5,5))

    toymod <- jags.model("toy model.R", data=toydata, inits=toyinits, n.chains=1)

    toysim <- coda.samples(model=toymod, variable.names=c("d"), n.iter=1000,

    sum.toysim <- summary(toysim)

    stat.toysim <- sum.toysim$statistics

    d.hat <- stat.toysim

    cbind(toydata$lim, d.hat, toydata$lim)


    d 4.5 5.0000000 5.5

    d 4.5 3.0532750 5.5

    d 4.5 1.5087444 5.5

    d 4.5 3.2765438 5.5

    d 4.5 1.9320928 5.5

    d 4.5 1.8039813 5.5

    d 4.5 0.4801251 5.5

    d 4.5 -0.2902337 5.5

    d 4.5 -0.3778212 5.5

    d 4.5 -0.3777181 5.5

    This model compiles and updates but as you can see above, it does not provide
    sensible estimates for variable d. Posterior estimates for depth (d.hat) are
    outside the limits I am providing the model with (lim) which suggests that no
    censoring is going on, and that I have not specified the model correctly for
    interval censoring. What I don't understand about dinterval() is:

    1) what values does the distribution actually return in this case? I know
    d.censored becomes an indicator variable, as is described in the manual, where
    X=0 when d<lim and X=2 when lim<=d<lim since I have two limits and M=2.

    2) how is d.censored then used by JAGS to inform the dnorm(d, tau) sampler
    that values that are inside or outside the limits should be censored?

    Many thanks in advance for any responses. Any advice would be very greatly

  • Martyn Plummer
    Martyn Plummer

    You have truncation here, not censoring, and should be using the T(,)

       d[1]<- 5
       for (t in 1:(tmax-1)) {
          d[t+1] ~ dnorm(d[t], tau)  T(lim[t+1,1], lim[t+1,2])