Skip to content

Commit

Permalink
reduce redundant warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Nov 22, 2024
1 parent 643b477 commit 7fc4b8f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions R/methods_hglm.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ model_parameters.hglm <- function(model,

# add dispersion model

has_dispersion <- !is.null(insight::find_formula(model)$dispersion)
has_dispersion <- !is.null(insight::find_formula(model, verbose = FALSE)$dispersion)
if (has_dispersion && component %in% c("all", "dispersion")) {
disp_params <- insight::get_parameters(model, effects = "fixed", component = "dispersion")
disp_se <- standard_error(model, effects = "fixed", component = "dispersion")
Expand Down Expand Up @@ -114,7 +114,7 @@ standard_error.hglm <- function(model,
effects <- match.arg(effects, choices = c("all", "fixed", "random"))
component <- match.arg(component, choices = c("all", "conditional", "dispersion"))

f <- insight::find_formula(model)
f <- insight::find_formula(model, verbose = FALSE)
if (component == "dispersion" && is.null(f$dispersion)) {
if (verbose) {
insight::format_alert("No standard errors found for model's dispersion parameters.")
Expand Down
4 changes: 2 additions & 2 deletions R/methods_systemfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ model_parameters.systemfit <- function(model,
#' @export
standard_error.systemfit <- function(model, ...) {
cf <- stats::coef(summary(model))
f <- insight::find_formula(model)
f <- insight::find_formula(model, verbose = FALSE)

system_names <- names(f)
parameter_names <- row.names(cf)
Expand All @@ -66,7 +66,7 @@ standard_error.systemfit <- function(model, ...) {
#' @export
p_value.systemfit <- function(model, ...) {
cf <- stats::coef(summary(model))
f <- insight::find_formula(model)
f <- insight::find_formula(model, verbose = FALSE)

system_names <- names(f)
parameter_names <- row.names(cf)
Expand Down
2 changes: 1 addition & 1 deletion R/pool_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,6 @@ pool_parameters <- function(x,
"Log-Odds"
}
# formula
attr(pooled_params, "model_formula") <- insight::find_formula(model)
attr(pooled_params, "model_formula") <- insight::find_formula(model, verbose = FALSE)
pooled_params
}
6 changes: 3 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

# Find log-terms inside model formula, and return "clean" term names
.log_terms <- function(model) {
x <- insight::find_terms(model, flatten = TRUE)
x <- insight::find_terms(model, flatten = TRUE, verbose = FALSE)
gsub("^log\\((.*)\\)", "\\1", grep("^log\\((.*)\\)", x, value = TRUE))
}

Expand Down Expand Up @@ -143,9 +143,9 @@
.find_factor_levels <- function(model_data, model = NULL, model_call = NULL) {
# check whether we have on-the-fly conversion of factors
if (!is.null(model)) {
model_terms <- insight::find_terms(model)
model_terms <- insight::find_terms(model, verbose = FALSE)
} else if (!is.null(model_call)) { # nolint
model_terms <- insight::find_terms(model_call)
model_terms <- insight::find_terms(model_call, verbose = FALSE)
} else {
model_terms <- NULL
}
Expand Down
4 changes: 2 additions & 2 deletions R/utils_model_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
# use tryCatch, these might fail...
attr(params, "test_statistic") <- .safe(insight::find_statistic(model))
attr(params, "log_response") <- .safe(isTRUE(grepl("log", insight::find_transformation(model), fixed = TRUE)))
attr(params, "log_predictors") <- .safe(any(grepl("log", unlist(insight::find_terms(model)[c("conditional", "zero_inflated", "instruments")]), fixed = TRUE))) # nolint
attr(params, "log_predictors") <- .safe(any(grepl("log", unlist(insight::find_terms(model, verbose = FALSE)[c("conditional", "zero_inflated", "instruments")]), fixed = TRUE))) # nolint

# save if model is multivariate response model
if (isTRUE(info$is_multivariate)) {
Expand Down Expand Up @@ -107,7 +107,7 @@


# model formula
model_formula <- .safe(insight::safe_deparse(insight::find_formula(model)$conditional))
model_formula <- .safe(insight::safe_deparse(insight::find_formula(model, verbose = FALSE)$conditional)) # nolint
attr(params, "model_formula") <- model_formula


Expand Down

0 comments on commit 7fc4b8f

Please sign in to comment.