jacob-long / jtools

Tools for summarizing/visualizing regressions and other helpful stuff
https://jtools.jacob-long.com
GNU General Public License v3.0
164 stars 22 forks source link

glmmTMB and partial residuals - work around? #115

Closed elliotjohnston closed 2 years ago

elliotjohnston commented 3 years ago

Hi Jacob,

I found your 'Visualizing regression model predictions' vignette really helpful in understanding how to shift raw data to account for the effect of covariates. I am working with the cat_plot function in the interactions package and trying to set partial.residuals = TRUE with a glmmTMB model. I have searched old issues here and I know this has been highlighted before, so I don't mean to rehash old topics. It appears that support has not since been added for glmmTMB models, given that I get the error: match.arg(type) : 'arg' should be one of “response”, “pearson”.

I am looking for any insights and/or code you could suggest for manually adjusting raw count data for the effect of two continuous covariates to plot alongside the visualization of a glmmTMB model (plotting categorical by categorical interaction). I don't have a good sense for what partial.residuals = TRUE is doing under the hood with other model types. I have written up a full post with sample code and graphs at: https://stats.stackexchange.com/questions/543996/shifting-raw-count-data-for-covariate-effects-in-glmmtmb. Even if you do not have the bandwidth for a full solution, any ideas on which direction to head would be very much appreciated!

-Elliot

lionel68 commented 2 years ago

The function fails because there is no method implemented for working residuals in glmmTMB object, I opened an issue at the glmmTMB github repo on this.

jacob-long commented 2 years ago

Okay, from what I can tell, @lionel68's issue being resolved over at glmmTMB has fixed the problem. If I'm wrong, please comment and I'll reopen the issue.