DHARMa icon indicating copy to clipboard operation
DHARMa copied to clipboard

Randomized quantile residuals for ordinal models

Open StaffanBetner opened this issue 4 years ago • 2 comments

I confused discussions I had with @florianhartig on Twitter and put this into wrong issue, when a new one would have been appropriate.

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

Anyway, I have found a dataset where the assumption of proportional odds is clearly violated. ordwarm2.dta from https://www3.nd.edu/~rwilliam/gologit2/ (with warm as response variable)

After some struggle I managed to create randomized quantile residuals with mgcv::ocat, but I can't figure out any clear way to distinguish predictors that violate the assumption. Although one way might be to plot residuals vs. predictor and facet_wrap the response categories and look at the extreme response categories to see whether the distributions deviates over the domain of the predictor.

One example of how this might look: (although I am uncertain whether this is a way that would show violation of the assumption)

Non-violated (according to Brant test): image

Violated (according to Brant test): image

Any ideas?

StaffanBetner avatar Sep 16 '19 16:09 StaffanBetner

Coming back to this a couple of years later. This function creates randomized quantile residuals for the ocat family in mgcv, i.e. ordered factor model. I think it is an ordered logit model. https://gist.github.com/StaffanBetner/6241c5b816a8a78b20bd300743b3a66d

StaffanBetner avatar Jul 05 '21 09:07 StaffanBetner

Thanks for this! It's on my list of to-do-things to look at multinomial / ordinal models, I just can't say how soon this will be!

florianhartig avatar Jul 05 '21 09:07 florianhartig