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:
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