Skip to content

Commit

Permalink
Remove deprecated functions and arguments (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke authored Oct 22, 2024
1 parent c8c8120 commit 0aa3492
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 66 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: performance
Title: Assessment of Regression Models Performance
Version: 0.12.4.1
Version: 0.12.4.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down Expand Up @@ -95,7 +95,7 @@ Suggests:
cplm,
dagitty,
dbscan,
DHARMa,
DHARMa (>= 0.4.7),
estimatr,
fixest,
flextable,
Expand Down Expand Up @@ -129,7 +129,7 @@ Suggests:
nonnest2,
ordinal,
parallel,
parameters (>= 0.21.6),
parameters (>= 0.22.0),
patchwork,
pscl,
psych,
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ export(check_multimodal)
export(check_normality)
export(check_outliers)
export(check_overdispersion)
export(check_posterior_predictions)
export(check_predictions)
export(check_residuals)
export(check_singularity)
Expand Down Expand Up @@ -602,7 +601,6 @@ export(performance_rmse)
export(performance_roc)
export(performance_rse)
export(performance_score)
export(posterior_predictive_check)
export(print_html)
export(print_md)
export(r2)
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# performance 0.12.5

## Breaking changes

* Deprecated arguments and alias-function-names have been removed.

## Changes

* Increased accuracy for `check_convergence()` for *glmmTMB* models.

# performance 0.12.4

## Changes
Expand Down
5 changes: 3 additions & 2 deletions R/check_convergence.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ check_convergence.merMod <- function(x, tolerance = 0.001, ...) {


#' @export
check_convergence.glmmTMB <- function(x, ...) {
check_convergence.glmmTMB <- function(x, tolerance = 0.001, ...) {
# https://github.com/glmmTMB/glmmTMB/issues/275
isTRUE(x$sdr$pdHess)
# https://stackoverflow.com/q/79110546/2094622
isTRUE(all.equal(x$fit$convergence, 0, tolerance = tolerance)) && isTRUE(x$sdr$pdHess)
}


Expand Down
9 changes: 1 addition & 8 deletions R/check_heterogeneity_bias.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#' @param nested Logical, if `TRUE`, the data is treated as nested. If `FALSE`,
#' the data is treated as cross-classified. Only applies if `by` contains more
#' than one variable.
#' @param group Deprecated. Use `by` instead.
#'
#' @seealso
#' For further details, read the vignette
Expand All @@ -44,15 +43,9 @@
#' iris$ID <- sample(1:4, nrow(iris), replace = TRUE) # fake-ID
#' check_heterogeneity_bias(iris, select = c("Sepal.Length", "Petal.Length"), by = "ID")
#' @export
check_heterogeneity_bias <- function(x, select = NULL, by = NULL, nested = FALSE, group = NULL) {
check_heterogeneity_bias <- function(x, select = NULL, by = NULL, nested = FALSE) {
insight::check_if_installed("datawizard", minimum_version = "0.12.0")

## TODO: deprecate later
if (!is.null(group)) {
insight::format_warning("Argument `group` is deprecated and will be removed in a future release. Please use `by` instead.") # nolint
by <- group
}

if (insight::is_model(x)) {
by <- insight::find_random(x, split_nested = TRUE, flatten = TRUE)
if (is.null(by)) {
Expand Down
20 changes: 0 additions & 20 deletions R/check_predictions.R
Original file line number Diff line number Diff line change
Expand Up @@ -423,26 +423,6 @@ pp_check.glmmTMB <-
#' S3method(bayesplot::pp_check, BFBayesFactor)



# aliases --------------------------

#' @rdname check_predictions
#' @export
posterior_predictive_check <- function(object, ...) {
.Deprecated("check_predictions()")
check_predictions(object, ...)
}

#' @rdname check_predictions
#' @export
check_posterior_predictions <- function(object, ...) {
.Deprecated("check_predictions()")
check_predictions(object, ...)
}




# methods -----------------------


Expand Down
2 changes: 1 addition & 1 deletion R/performance_aicc.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' scale. To get back to the original scale, the likelihood of the model is
#' multiplied by the Jacobian/derivative of the transformation.
#'
#' In case it is not possible to return the corrected AIC value, a waring
#' In case it is not possible to return the corrected AIC value, a warning
#' is given that the corrected log-likelihood value could not be computed.
#'
#' @references
Expand Down
7 changes: 4 additions & 3 deletions R/simulate_residuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@
#' @export
simulate_residuals <- function(x, iterations = 250, ...) {
insight::check_if_installed("DHARMa")
# TODO (low priority): Note that DHARMa::simulateResiduals(x, ...) does its own checks for whether
# or not the model passed to it is supported, do we want to use this or do our
# own checks so we can supply our own error message?
# TODO (low priority): Note that DHARMa::simulateResiduals(x, ...) does its
# own checks for whether or not the model passed to it is supported, do we
# want to use this or do our own checks so we can supply our own error
# message?
if (iterations < 2) {
insight::format_error("`iterations` must be at least 2.")
}
Expand Down
10 changes: 1 addition & 9 deletions man/check_heterogeneity_bias.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions man/check_predictions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/performance_aicc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions tests/testthat/test-check_zeroinflation.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,22 @@ test_that("check_zeroinflation, glmmTMB nbinom", {
skip_if_not_installed("DHARMa")
skip_on_cran()

data(Salamanders, package = "glmmTMB")
m <- glmmTMB::glmmTMB(
count ~ spp + mined + (1 | site),
family = glmmTMB::nbinom1(),
data = Salamanders
)
set.seed(1234)
dat <- DHARMa::createData(sampleSize = 1000)
fit <- suppressWarnings(glmmTMB::glmmTMB(
observedResponse ~ Environment1 + (1 | group),
data = dat,
family = glmmTMB::nbinom1()
))
expect_equal(
check_zeroinflation(fit),
check_zeroinflation(m),
structure(
list(
predicted.zeros = 462,
observed.zeros = 482L,
ratio = 0.95850622406639,
predicted.zeros = 389,
observed.zeros = 387L,
ratio = 1.00635658914729,
tolerance = 0.1,
p.value = 0.776
p.value = 0.944
),
class = "check_zi"
),
Expand Down

0 comments on commit 0aa3492

Please sign in to comment.