diff --git a/DESCRIPTION b/DESCRIPTION index 55f108388..58d92d257 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -168,3 +168,4 @@ Config/Needs/website: r-lib/pkgdown, easystats/easystatstemplate Config/rcmdcheck/ignore-inconsequential-notes: true +Remotes: easystats/insight, easystats/modelbased diff --git a/NEWS.md b/NEWS.md index efaec9d14..838ee9900 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,31 +1,26 @@ -# performance 0.16.0.3 - -## Bug fixes - -* Fixed issue in `check_collinearity()` that was causing inflated VIF values - when applied to clm and clmm models from the ordinal package. - -# performance 0.16.0.2 +# performance (devel) ## Changes -* `test_likelihoodratio()` now has a new 'Criterion' column containing the +* `test_likelihoodratio()` now has a new 'Criterion' column containing the -2 * log-likelihood (-2LL) value for each model. -## Bug fixes - -* Fixed issue in `test_likelihoodratio_ListLavaan()` that was extracting the - absolute model fit (Chisq) from the lavTestLRT output instead of the actual - LRT test statistic (Chisq diff). - -# performance 0.16.0.1 - -## Changes +* Added more details to the troubleshooting section to the documentation of + `check_model()`. * `check_predictions()` for Bayesian models now uses `modelbased::estimate_prediction()` and returns posterior predictive data in the same format as for other supported models. +## Bug fixes + +* Fixed issue in `check_collinearity()` that was causing inflated VIF values + when applied to clm and clmm models from the ordinal package. + +* Fixed issue in `test_likelihoodratio_ListLavaan()` that was extracting the + absolute model fit (Chisq) from the lavTestLRT output instead of the actual + LRT test statistic (Chisq diff). + # performance 0.16.0 ## Breaking Changes diff --git a/R/check_model.R b/R/check_model.R index 5ff13b21a..20f42ea55 100644 --- a/R/check_model.R +++ b/R/check_model.R @@ -181,6 +181,31 @@ #' If `check_model()` doesn't work as expected, try setting `verbose = TRUE` to #' get hints about possible problems. #' +#' If your plots are not rendering correctly in your IDE or you receive an error +#' stating that the viewport is too small, try the following steps to resolve +#' the issue: +#' +#' - *Enlarge the plotting window:* The most common cause is that the plotting +#' pane is simply too small. If you are using RStudio, click and drag the +#' edges of the 'Plots' pane to increase its dimensions, then try plotting +#' again. +#' - *Reset your IDE zoom settings:* If resizing the window doesn't help, your +#' IDE's zoom level might be causing scaling issues. In RStudio, navigate to +#' the menu bar and select *View > Actual Size* to reset the zoom. If you are +#' using a different IDE, look for a similar zoom reset option. +#' - *Adjust Windows display scaling:* On Windows, system-wide display scaling can +#' sometimes interfere with graphical outputs in R. You can adjust this in +#' your system settings: Go to *Start > Settings > System > Display* and locate +#' the `"Scale and layout"` section. Try reducing the scaling percentage (e.g., +#' to 100%) and restart your IDE. +#' - *Decrease the base font size:* As a code-level workaround, you can reduce the +#' base font size of your plots to help them fit into smaller viewports. If +#' you are using `{ggplot2}`, load the library and adjust your theme before +#' plotting. For example: `theme_set(theme_classic(base_size = 6))`. +#' - *Update relevant packages:* Finally, ensure your graphics and layout packages +#' are up to date. You can update your packages (paying special attention to +#' `{ggplot2}` and `{patchwork}`) by running `update.packages(ask = FALSE)`. +#' #' @family functions to check model assumptions and and assess model quality #' #' @examplesIf require("lme4") && FALSE diff --git a/man/check_model.Rd b/man/check_model.Rd index 4c4ab1688..147555d9a 100644 --- a/man/check_model.Rd +++ b/man/check_model.Rd @@ -260,6 +260,32 @@ skipped, which also increases performance. If \code{check_model()} doesn't work as expected, try setting \code{verbose = TRUE} to get hints about possible problems. + +If your plots are not rendering correctly in your IDE or you receive an error +stating that the viewport is too small, try the following steps to resolve +the issue: +\itemize{ +\item \emph{Enlarge the plotting window:} The most common cause is that the plotting +pane is simply too small. If you are using RStudio, click and drag the +edges of the 'Plots' pane to increase its dimensions, then try plotting +again. +\item \emph{Reset your IDE zoom settings:} If resizing the window doesn't help, your +IDE's zoom level might be causing scaling issues. In RStudio, navigate to +the menu bar and select \emph{View > Actual Size} to reset the zoom. If you are +using a different IDE, look for a similar zoom reset option. +\item \emph{Adjust Windows display scaling:} On Windows, system-wide display scaling can +sometimes interfere with graphical outputs in R. You can adjust this in +your system settings: Go to \emph{Start > Settings > System > Display} and locate +the \code{"Scale and layout"} section. Try reducing the scaling percentage (e.g., +to 100\%) and restart your IDE. +\item \emph{Decrease the base font size:} As a code-level workaround, you can reduce the +base font size of your plots to help them fit into smaller viewports. If +you are using \code{{ggplot2}}, load the library and adjust your theme before +plotting. For example: \code{theme_set(theme_classic(base_size = 6))}. +\item \emph{Update relevant packages:} Finally, ensure your graphics and layout packages +are up to date. You can update your packages (paying special attention to +\code{{ggplot2}} and \code{{patchwork}}) by running \code{update.packages(ask = FALSE)}. +} } \examples{ diff --git a/tests/testthat/test-check_homogeneity.R b/tests/testthat/test-check_homogeneity.R index 3fbb36d9b..3c5bc9c74 100644 --- a/tests/testthat/test-check_homogeneity.R +++ b/tests/testthat/test-check_homogeneity.R @@ -1,5 +1,6 @@ - test_that("check_homogeneity | levene", { + skip_if_not_installed("car") + data("mtcars") mtcars$am_f <- factor(mtcars$am) mtcars$cyl_f <- factor(mtcars$cyl) diff --git a/tests/testthat/test-check_predictions.R b/tests/testthat/test-check_predictions.R index ca07a5119..64080743d 100644 --- a/tests/testthat/test-check_predictions.R +++ b/tests/testthat/test-check_predictions.R @@ -476,27 +476,32 @@ test_that("check_predictions, Bayesian models use standard predictive-check data expect_identical(attr(out, "type"), "density") }) - -test_that("check_predictions, Bayesian discrete models use standard predictive-check data", { - skip_if_not_installed("modelbased", minimum_version = "0.12.0") - skip_if_not_installed("curl") - skip_if_not_installed("httr2") - skip_if_offline() - - model <- insight::download_model("brms_ordinal_1") - skip_if(is.null(model)) - - data(mtcars) - mtcars$cyl_ord <- as.ordered(mtcars$cyl) - - set.seed(123) - out <- check_predictions(model, iterations = 5, type = "discrete_interval") - - expect_s3_class(out, "performance_pp_check") - expect_named(out, c(paste0("sim_", 1:5), "y")) - expect_false("x" %in% names(out)) - expect_false("Group" %in% names(out)) - expect_false(isTRUE(attr(out, "is_stan"))) - expect_identical(attr(out, "type"), "discrete_interval") - expect_true(attr(out, "model_info")$is_ordinal) -}) +skip_if_not_installed("withr") +withr::with_environment( + new.env(), + { + test_that("check_predictions, Bayesian discrete models use standard predictive-check data", { + skip_if_not_installed("modelbased", minimum_version = "0.12.0") + skip_if_not_installed("curl") + skip_if_not_installed("httr2") + skip_if_offline() + + model <- insight::download_model("brms_ordinal_1") + skip_if(is.null(model)) + + data(mtcars) + mtcars$cyl_ord <- as.ordered(mtcars$cyl) + + set.seed(123) + out <- check_predictions(model, iterations = 5, type = "discrete_interval") + + expect_s3_class(out, "performance_pp_check") + expect_named(out, c(paste0("sim_", 1:5), "y")) + expect_false("x" %in% names(out)) + expect_false("Group" %in% names(out)) + expect_false(isTRUE(attr(out, "is_stan"))) + expect_identical(attr(out, "type"), "discrete_interval") + expect_true(attr(out, "model_info")$is_ordinal) + }) + } +) diff --git a/tests/testthat/test-glmmPQL.R b/tests/testthat/test-glmmPQL.R index 3172179fa..033aaa801 100644 --- a/tests/testthat/test-glmmPQL.R +++ b/tests/testthat/test-glmmPQL.R @@ -1,4 +1,6 @@ skip_if_not_installed("MASS") +skip_if_not_installed("reformulas") + test_that("r2", { example_dat <- data.frame( prop = c(0.2, 0.2, 0.5, 0.7, 0.1, 1, 1, 1, 0.1), diff --git a/tests/testthat/test-r2_mcfadden.R b/tests/testthat/test-r2_mcfadden.R index 4607375cf..7456127a8 100644 --- a/tests/testthat/test-r2_mcfadden.R +++ b/tests/testthat/test-r2_mcfadden.R @@ -1,3 +1,5 @@ +skip_if_not_installed("withr") + test_that("r2_mcfadden", { skip_if_not_installed("MASS") withr::with_options( @@ -28,8 +30,6 @@ test_that("r2_mcfadden", { ) }) -skip_if_not_installed("withr") - withr::with_environment( new.env(), {