Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated functions and arguments #774

Merged
merged 6 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -32,7 +32,7 @@
#' how to resolve convergence issues. Another clue might be large parameter
#' values, e.g. estimates (on the scale of the linear predictor) larger than
#' 10 in (non-identity link) generalized linear model *might* indicate
#' [complete separation](https://stats.oarc.ucla.edu/other/mult-pkg/faq/general/faqwhat-is-complete-or-quasi-complete-separation-in-logisticprobit-regression-and-how-do-we-deal-with-them/).

Check warning on line 35 in R/check_convergence.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/check_convergence.R,line=35,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 189 characters.

Check warning on line 35 in R/check_convergence.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/check_convergence.R,line=35,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 189 characters.
#' Complete separation can be addressed by regularization, e.g. penalized
#' regression or Bayesian regression with appropriate priors on the fixed effects.
#'
Expand Down Expand Up @@ -98,9 +98,10 @@


#' @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
Loading