Skip to content

Commit

Permalink
remove deprecated robust
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 19, 2024
1 parent 3fbe00f commit a7b97a5
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: parameters
Title: Processing of Model Parameters
Version: 0.23.0.1
Version: 0.23.0.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
4 changes: 2 additions & 2 deletions R/3_p_value.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ p_value.default <- function(model,
method <- "wald"
}

# robust standard errors with backward compatibility for `robust = TRUE`
if (!is.null(vcov) || isTRUE(dots[["robust"]])) {
# robust standard errors
if (!is.null(vcov)) {
method <- "robust"
}

Expand Down
4 changes: 2 additions & 2 deletions R/4_standard_error.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ standard_error.default <- function(model,
se <- .safe(sqrt(diag(do.call("vcov", fun_args))))
}

# vcov: character (with backward compatibility for `robust = TRUE`)
if (is.character(vcov) || isTRUE(dots[["robust"]])) {
# vcov: character
if (is.character(vcov)) {
.vcov <- insight::get_varcov(
model,
component = component,
Expand Down
3 changes: 1 addition & 2 deletions R/extract_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@

# ==== test statistic - fix values for robust vcov

# deprecated argument `robust = TRUE`
if (!is.null(vcov) || isTRUE(dots[["robust"]])) {
if (!is.null(vcov)) {
parameters$Statistic <- parameters$Estimate / parameters$SE
} else if (!is.null(statistic)) {
parameters <- merge(parameters, statistic, by = merge_by, sort = FALSE)
Expand Down
4 changes: 2 additions & 2 deletions R/methods_nestedLogit.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ standard_error.nestedLogit <- function(model,
se <- .safe(sqrt(diag(do.call("vcov", fun_args))))
}

# vcov: character (with backward compatibility for `robust = TRUE`)
if (is.character(vcov) || isTRUE(dots[["robust"]])) {
# vcov: character
if (is.character(vcov)) {
.vcov <- insight::get_varcov(
model,
component = component,
Expand Down
2 changes: 1 addition & 1 deletion R/p_value_kenward.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ p_value_kenward.lmerMod <- function(model, dof = NULL) {
if (is.null(se)) {
se <- se_kenward(model)$SE
}
} else if (!is.null(vcov) || isTRUE(list(...)[["robust"]])) {
} else if (!is.null(vcov)) {
se <- standard_error(model,
vcov = vcov,
vcov_args = vcov_args,
Expand Down
6 changes: 3 additions & 3 deletions R/standardize_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @param ... Arguments passed to or from other methods.
#'
#' @return A data frame with information on each parameter (see
#' [parameters_type()]), and various standardization coefficients
#' for the post-hoc methods (see [standardize_parameters()]) for the predictor
#' and the response.
#' [`parameters_type()`]), and various standardization coefficients
#' for the post-hoc methods (see [`standardize_parameters()`]) for the predictor
#' and the response.
#'
#' @family standardize
#'
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-model_parameters_robust.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ mtcars$am <- as.factor(mtcars$am)
model <- lm(mpg ~ wt * am + cyl + gear, data = mtcars)

test_that("model_parameters, robust", {
expect_warning(expect_warning(expect_warning(model_parameters(model, robust = TRUE))))
params <- model_parameters(model, vcov = "HC3")
robust_se <- unname(sqrt(diag(sandwich::vcovHC(model))))
expect_equal(params$SE, robust_se, tolerance = 1e-3)
Expand Down

0 comments on commit a7b97a5

Please sign in to comment.