diff --git a/DESCRIPTION b/DESCRIPTION index b15bdafd1..f1e75b4df 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: performance Title: Assessment of Regression Models Performance -Version: 0.12.0.3 +Version: 0.12.0.4 Authors@R: c(person(given = "Daniel", family = "Lüdecke", diff --git a/NEWS.md b/NEWS.md index 8aecc62b2..d032d4e00 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,9 @@ approximation method for the distribution-specific (residual) variance. See Nakagawa et al. 2017 for details. +* `icc()` and `r2_nakagawa()` get a `model_component` argument indicating the + component for zero-inflation or hurdle models. + # performance 0.12.0 ## Breaking diff --git a/R/icc.R b/R/icc.R index bb5d228a6..586961c8c 100644 --- a/R/icc.R +++ b/R/icc.R @@ -178,6 +178,7 @@ icc <- function(model, ci_method = NULL, null_model = NULL, approximation = "lognormal", + model_component = NULL, verbose = TRUE, ...) { # special handling for smicd::semLme() @@ -210,7 +211,8 @@ icc <- function(model, model, tolerance = tolerance, null_model = null_model, - approximation = approximation + approximation = approximation, + model_component = model_component ) # return if ICC couldn't be computed @@ -545,6 +547,7 @@ print.icc_decomposed <- function(x, digits = 2, ...) { name_fun = "icc()", name_full = "ICC", null_model = NULL, + model_component = NULL, approximation = "lognormal", verbose = TRUE) { vars <- tryCatch( @@ -554,6 +557,7 @@ print.icc_decomposed <- function(x, digits = 2, ...) { tolerance = tolerance, null_model = null_model, approximation = approximation, + model_component = model_component, verbose = verbose ), error = function(e) { diff --git a/R/r2_nakagawa.R b/R/r2_nakagawa.R index 337d64142..8cae5f38a 100644 --- a/R/r2_nakagawa.R +++ b/R/r2_nakagawa.R @@ -85,6 +85,7 @@ r2_nakagawa <- function(model, ci_method = NULL, null_model = NULL, approximation = "lognormal", + model_component = NULL, verbose = TRUE, ...) { # calculate random effect variances @@ -95,7 +96,8 @@ r2_nakagawa <- function(model, null_model = null_model, approximation = approximation, name_fun = "r2()", - name_full = "r-squared" + name_full = "r-squared", + model_component = model_component ) # return if R2 couldn't be computed diff --git a/man/icc.Rd b/man/icc.Rd index 23254874f..9fb71e33d 100644 --- a/man/icc.Rd +++ b/man/icc.Rd @@ -14,6 +14,7 @@ icc( ci_method = NULL, null_model = NULL, approximation = "lognormal", + model_component = NULL, verbose = TRUE, ... ) @@ -63,6 +64,11 @@ applies to non-Gaussian models. Can be \code{"lognormal"} (default), \code{"delt specific variance, however, it can also be \code{"observation_level"}. See \emph{Nakagawa et al. 2017}, in particular supplement 2, for details.} +\item{model_component}{For models that can have a zero-inflation component, +specify for which component variances should be returned. If \code{NULL} or \code{"full"} +(the default), both the conditional and the zero-inflation component are taken +into account. If \code{"conditional"}, only the conditional component is considered.} + \item{verbose}{Toggle warnings and messages.} \item{...}{Arguments passed down to \code{brms::posterior_predict()}.} diff --git a/man/r2_nakagawa.Rd b/man/r2_nakagawa.Rd index 34ec42a1b..6b1963285 100644 --- a/man/r2_nakagawa.Rd +++ b/man/r2_nakagawa.Rd @@ -13,6 +13,7 @@ r2_nakagawa( ci_method = NULL, null_model = NULL, approximation = "lognormal", + model_component = NULL, verbose = TRUE, ... ) @@ -62,6 +63,11 @@ applies to non-Gaussian models. Can be \code{"lognormal"} (default), \code{"delt specific variance, however, it can also be \code{"observation_level"}. See \emph{Nakagawa et al. 2017}, in particular supplement 2, for details.} +\item{model_component}{For models that can have a zero-inflation component, +specify for which component variances should be returned. If \code{NULL} or \code{"full"} +(the default), both the conditional and the zero-inflation component are taken +into account. If \code{"conditional"}, only the conditional component is considered.} + \item{verbose}{Toggle warnings and messages.} \item{...}{Arguments passed down to \code{brms::posterior_predict()}.}