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

More args for font size in check_model #703

Merged
merged 3 commits into from
Mar 27, 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
2 changes: 1 addition & 1 deletion 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.11.0.1
Version: 0.11.0.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
85 changes: 49 additions & 36 deletions R/check_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#'
#' @param x A model object.
#' @param dot_size,line_size Size of line and dot-geoms.
#' @param base_size Base font size for plots.
#' @param base_size,title_size,axis_title_size Base font size for axis and plot titles.
#' @param panel Logical, if `TRUE`, plots are arranged as panels; else,
#' single plots for each diagnostic are returned.
#' @param check Character vector, indicating which checks for should be performed
Expand Down Expand Up @@ -60,7 +60,7 @@
#'
#' @details For Bayesian models from packages **rstanarm** or **brms**,
#' models will be "converted" to their frequentist counterpart, using
#' [`bayestestR::bayesian_as_frequentist`](https://easystats.github.io/bayestestR/reference/convert_bayesian_as_frequentist.html).

Check warning on line 63 in R/check_model.R

View workflow job for this annotation

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

file=R/check_model.R,line=63,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 130 characters.
#' A more advanced model-check for Bayesian models will be implemented at a
#' later stage.
#'
Expand Down Expand Up @@ -88,7 +88,7 @@
#' plots are helpful to check model assumptions, they do not necessarily indicate
#' so-called "lack of fit", e.g. missed non-linear relationships or interactions.
#' Thus, it is always recommended to also look at
#' [effect plots, including partial residuals](https://strengejacke.github.io/ggeffects/articles/introduction_partial_residuals.html).

Check warning on line 91 in R/check_model.R

View workflow job for this annotation

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

file=R/check_model.R,line=91,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 134 characters.
#'
#' @section Homogeneity of Variance:
#' This plot checks the assumption of equal variance (homoscedasticity). The
Expand Down Expand Up @@ -184,20 +184,22 @@
#' @rdname check_model
#' @export
check_model.default <- function(x,
dot_size = 2,
line_size = 0.8,
panel = TRUE,
check = "all",
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
theme = "see::theme_lucid",
base_size = 10,
detrend = TRUE,
show_dots = NULL,
bandwidth = "nrd",
type = "density",
residual_type = NULL,
show_dots = NULL,
dot_size = 2,
line_size = 0.8,
title_size = 12,
axis_title_size = base_size,
base_size = 10,
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
theme = "see::theme_lucid",
verbose = FALSE,
...) {
# check model formula
Expand Down Expand Up @@ -264,6 +266,8 @@
attr(assumptions_data, "dot_size") <- dot_size
attr(assumptions_data, "line_size") <- line_size
attr(assumptions_data, "base_size") <- base_size
attr(assumptions_data, "axis_title_size") <- axis_title_size
attr(assumptions_data, "title_size") <- title_size
attr(assumptions_data, "check") <- check
attr(assumptions_data, "alpha") <- alpha
attr(assumptions_data, "dot_alpha") <- dot_alpha
Expand Down Expand Up @@ -303,21 +307,23 @@

#' @export
check_model.stanreg <- function(x,
dot_size = 2,
line_size = 0.8,
panel = TRUE,
check = "all",
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
theme = "see::theme_lucid",
base_size = 10,
detrend = TRUE,
show_dots = NULL,
bandwidth = "nrd",
type = "density",
residual_type = NULL,
verbose = TRUE,
show_dots = NULL,
dot_size = 2,
line_size = 0.8,
title_size = 12,
axis_title_size = base_size,
base_size = 10,
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
theme = "see::theme_lucid",
verbose = FALSE,
...) {
check_model(bayestestR::bayesian_as_frequentist(x),
dot_size = dot_size,
Expand All @@ -329,6 +335,7 @@
colors = colors,
theme = theme,
base_size = base_size,
axis_title_size = axis_title_size,

Check warning on line 338 in R/check_model.R

View check run for this annotation

Codecov / codecov/patch

R/check_model.R#L338

Added line #L338 was not covered by tests
detrend = detrend,
show_dots = show_dots,
bandwidth = bandwidth,
Expand All @@ -346,21 +353,23 @@

#' @export
check_model.model_fit <- function(x,
dot_size = 2,
line_size = 0.8,
panel = TRUE,
check = "all",
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
theme = "see::theme_lucid",
base_size = 10,
detrend = TRUE,
show_dots = NULL,
bandwidth = "nrd",
type = "density",
residual_type = NULL,
verbose = TRUE,
show_dots = NULL,
dot_size = 2,
line_size = 0.8,
title_size = 12,
axis_title_size = base_size,
base_size = 10,
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
theme = "see::theme_lucid",
verbose = FALSE,
...) {
check_model(
x$fit,
Expand All @@ -369,6 +378,7 @@
panel = panel,
check = check,
alpha = alpha,
axis_title_size = axis_title_size,

Check warning on line 381 in R/check_model.R

View check run for this annotation

Codecov / codecov/patch

R/check_model.R#L381

Added line #L381 was not covered by tests
dot_alpha = dot_alpha,
colors = colors,
theme = theme,
Expand All @@ -386,21 +396,23 @@

#' @export
check_model.performance_simres <- function(x,
dot_size = 2,
line_size = 0.8,
panel = TRUE,
check = "all",
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
theme = "see::theme_lucid",
base_size = 10,
detrend = TRUE,
show_dots = NULL,
bandwidth = "nrd",
type = "density",
residual_type = NULL,
verbose = TRUE,
show_dots = NULL,
dot_size = 2,
line_size = 0.8,
title_size = 12,
axis_title_size = base_size,
base_size = 10,
alpha = 0.2,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8", "#cd201f"),
theme = "see::theme_lucid",
verbose = FALSE,
...) {
check_model(
x$fittedModel,
Expand All @@ -410,6 +422,7 @@
check = check,
alpha = alpha,
dot_alpha = dot_alpha,
axis_title_size = axis_title_size,

Check warning on line 425 in R/check_model.R

View check run for this annotation

Codecov / codecov/patch

R/check_model.R#L425

Added line #L425 was not covered by tests
colors = colors,
theme = theme,
base_size = base_size,
Expand Down
58 changes: 30 additions & 28 deletions man/check_model.Rd

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

Loading