DHARMa icon indicating copy to clipboard operation
DHARMa copied to clipboard

Censoring and truncation in DHARMa

Open florianhartig opened this issue 4 years ago • 4 comments

From https://twitter.com/staffanbetner/status/1166821587171074049

How to handle censored response (discrete/cont.) with randomized quantile residuals? I'm a bit uncertain whether the property of uniformly distributed residuals holds if we both randomize at the Y part, as well at the cdf part. Although I suspect it might hold under random censoring (which is a very interesting concept if we consider interval censoring at a distribution with domain from -inf to inf)

I think truncation and censoring shouldn't be a problem as long as the data simulation is exactly mimicking this process. In case of censoring, you will probably have to randomize (in DHARMa -> integer = T). See also https://github.com/florianhartig/DHARMa/issues/101

Keeping this open as a reminder to add an example / test this out!

florianhartig avatar Aug 29 '19 08:08 florianhartig

Copying my last comment from Twitter:

Well, I thought about this for a bit and realized that the only thing that is adjusted is that the range of where on the uniform interval the sampling occurs! (and that it occurs at all with censored continuous response). Truncation is a different beast, since the distribution is different, so sampling from that wouldn't be any trouble.

StaffanBetner avatar Aug 29 '19 15:08 StaffanBetner

I think this is sort of the same approach as DHARMa uses? (The notation is a bit tricky to follow) https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6133273

StaffanBetner avatar Sep 11 '19 16:09 StaffanBetner

Hi Staffan,

thanks for the link, interesting! Skimming the paper, it seemed to me that this (conditional) surrogate distribution they use is somehow different to the DHARMa approach where the distribution is always the ecdf of the simulated data, but I would have to read this more thoroughly. If you have more insights on this feel free to comment.

florianhartig avatar Sep 12 '19 11:09 florianhartig

This is one approach to this for models fitted via MCMC methods but easy to extend to models fitted via MLE. https://mjskay.github.io/tidybayes/articles/tidybayes-residuals.html

StaffanBetner avatar Nov 25 '21 15:11 StaffanBetner