Skip to content

Commit

Permalink
parameters(): performance=TRUE arg as alias for summary
Browse files Browse the repository at this point in the history
Fixes #898
  • Loading branch information
strengejacke committed Oct 6, 2024
1 parent 9ee1a56 commit d4e043b
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 25 deletions.
8 changes: 5 additions & 3 deletions R/1_model_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,10 @@ parameters <- model_parameters
#' _Confidence intervals and approximation of degrees of freedom_ in
#' [`model_parameters()`] for further details. When `ci_method=NULL`, in most
#' cases `"wald"` is used then.
#' @param summary Logical, if `TRUE`, prints summary information about the
#' @param include_info Logical, if `TRUE`, prints summary information about the
#' model (model formula, number of observations, residual standard deviation
#' and more).
#' @param summary Deprecated, please use `info` instead.
#' @param keep Character containing a regular expression pattern that
#' describes the parameters that should be included (for `keep`) or excluded
#' (for `drop`) in the returned data frame. `keep` may also be a
Expand Down Expand Up @@ -567,6 +568,7 @@ model_parameters.default <- function(model,
exponentiate = FALSE,
p_adjust = NULL,
summary = getOption("parameters_summary", FALSE),
include_info = getOption("parameters_info", FALSE),
keep = NULL,
drop = NULL,
verbose = TRUE,
Expand Down Expand Up @@ -654,7 +656,7 @@ model_parameters.default <- function(model,
component = "conditional",
ci_method = NULL,
p_adjust = NULL,
summary = FALSE,
include_info = FALSE,
keep_parameters = NULL,
drop_parameters = NULL,
verbose = TRUE,
Expand Down Expand Up @@ -726,7 +728,7 @@ model_parameters.default <- function(model,
iterations,
ci_method = ci_method,
p_adjust = p_adjust,
summary = summary,
include_info = include_info,
verbose = verbose,
...
)
Expand Down
8 changes: 4 additions & 4 deletions R/extract_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
keep_parameters = NULL,
drop_parameters = NULL,
include_sigma = TRUE,
summary = FALSE,
include_info = FALSE,
vcov = NULL,
vcov_args = NULL,
...) {
Expand Down Expand Up @@ -301,7 +301,7 @@

# ==== add sigma and residual df

if (isTRUE(include_sigma) || isTRUE(summary)) {
if (isTRUE(include_sigma) || isTRUE(include_info)) {
parameters <- .add_sigma_residual_df(parameters, model)
}

Expand Down Expand Up @@ -424,7 +424,7 @@
keep_parameters = NULL,
drop_parameters = NULL,
include_sigma = FALSE,
summary = FALSE,
include_info = FALSE,
vcov = NULL,
vcov_args = NULL,
verbose = TRUE,
Expand Down Expand Up @@ -639,7 +639,7 @@


# add sigma
if (isTRUE(include_sigma) || isTRUE(summary)) {
if (isTRUE(include_sigma) || isTRUE(include_info)) {
parameters <- .add_sigma_residual_df(parameters, model)
}

Expand Down
2 changes: 1 addition & 1 deletion R/methods_car.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ model_parameters.deltaMethod <- function(model, p_adjust = NULL, verbose = TRUE,
iterations = NULL,
ci_method = "residual",
p_adjust = p_adjust,
summary = FALSE,
include_info = FALSE,
verbose = verbose
)
fun_args <- c(fun_args, dots)
Expand Down
3 changes: 2 additions & 1 deletion R/methods_cplm.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ model_parameters.zcpglm <- function(model,
keep = NULL,
drop = NULL,
summary = getOption("parameters_summary", FALSE),
include_info = getOption("parameters_info", FALSE),
verbose = TRUE,
...) {
component <- match.arg(component)
Expand Down Expand Up @@ -75,7 +76,7 @@ model_parameters.zcpglm <- function(model,
ci,
exponentiate,
p_adjust = p_adjust,
summary = summary,
include_info = include_info,
verbose = verbose,
...
)
Expand Down
10 changes: 9 additions & 1 deletion R/methods_emmeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,15 @@ model_parameters.emm_list <- function(model,
# exponentiate coefficients and SE/CI, if requested
params <- .exponentiate_parameters(params, model, exponentiate)

params <- .add_model_parameters_attributes(params, model, ci, exponentiate, p_adjust = p_adjust, verbose = verbose, ...)
params <- .add_model_parameters_attributes(
params,
model,
ci,
exponentiate,
p_adjust = p_adjust,
verbose = verbose,
...
)

attr(params, "object_name") <- insight::safe_deparse_symbol(substitute(model))
class(params) <- c("parameters_model", "see_parameters_model", class(params))
Expand Down
5 changes: 3 additions & 2 deletions R/methods_glmmTMB.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ model_parameters.glmmTMB <- function(model,
p_adjust = NULL,
wb_component = TRUE,
summary = getOption("parameters_mixed_summary", FALSE),
include_info = getOption("parameters_mixed_info", FALSE),
keep = NULL,
drop = NULL,
verbose = TRUE,
Expand Down Expand Up @@ -98,7 +99,7 @@ model_parameters.glmmTMB <- function(model,
keep_component_column = component != "conditional",
include_sigma = include_sigma,
wb_component = wb_component,
summary = summary
include_info = include_info
)
fun_args <- c(fun_args, dot_args)
params <- do.call(".extract_parameters_generic", fun_args)
Expand Down Expand Up @@ -236,7 +237,7 @@ model_parameters.glmmTMB <- function(model,
p_adjust = p_adjust,
verbose = verbose,
group_level = group_level,
summary = summary,
include_info = include_info,
wb_component = wb_component,
...
)
Expand Down
8 changes: 4 additions & 4 deletions R/utils_model_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
iterations = 1000,
ci_method = NULL,
p_adjust = NULL,
summary = FALSE,
include_info = FALSE,
verbose = TRUE,
group_level = FALSE,
wb_component = FALSE,
Expand Down Expand Up @@ -54,7 +54,7 @@
attr(params, "robust_vcov") <- isTRUE(list(...)$robust) || "vcov" %in% names(list(...))
attr(params, "ignore_group") <- isFALSE(group_level)
attr(params, "ran_pars") <- isFALSE(group_level)
attr(params, "show_summary") <- isTRUE(summary)
attr(params, "show_summary") <- isTRUE(include_info)
attr(params, "log_link") <- isTRUE(grepl("log", info$link_function, fixed = TRUE))
attr(params, "logit_link") <- isTRUE(identical(info$link_function, "logit"))

Expand All @@ -77,8 +77,8 @@
}


# for summaries, add R2
if (isTRUE(summary) && requireNamespace("performance", quietly = TRUE)) {
# for additional infos, add R2
if (isTRUE(include_info) && requireNamespace("performance", quietly = TRUE)) {
rsq <- .safe(suppressWarnings(performance::r2(model)))
attr(params, "r2") <- rsq
}
Expand Down
4 changes: 1 addition & 3 deletions man/model_parameters.averaging.Rd

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

6 changes: 5 additions & 1 deletion man/model_parameters.default.Rd

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

7 changes: 6 additions & 1 deletion man/model_parameters.merMod.Rd

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

4 changes: 1 addition & 3 deletions man/model_parameters.mlm.Rd

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

5 changes: 4 additions & 1 deletion man/model_parameters.zcpglm.Rd

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

0 comments on commit d4e043b

Please sign in to comment.