Repository navigation
Changes
model_performance()for mixed models now fits the null model only once
when both R2 and ICC are requested, instead of once for each index. This
applies to non-Gaussian models, for which both indices need the null model.
A newnull_modelargument takes a null model that was already fitted, and
passes it tor2()andicc().
Bug fixes
-
Fixed the overdispersion plot for binomial models with grouped successes and
trials, including proportion responses with trial weights. -
Fix failing tests due to latest dbscan update.
-
check_model()no longer says that it cannot simulate residuals when
checkdoes not include the Q-Q plot, for example
check_model(model, check = "homogeneity")for a binomial model. -
Collinearity severity groups and plot data now use
GVIF^(1/df), including
transformed confidence limits, so multi-coefficient terms are not classified
using raw GVIFs and one-coefficient VIF cutoffs. Tables retain raw GVIFs. -
Fixed issue in
fitted()andresiduals()for BayesFactor models, which
returned wrong values for models with continuous predictors. The predictions
were shifted, because continuous predictors were not centered the way
BayesFactor centers them. This also gave wrong results in
check_heteroscedasticity(),check_normality(),
check_autocorrelation(),check_predictions(),binned_residuals(),
performance_rmse(),performance_mae()andperformance_mse(), and
wrong R2 fromr2_bayes()for models with an interaction between a
continuous predictor and a factor, or with random slopes. -
check_heteroscedasticity()now gives the same result whatever the units of
the response for mixed models (lme4, glmmTMB) and fornlme::lme()and
nlme::gls(). The squared residuals are now scaled by their mean, as in the
original Breusch-Pagan test, instead of by a residual variance derived from
insight::get_deviance(), which for these models is a likelihood-based
deviance. Results forlm()are unchanged (#997). -
Fixed issue in the overdispersion plot of
check_model(), which showed wrong
residuals for count models fitted withna.action = na.excludeto data with
missing values. -
Fixed issue in
check_collinearity()for models frommgcv::gam(),
mgcv::bam(),survival::survreg()andsurvival::coxph(), where VIFs were
computed from the coefficients of other terms, andcoxph()models lost
their first term. Smooth terms are now named by their mgcv label. -
check_model()now applies its defaults fortypeanddetrendto more
objects. These are rstanarm and brms models that can be converted to a
frequentist model, andmodel_fitobjects from package parsnip. They are
also objects fromsimulate_residuals()or package DHARMa. Models with a
binary, count, ordinal, categorical, or multinomial response thus get the
"discrete_interval"posterior predictive check. Q-Q plots of simulated
residuals are no longer detrended by default. Before, these objects always got
type = "density"anddetrend = TRUEby default. These objects also ignored
size_title, which is now passed on. -
check_collinearity()now computes the adjusted VIF (SE_factor) of each
term from its number of coefficients, ascar::vif()does. Before,
polynomial and spline terms and interaction terms got the square root of the
VIF, as did factors converted inside the formula when the model also had a
polynomial or spline term. The first factor in a model without intercept used
one coefficient less than it has. -
compare_performance()no longer returns wrong LOOIC weights for models fit
to different numbers of observations. Before, it recycled the pointwise LOO
values of the smaller model to the length of the larger one. Now all LOOIC
weights areNA, with a warning. -
check_collinearity()now uses only the location slopes ofordinal::clm()
models with scale effects. Before, the VIF of a location slope also used the
scale effect with the same name. Forclm()models with scale or nominal
effects, a message names the effects that the VIFs leave out. -
check_collinearity()now works forVGAM::vglm()models with the
sratio(),cratio(),acat(), andpoissonff()families. Before, it
failed with "'list' object cannot be coerced to type 'integer'" or gave VIFs
for the wrong terms. -
check_collinearity()now works for multinomial models from nnet,
brglm2, and mclogit with backticked variable names, such as
`my x`. Before, it returnedNULLwith "Could not extract model
terms". -
check_collinearity()now returns correct VIFs for the zero-inflation
component of glmmTMB models whose zero-inflation formula differs from the
conditional formula. Before, the zero-inflation terms used the term blocks of
the conditional formula, so rows were missing or had the VIF of another term.
For glmmTMB and pscl models, the zero-inflation component now keeps or
drops its intercept by its own formula, not by the conditional formula. If
the zero-inflation component gets no VIFs withcomponent = "all"and
verbose = TRUE, a message now says so. -
If
check_collinearity()has a message to give for a pscl model, for
example for a count formula with one term, it no longer fails with "promise
already under evaluation".