florianhartig / DHARMa

Diagnostics for HierArchical Regession Models
http://florianhartig.github.io/DHARMa/
210 stars 22 forks source link

Censoring and truncation in DHARMa #120

Open florianhartig opened 5 years ago

florianhartig commented 5 years ago

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!

StaffanBetner commented 5 years ago

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 commented 5 years ago

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

florianhartig commented 5 years ago

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.

StaffanBetner commented 2 years ago

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