You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
binned_residuals() fails for models fitted with na.action = na.exclude #1038
binned_residuals() errors for a logistic regression fitted with na.action = na.exclude when a predictor has a missing value:
library(performance)
d<- transform(mtcars, x= replace(wt, 1, NA_real_))
m<- glm(am~x, data=d, family=binomial, na.action=na.exclude)
binned_residuals(m)
#> Error in binned_residuals(m): 'x' must be nonnegative and integer#> In addition: Warning message:#> In y0 - fitted_values :#> longer object length is not a multiple of shorter object length
The response still includes the excluded row, but the fitted values don't, so the two vectors have different lengths. With the default na.omit it works. check_model() calls binned_residuals() inside .safe(), so for these models the Binned Residuals panel just goes missing without a message. The package's tests already use na.exclude with glm fits in check_model() (test-check_model.R, the overdispersion tests).
Activity