# \[Turing.jl\] Censored Values

**URL:** <https://discourse.julialang.org/t/turing-jl-censored-values/48990>\
**Category:** Probabilistic Programming\
**Created:** [October 25, 2020, 6:28pm UTC](https://discourse.julialang.org/t/turing-jl-censored-values/48990 "2020-10-25T18:28:33Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![joshualeond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joshualeond/32/230_2.png) [@joshualeond](https://discourse.julialang.org/u/joshualeond)\
**Post date:** [October 29, 2020, 1:38am UTC](https://discourse.julialang.org/t/turing-jl-censored-values/48990/14 "2020-10-29T01:38:46Z")

</div>

I played around with this a few months ago and had something working with the `logpdf`, the `logcdf`, and the `logccdf`. In the model function I brought in a variable named ‘censor’ related to what type of censoring (left/right). Something like this:

```julia
    for i = 1:length(years)
        if censor[i] == 0 # observed
            Turing.acclogp!(_varinfo, logpdf(Weibull(beta, eta), years[i]) * weights[i])
        elseif censor[i] == 1 # right censored
            Turing.acclogp!(_varinfo, logccdf(Weibull(beta, eta), years[i]) * weights[i])
        elseif censor[i] == -1 # left censored
            Turing.acclogp!(_varinfo, logcdf(Weibull(beta, eta), years[i]) * weights[i])
        end
    end

```

I’d check this blog post out for something similar with Stan:

[https://ermeel86.github.io/case\_studies/surv\_stan\_example.html](https://ermeel86.github.io/case_studies/surv_stan_example.html)

---

_[View the full topic](https://discourse.julialang.org/t/turing-jl-censored-values/48990)._
