Skip to content

performance 0.20.0

Latest

Choose a tag to compare

@strengejacke strengejacke released this 20 Nov 18:21
· 60 commits to main since this release
9b8503a

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 new null_model argument takes a null model that was already fitted, and
    passes it to r2() and icc().

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
    check does 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() and residuals() 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() and performance_mse(), and
    wrong R2 from r2_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 for nlme::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 for lm() are unchanged (#997).

  • Fixed issue in the overdispersion plot of check_model(), which showed wrong
    residuals for count models fitted with na.action = na.exclude to data with
    missing values.

  • Fixed issue in check_collinearity() for models from mgcv::gam(),
    mgcv::bam(), survival::survreg() and survival::coxph(), where VIFs were
    computed from the coefficients of other terms, and coxph() models lost
    their first term. Smooth terms are now named by their mgcv label.

  • check_model() now applies its defaults for type and detrend to more
    objects. These are rstanarm and brms models that can be converted to a
    frequentist model, and model_fit objects from package parsnip. They are
    also objects from simulate_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" and detrend = TRUE by 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, as car::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 are NA, with a warning.

  • check_collinearity() now uses only the location slopes of ordinal::clm()
    models with scale effects. Before, the VIF of a location slope also used the
    scale effect with the same name. For clm() models with scale or nominal
    effects, a message names the effects that the VIFs leave out.

  • check_collinearity() now works for VGAM::vglm() models with the
    sratio(), cratio(), acat(), and poissonff() 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 returned NULL with "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 with component = "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".