From 98f2f6ab40b0cadf42145ce44a9a5d98cff584de Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 2 Jan 2025 13:07:01 +0100 Subject: [PATCH] styler --- R/check_autocorrelation.R | 2 -- R/check_clusterstructure.R | 3 --- R/check_collinearity.R | 9 ------- R/check_concurvity.R | 1 - R/check_distribution.R | 5 ---- R/check_factorstructure.R | 7 ------ R/check_heterogeneity_bias.R | 2 -- R/check_heteroscedasticity.R | 2 -- R/check_homogeneity.R | 3 --- R/check_htest.R | 1 - R/check_itemscale.R | 1 - R/check_model.R | 5 ---- R/check_model_diagnostics.R | 8 ------- R/check_multimodal.R | 1 - R/check_normality.R | 3 --- R/check_outliers.R | 19 +-------------- R/check_overdispersion.R | 3 --- R/check_predictions.R | 2 -- R/check_singularity.R | 6 ----- R/check_sphericity.R | 3 --- R/compare_performance.R | 2 -- R/cronbachs_alpha.R | 3 --- R/icc.R | 3 --- R/item_difficulty.R | 1 - R/looic.R | 1 - R/model_performance.R | 1 - R/model_performance.bayesian.R | 1 - R/model_performance.lavaan.R | 1 - R/model_performance.lm.R | 5 ---- R/model_performance.mixed.R | 1 - R/model_performance_default.R | 1 - R/performance_accuracy.R | 1 - R/performance_aicc.R | 2 -- R/performance_hosmer.R | 1 - R/performance_logloss.R | 1 - R/performance_mae.R | 3 --- R/performance_mse.R | 3 --- R/performance_pcp.R | 2 -- R/performance_roc.R | 4 ---- R/performance_score.R | 3 --- R/print-methods.R | 5 ---- R/r2.R | 30 ------------------------ R/r2_bayes.R | 3 --- R/r2_coxsnell.R | 5 ---- R/r2_loo.R | 1 - R/r2_mcfadden.R | 11 --------- R/r2_nagelkerke.R | 9 ------- R/r2_nakagawa.R | 2 -- R/test_bf.R | 2 -- R/test_likelihoodratio.R | 2 -- R/test_performance.R | 7 ------ R/test_vuong.R | 10 -------- R/test_wald.R | 1 - tests/testthat/test-check_collinearity.R | 5 ++-- tests/testthat/test-pkg-fixest.R | 1 - tests/testthat/test-r2_mcfadden.R | 4 ++-- 56 files changed, 5 insertions(+), 219 deletions(-) diff --git a/R/check_autocorrelation.R b/R/check_autocorrelation.R index 159f53843..d94f788f1 100644 --- a/R/check_autocorrelation.R +++ b/R/check_autocorrelation.R @@ -49,7 +49,6 @@ check_autocorrelation.default <- function(x, nsim = 1000, ...) { } - # methods ------------------------------ #' @export @@ -81,7 +80,6 @@ print.check_autocorrelation <- function(x, ...) { } - # utilities ------------------------------- .durbWats <- function(.residuals) { diff --git a/R/check_clusterstructure.R b/R/check_clusterstructure.R index 9d4bab2d6..fd275cf5d 100644 --- a/R/check_clusterstructure.R +++ b/R/check_clusterstructure.R @@ -75,7 +75,6 @@ check_clusterstructure <- function(x, } - #' @export plot.check_clusterstructure <- function(x, ...) { # Can be reimplemented with ggplot in see @@ -88,7 +87,6 @@ plot.check_clusterstructure <- function(x, ...) { } - #' @keywords internal .clusterstructure_dm <- function(x, distance = "euclidean", method = "ward.D2") { d <- stats::dist(x, method = distance) @@ -97,7 +95,6 @@ plot.check_clusterstructure <- function(x, ...) { } - #' @keywords internal .clusterstructure_hopkins <- function(x, distance = "euclidean") { # This is based on the hopkins() function from the clustertend package diff --git a/R/check_collinearity.R b/R/check_collinearity.R index b5019c5c3..6d34c6afa 100644 --- a/R/check_collinearity.R +++ b/R/check_collinearity.R @@ -148,7 +148,6 @@ check_collinearity <- function(x, ...) { multicollinearity <- check_collinearity - # default ------------------------------ #' @rdname check_collinearity @@ -159,7 +158,6 @@ check_collinearity.default <- function(x, ci = 0.95, verbose = TRUE, ...) { } - # methods ------------------------------------------- #' @export @@ -227,7 +225,6 @@ plot.check_collinearity <- function(x, ...) { } - # other classes ---------------------------------- #' @export @@ -303,7 +300,6 @@ check_collinearity.betaor <- check_collinearity.logitor check_collinearity.betamfx <- check_collinearity.logitor - # zi-models ------------------------------------- #' @rdname check_collinearity @@ -362,7 +358,6 @@ check_collinearity.zerocount <- function(x, } - # utilities --------------------------------- .check_collinearity_zi_model <- function(x, component, ci = 0.95, verbose = TRUE) { @@ -412,7 +407,6 @@ check_collinearity.zerocount <- function(x, } - .check_collinearity <- function(x, component, ci = 0.95, verbose = TRUE) { v <- .safe(insight::get_varcov(x, component = component, verbose = FALSE)) @@ -586,7 +580,6 @@ check_collinearity.zerocount <- function(x, } - .term_assignments <- function(x, component, verbose = TRUE) { tryCatch( { @@ -622,7 +615,6 @@ check_collinearity.zerocount <- function(x, } - .find_term_assignment <- function(x, component, verbose = TRUE) { pred <- insight::find_predictors(x)[[component]] @@ -657,7 +649,6 @@ check_collinearity.zerocount <- function(x, } - .zi_term_assignment <- function(x, component = "zero_inflated", verbose = TRUE) { tryCatch( { diff --git a/R/check_concurvity.R b/R/check_concurvity.R index a72ba680d..d508bc8b1 100644 --- a/R/check_concurvity.R +++ b/R/check_concurvity.R @@ -25,7 +25,6 @@ check_concurvity.gam <- function(x, ...) { } - # methods --------------------------------- #' @export diff --git a/R/check_distribution.R b/R/check_distribution.R index d743b3ac1..9ab4d24de 100644 --- a/R/check_distribution.R +++ b/R/check_distribution.R @@ -61,7 +61,6 @@ check_distribution <- function(model) { } - # default ----------------------------- #' @export @@ -106,7 +105,6 @@ check_distribution.default <- function(model) { } - # methods -------------------------- #' @export @@ -160,7 +158,6 @@ plot.check_distribution_numeric <- function(x, ...) { } - # other classes ------------------- #' @export @@ -184,7 +181,6 @@ check_distribution.numeric <- function(model) { } - # utilities ----------------------------- .extract_features <- function(x, type = NULL) { @@ -243,7 +239,6 @@ check_distribution.numeric <- function(model) { } - .is_integer <- function(x) { tryCatch( ifelse(is.infinite(x), FALSE, x %% 1 == 0), diff --git a/R/check_factorstructure.R b/R/check_factorstructure.R index 21f4584c1..c7c323cbd 100644 --- a/R/check_factorstructure.R +++ b/R/check_factorstructure.R @@ -114,9 +114,6 @@ check_factorstructure <- function(x, n = NULL, ...) { } - - - #' @rdname check_factorstructure #' @export check_kmo <- function(x, n = NULL, ...) { @@ -169,9 +166,6 @@ check_kmo <- function(x, n = NULL, ...) { } - - - #' @rdname check_factorstructure #' @export check_sphericity_bartlett <- function(x, n = NULL, ...) { @@ -213,7 +207,6 @@ check_sphericity_bartlett <- function(x, n = NULL, ...) { } - # Helpers ----------------------------------------------------------------- #' @keywords internal diff --git a/R/check_heterogeneity_bias.R b/R/check_heterogeneity_bias.R index 2414873cc..ea7f1423b 100644 --- a/R/check_heterogeneity_bias.R +++ b/R/check_heterogeneity_bias.R @@ -102,8 +102,6 @@ check_heterogeneity_bias <- function(x, select = NULL, by = NULL, nested = FALSE } - - #' @export print.check_heterogeneity_bias <- function(x, ...) { cat("Possible heterogeneity bias due to following predictors: ") diff --git a/R/check_heteroscedasticity.R b/R/check_heteroscedasticity.R index 3fbefec9b..ad97d8871 100644 --- a/R/check_heteroscedasticity.R +++ b/R/check_heteroscedasticity.R @@ -79,7 +79,6 @@ check_heteroscedasticity.default <- function(x, ...) { } - # methods ----------------------- #' @export @@ -112,7 +111,6 @@ plot.check_heteroscedasticity <- function(x, ...) { } - # utilities ----------------------- .sigma <- function(x) { diff --git a/R/check_homogeneity.R b/R/check_homogeneity.R index d6b486810..43215da62 100644 --- a/R/check_homogeneity.R +++ b/R/check_homogeneity.R @@ -36,7 +36,6 @@ check_homogeneity <- function(x, method = c("bartlett", "fligner", "levene", "au } - # default ------------------------- #' @export @@ -105,7 +104,6 @@ check_homogeneity.default <- function(x, method = c("bartlett", "fligner", "leve } - # methods ----------------------- #' @export @@ -130,7 +128,6 @@ plot.check_homogeneity <- function(x, ...) { } - # other classes ----------------------------- #' @rdname check_homogeneity diff --git a/R/check_htest.R b/R/check_htest.R index f5d085839..4dadf3a7a 100644 --- a/R/check_htest.R +++ b/R/check_htest.R @@ -153,7 +153,6 @@ check_symmetry.htest <- function(x, ...) { # } - # Print ------------------------------------------------------------------- #' @export diff --git a/R/check_itemscale.R b/R/check_itemscale.R index 092ee0a3d..a7973ecfc 100644 --- a/R/check_itemscale.R +++ b/R/check_itemscale.R @@ -137,7 +137,6 @@ check_itemscale <- function(x, factor_index = NULL) { } - # methods ------------------------------------- #' @export diff --git a/R/check_model.R b/R/check_model.R index 11562a351..b096b0f25 100644 --- a/R/check_model.R +++ b/R/check_model.R @@ -183,7 +183,6 @@ check_model <- function(x, ...) { } - # default ---------------------------- #' @rdname check_model @@ -313,7 +312,6 @@ plot.check_model <- function(x, ...) { } - # other classes --------------------------- ## TODO for now, convert to freq, see https://github.com/easystats/performance/issues/354 @@ -454,7 +452,6 @@ check_model.performance_simres <- function(x, check_model.DHARMa <- check_model.performance_simres - # compile plots for checks of linear models ------------------------ .check_assumptions_linear <- function(model, model_info, check = "all", residual_type = "normal", verbose = TRUE, ...) { @@ -515,7 +512,6 @@ check_model.DHARMa <- check_model.performance_simres } - # compile plots for checks of generalized linear models ------------------------ .check_assumptions_glm <- function(model, model_info, check = "all", residual_type = "simulated", verbose = TRUE, ...) { @@ -576,7 +572,6 @@ check_model.DHARMa <- check_model.performance_simres } - # compile plots for checks of Bayesian models ------------------------ .check_assumptions_stan <- function(model, ...) { diff --git a/R/check_model_diagnostics.R b/R/check_model_diagnostics.R index df16f252c..f6dd7cde2 100644 --- a/R/check_model_diagnostics.R +++ b/R/check_model_diagnostics.R @@ -25,7 +25,6 @@ } - # prepare data for QQ plot ---------------------------------- .model_diagnostic_qq <- function(model, model_info = NULL, verbose = TRUE) { @@ -88,7 +87,6 @@ } - # prepare data for random effects QQ plot ---------------------------------- .model_diagnostic_ranef_qq <- function(model, level = 0.95, model_info = NULL, verbose = TRUE) { @@ -151,7 +149,6 @@ } - # prepare data for normality of residuals plot ---------------------------------- .model_diagnostic_normality <- function(model, verbose = TRUE) { @@ -171,7 +168,6 @@ } - # prepare data for influential obs plot ---------------------------------- .model_diagnostic_outlier <- function(model, threshold = NULL) { @@ -210,7 +206,6 @@ } - # prepare data for non-constant variance plot ---------------------------------- .model_diagnostic_ncv <- function(model, verbose = TRUE) { @@ -238,7 +233,6 @@ } - # prepare data for homogeneity of variance plot ---------------------------------- .model_diagnostic_homogeneity <- function(model, verbose = TRUE) { @@ -283,7 +277,6 @@ } - # prepare data for homogeneity of variance plot ---------------------------------- .new_diag_overdispersion <- function(model, ...) { @@ -359,7 +352,6 @@ } - .model_diagnostic_overdispersion <- function(model, ...) { faminfo <- insight::model_info(model) diff --git a/R/check_multimodal.R b/R/check_multimodal.R index b48a5831e..9d302c931 100644 --- a/R/check_multimodal.R +++ b/R/check_multimodal.R @@ -91,7 +91,6 @@ check_multimodal.data.frame <- function(x, ...) { } - #' @export check_multimodal.numeric <- function(x, ...) { insight::check_if_installed("multimode") diff --git a/R/check_normality.R b/R/check_normality.R index ffd4ba824..9dfcf9cbf 100644 --- a/R/check_normality.R +++ b/R/check_normality.R @@ -50,7 +50,6 @@ check_normality <- function(x, ...) { } - # default ------------------------- #' @export @@ -184,7 +183,6 @@ print.check_normality <- function(x, ...) { } - # other classes -------------------- # mixed models --------------------- @@ -276,7 +274,6 @@ check_normality.afex_aov <- function(x, ...) { check_normality.BFBayesFactor <- check_normality.afex_aov - # helper --------------------- .check_normality <- function(x, model, type = "residuals") { diff --git a/R/check_outliers.R b/R/check_outliers.R index 8770e12b3..91a9e491c 100644 --- a/R/check_outliers.R +++ b/R/check_outliers.R @@ -590,7 +590,6 @@ check_outliers.default <- function(x, } - # Methods ----------------------------------------------------------------- #' @export @@ -824,7 +823,6 @@ print.check_outliers_simres <- function(x, digits = 2, ...) { } - # other classes ------------------------- #' @rdname check_outliers @@ -843,7 +841,6 @@ check_outliers.numeric <- function(x, } - #' @rdname check_outliers #' @export check_outliers.data.frame <- function(x, @@ -901,7 +898,7 @@ check_outliers.data.frame <- function(x, # Keep only relevant threshold valid <- method - if("optics" %in% valid) { + if ("optics" %in% valid) { valid <- c(valid, "optics_xi") method <- c(method, "optics_xi") } @@ -1377,7 +1374,6 @@ check_outliers.BFBayesFactor <- function(x, } - #' @export check_outliers.gls <- function(x, method = "pareto", @@ -1514,7 +1510,6 @@ check_outliers.performance_simres <- function(x, type = "default", iterations = check_outliers.DHARMa <- check_outliers.performance_simres - # Thresholds -------------------------------------------------------------- .check_outliers_thresholds <- function(x) { @@ -1543,7 +1538,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - # utilities -------------------- .check_outliers_zscore <- function(x, @@ -1602,7 +1596,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - .check_outliers_iqr <- function(x, threshold = 1.7, method = "tukey", @@ -1654,7 +1647,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - .check_outliers_ci <- function(x, threshold = 1 - 0.001, method = "ci", @@ -1705,7 +1697,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - .check_outliers_cook <- function(x, threshold = NULL, ID.names = NULL) { @@ -1724,7 +1715,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - .check_outliers_pareto <- function(x, threshold = 0.7) { insight::check_if_installed("loo") @@ -1744,7 +1734,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - .check_outliers_mahalanobis <- function(x, threshold = stats::qchisq( p = 1 - 0.001, df = ncol(x) @@ -1774,7 +1763,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - # Bigutils not yet fully available on CRAN .check_outliers_mahalanobis_robust <- function(x, threshold = stats::qchisq( @@ -1805,7 +1793,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - .check_outliers_mcd <- function(x, threshold = stats::qchisq(p = 1 - 0.001, df = ncol(x)), percentage_central = 0.75, @@ -1849,7 +1836,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - .check_outliers_ics <- function(x, threshold = 0.001, ID.names = NULL, @@ -1927,7 +1913,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - .check_outliers_optics <- function(x, threshold = NULL, ID.names = NULL, @@ -1993,7 +1978,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres # } - .check_outliers_lof <- function(x, threshold = 0.001, ID.names = NULL) { @@ -2027,7 +2011,6 @@ check_outliers.DHARMa <- check_outliers.performance_simres } - # Non-supported model classes --------------------------------------- #' @export diff --git a/R/check_overdispersion.R b/R/check_overdispersion.R index fc8e25e32..557fa0c9a 100644 --- a/R/check_overdispersion.R +++ b/R/check_overdispersion.R @@ -72,7 +72,6 @@ check_overdispersion <- function(x, ...) { } - # default ----------------------- #' @export @@ -84,7 +83,6 @@ check_overdispersion.default <- function(x, ...) { } - # Methods ----------------------------- #' @export @@ -150,7 +148,6 @@ print.check_overdisp <- function(x, digits = 3, ...) { } - # Overdispersion for classical models ----------------------------- #' @export diff --git a/R/check_predictions.R b/R/check_predictions.R index d5b382fd6..0780e35ec 100644 --- a/R/check_predictions.R +++ b/R/check_predictions.R @@ -263,7 +263,6 @@ check_predictions.lme <- function(object, ...) { } - # pp-check functions ------------------------------------- pp_check.lm <- function(object, @@ -420,7 +419,6 @@ pp_check.glmmTMB <- # styler: on - #' @rawNamespace #' S3method(bayesplot::pp_check, lm) #' S3method(bayesplot::pp_check, glm) diff --git a/R/check_singularity.R b/R/check_singularity.R index 86de4fcce..04965dc80 100644 --- a/R/check_singularity.R +++ b/R/check_singularity.R @@ -128,7 +128,6 @@ check_singularity <- function(x, tolerance = 1e-5, ...) { } - #' @export check_singularity.merMod <- function(x, tolerance = 1e-5, ...) { insight::check_if_installed("lme4") @@ -166,7 +165,6 @@ check_singularity.glmmTMB <- function(x, tolerance = 1e-5, ...) { check_singularity.glmmadmb <- check_singularity.glmmTMB - #' @export check_singularity.clmm <- function(x, tolerance = 1e-5, ...) { insight::check_if_installed("ordinal") @@ -176,7 +174,6 @@ check_singularity.clmm <- function(x, tolerance = 1e-5, ...) { } - #' @export check_singularity.cpglmm <- function(x, tolerance = 1e-5, ...) { insight::check_if_installed("cplm") @@ -185,14 +182,12 @@ check_singularity.cpglmm <- function(x, tolerance = 1e-5, ...) { } - #' @export check_singularity.MixMod <- function(x, tolerance = 1e-5, ...) { any(sapply(diag(x$D), function(.x) any(abs(.x) < tolerance))) } - #' @export check_singularity.lme <- function(x, tolerance = 1e-5, ...) { insight::check_if_installed("nlme") @@ -201,7 +196,6 @@ check_singularity.lme <- function(x, tolerance = 1e-5, ...) { } - #' @export check_singularity.default <- function(x, ...) { FALSE diff --git a/R/check_sphericity.R b/R/check_sphericity.R index 6df73d032..ed412c5f4 100644 --- a/R/check_sphericity.R +++ b/R/check_sphericity.R @@ -24,7 +24,6 @@ check_sphericity <- function(x, ...) { } - # default -------------------------- #' @export @@ -33,7 +32,6 @@ check_sphericity.default <- function(x, ...) { } - # methods ------------------------------ #' @export @@ -57,7 +55,6 @@ print.check_sphericity <- function(x, ...) { } - # other classes ------------------ #' @export diff --git a/R/compare_performance.R b/R/compare_performance.R index 2318d5e63..4ea6bc885 100644 --- a/R/compare_performance.R +++ b/R/compare_performance.R @@ -203,7 +203,6 @@ compare_performance <- function(..., metrics = "all", rank = FALSE, estimator = } - # methods ---------------------------- #' @export @@ -237,7 +236,6 @@ plot.compare_performance <- function(x, ...) { } - # utilities ------------------------------ .rank_performance_indices <- function(x, verbose) { diff --git a/R/cronbachs_alpha.R b/R/cronbachs_alpha.R index 735641ccc..64f583b1c 100644 --- a/R/cronbachs_alpha.R +++ b/R/cronbachs_alpha.R @@ -31,7 +31,6 @@ cronbachs_alpha <- function(x, ...) { } - #' @export cronbachs_alpha.data.frame <- function(x, verbose = TRUE, ...) { # remove missings @@ -50,14 +49,12 @@ cronbachs_alpha.data.frame <- function(x, verbose = TRUE, ...) { } - #' @export cronbachs_alpha.matrix <- function(x, verbose = TRUE, ...) { cronbachs_alpha(as.data.frame(x), verbose = verbose, ...) } - #' @export cronbachs_alpha.parameters_pca <- function(x, verbose = TRUE, ...) { # fetch data used for the PCA diff --git a/R/icc.R b/R/icc.R index 420893f1e..937e47568 100644 --- a/R/icc.R +++ b/R/icc.R @@ -327,7 +327,6 @@ icc <- function(model, } - #' @rdname icc #' @export variance_decomposition <- function(model, @@ -399,7 +398,6 @@ variance_decomposition <- function(model, } - # methods ------------------------------ #' @export @@ -544,7 +542,6 @@ print.icc_decomposed <- function(x, digits = 2, ...) { } - # helper ----------------- .compute_random_vars <- function(model, diff --git a/R/item_difficulty.R b/R/item_difficulty.R index ee8c652aa..756669860 100644 --- a/R/item_difficulty.R +++ b/R/item_difficulty.R @@ -82,7 +82,6 @@ item_difficulty <- function(x, maximum_value = NULL) { } - # methods -------------------------------------- #' @export diff --git a/R/looic.R b/R/looic.R index 4ded6ccd7..3114be360 100644 --- a/R/looic.R +++ b/R/looic.R @@ -69,7 +69,6 @@ looic <- function(model, verbose = TRUE) { } - # methods -------------------------- #' @export diff --git a/R/model_performance.R b/R/model_performance.R index 57edafdcb..a0bc1e4c4 100644 --- a/R/model_performance.R +++ b/R/model_performance.R @@ -41,7 +41,6 @@ model_performance <- function(model, ...) { performance <- model_performance - # methods -------------------------------- #' @export diff --git a/R/model_performance.bayesian.R b/R/model_performance.bayesian.R index db923fc26..1a2d6d509 100644 --- a/R/model_performance.bayesian.R +++ b/R/model_performance.bayesian.R @@ -281,7 +281,6 @@ model_performance.BFBayesFactor <- function(model, } - # helper ------------------- diff --git a/R/model_performance.lavaan.R b/R/model_performance.lavaan.R index 050dbd473..a349df9e9 100644 --- a/R/model_performance.lavaan.R +++ b/R/model_performance.lavaan.R @@ -149,7 +149,6 @@ model_performance.lavaan <- function(model, metrics = "all", verbose = TRUE, ... } - #' @export model_performance.blavaan <- function(model, metrics = "all", verbose = TRUE, ...) { insight::check_if_installed(c("lavaan", "blavaan")) diff --git a/R/model_performance.lm.R b/R/model_performance.lm.R index 0199b4ce4..592bc44bb 100644 --- a/R/model_performance.lm.R +++ b/R/model_performance.lm.R @@ -283,8 +283,6 @@ model_performance.nestedLogit <- function(model, metrics = "all", verbose = TRUE } - - # mfx models ------------------------------- #' @export @@ -320,9 +318,6 @@ model_performance.betamfx <- model_performance.logitor model_performance.model_fit <- model_performance.logitor - - - # other models ------------------------------- diff --git a/R/model_performance.mixed.R b/R/model_performance.mixed.R index a96786618..ba72a5a01 100644 --- a/R/model_performance.mixed.R +++ b/R/model_performance.mixed.R @@ -138,7 +138,6 @@ model_performance.mixed <- model_performance.merMod model_performance.glmmTMB <- model_performance.merMod - #' @export model_performance.mixor <- function(model, metrics = "all", diff --git a/R/model_performance_default.R b/R/model_performance_default.R index 51f8c3afd..2da3edab8 100644 --- a/R/model_performance_default.R +++ b/R/model_performance_default.R @@ -29,7 +29,6 @@ model_performance.default <- function(model, metrics = "all", verbose = TRUE, .. } - .check_bad_metrics <- function(metrics, all_metrics, verbose = TRUE) { bad_metrics <- which(!metrics %in% all_metrics) if (length(bad_metrics)) { diff --git a/R/performance_accuracy.R b/R/performance_accuracy.R index d0adb5554..f8ce5e6e5 100644 --- a/R/performance_accuracy.R +++ b/R/performance_accuracy.R @@ -234,7 +234,6 @@ print.performance_accuracy <- function(x, ...) { } - # utilities ------------------------ .crossv_kfold <- function(model_data, k = 5) { diff --git a/R/performance_aicc.R b/R/performance_aicc.R index 74041ac1b..443bf62c9 100644 --- a/R/performance_aicc.R +++ b/R/performance_aicc.R @@ -140,7 +140,6 @@ performance_aic.vgam <- function(x, ...) { performance_aic.vglm <- performance_aic.vgam - # Survey models -------------------------------------- #' @export @@ -153,7 +152,6 @@ performance_aic.svyglm <- function(x, ...) { performance_aic.svycoxph <- performance_aic.svyglm - # mfx models -------------------------------------- #' @export diff --git a/R/performance_hosmer.R b/R/performance_hosmer.R index 31c014db1..93780b527 100644 --- a/R/performance_hosmer.R +++ b/R/performance_hosmer.R @@ -63,7 +63,6 @@ performance_hosmer <- function(model, n_bins = 10) { } - # methods --------------------------------- #' @export diff --git a/R/performance_logloss.R b/R/performance_logloss.R index 3bbd14916..a8042d942 100644 --- a/R/performance_logloss.R +++ b/R/performance_logloss.R @@ -59,7 +59,6 @@ performance_logloss.brmsfit <- function(model, verbose = TRUE, ...) { } - # mfx models ------------------------------- #' @export diff --git a/R/performance_mae.R b/R/performance_mae.R index 0c7c4c978..2be53adfd 100644 --- a/R/performance_mae.R +++ b/R/performance_mae.R @@ -22,7 +22,6 @@ performance_mae <- function(model, ...) { mae <- performance_mae - #' @export performance_mae.default <- function(model, verbose = TRUE, ...) { .is_model_valid(model) @@ -34,8 +33,6 @@ performance_mae.default <- function(model, verbose = TRUE, ...) { } - - # mfx models ------------------------------- #' @export diff --git a/R/performance_mse.R b/R/performance_mse.R index 2dc5c2125..9d3c9d239 100644 --- a/R/performance_mse.R +++ b/R/performance_mse.R @@ -29,7 +29,6 @@ performance_mse <- function(model, ...) { mse <- performance_mse - #' @export performance_mse.default <- function(model, verbose = TRUE, ...) { res <- .safe(insight::get_residuals(model, verbose = verbose, type = "response", ...)) @@ -62,8 +61,6 @@ performance_mse.default <- function(model, verbose = TRUE, ...) { } - - # mfx models ------------------------------- #' @export diff --git a/R/performance_pcp.R b/R/performance_pcp.R index edcf4c724..a078cd7e2 100644 --- a/R/performance_pcp.R +++ b/R/performance_pcp.R @@ -84,7 +84,6 @@ performance_pcp <- function(model, } - # methods ---------------------------------- #' @export @@ -126,7 +125,6 @@ as.data.frame.performance_pcp <- function(x, row.names = NULL, ...) { } - # utilities -------------------------------------- .performance_pcp <- function(model, m0, ci, method, verbose = TRUE) { diff --git a/R/performance_roc.R b/R/performance_roc.R index e5d4d5abe..4de8be3e3 100644 --- a/R/performance_roc.R +++ b/R/performance_roc.R @@ -90,7 +90,6 @@ performance_roc <- function(x, ..., predictions, new_data) { } - # methods ----------------------------- #' @export @@ -159,7 +158,6 @@ as.double.performance_roc <- function(x, ...) { } - .performance_roc_model <- function(x, new_data, model_name = "Model 1") { predictions <- stats::predict(x, newdata = new_data, type = "response") if (is.null(new_data)) new_data <- insight::get_data(x, verbose = FALSE) @@ -177,7 +175,6 @@ as.double.performance_roc <- function(x, ...) { } - .performance_roc_models <- function(x, names) { l <- lapply(seq_along(x), function(i) { if (.valid_roc_models(x[[i]])) { @@ -190,7 +187,6 @@ as.double.performance_roc <- function(x, ...) { } - # add supported glm models here .valid_roc_models <- function(x) { diff --git a/R/performance_score.R b/R/performance_score.R index 5ca3fdc84..ad9d1ce40 100644 --- a/R/performance_score.R +++ b/R/performance_score.R @@ -146,7 +146,6 @@ performance_score <- function(model, verbose = TRUE, ...) { } - # methods ----------------------------------- #' @export @@ -184,7 +183,6 @@ print.performance_score <- function(x, ...) { } - # utilities --------------------------------- .dispersion_parameter <- function(model, minfo) { @@ -203,7 +201,6 @@ print.performance_score <- function(x, ...) { } - .predict_score_y <- function(model) { pred <- NULL pred_zi <- NULL diff --git a/R/print-methods.R b/R/print-methods.R index 4b4a81aa7..299c006d4 100644 --- a/R/print-methods.R +++ b/R/print-methods.R @@ -52,7 +52,6 @@ print.r2_generic <- function(x, digits = 3, ...) { } - #' @export print.r2_pseudo <- function(x, digits = 3, ...) { model_type <- attr(x, "model_type") @@ -64,7 +63,6 @@ print.r2_pseudo <- function(x, digits = 3, ...) { } - #' @export print.r2_mlm <- function(x, digits = 3, ...) { model_type <- attr(x, "model_type") @@ -106,7 +104,6 @@ print.r2_mlm <- function(x, digits = 3, ...) { } - #' @export print.r2_bayes <- function(x, digits = 3, ...) { insight::print_color("# Bayesian R2 with Compatibility Interval\n\n", "blue") @@ -138,7 +135,6 @@ print.r2_bayes <- function(x, digits = 3, ...) { } - #' @export print.r2_loo <- function(x, digits = 3, ...) { insight::print_color("# LOO-adjusted R2 with Compatibility Interval\n\n", "blue") @@ -170,7 +166,6 @@ print.r2_loo <- function(x, digits = 3, ...) { } - #' @export print.r2_nakagawa_by_group <- function(x, digits = 3, ...) { insight::print_color("# Explained Variance by Level\n\n", "blue") diff --git a/R/r2.R b/R/r2.R index 50f62177e..a1be81087 100644 --- a/R/r2.R +++ b/R/r2.R @@ -327,7 +327,6 @@ r2.nestedLogit <- function(model, ci = NULL, verbose = TRUE, ...) { } - # mfx models --------------------- @@ -364,8 +363,6 @@ r2.betaor <- r2.logitmfx r2.model_fit <- r2.logitmfx - - # Cox & Snell R2 --------------------- @@ -384,8 +381,6 @@ r2.crch <- r2.BBreg r2.bayesx <- r2.BBreg - - # Nagelkerke R2 ---------------------- @@ -441,9 +436,6 @@ r2.mblogit <- function(model, ...) { } - - - # McFadden ---------------------- @@ -458,8 +450,6 @@ r2.multinom <- function(model, ...) { r2.mlogit <- r2.multinom - - # Zeroinflated R2 ------------------ @@ -598,7 +588,6 @@ r2.wbm <- function(model, tolerance = 1e-5, ...) { } - #' @export r2.sem <- function(model, ...) { r2_conditional <- model$r2c @@ -617,7 +606,6 @@ r2.sem <- function(model, ...) { } - # Bayes R2 ------------------------ @@ -676,7 +664,6 @@ r2.rma <- function(model, ...) { } - #' @export r2.feis <- function(model, ...) { out <- list( @@ -689,7 +676,6 @@ r2.feis <- function(model, ...) { } - #' @export r2.fixest <- function(model, ...) { insight::check_if_installed("fixest") @@ -726,7 +712,6 @@ r2.fixest_multi <- function(model, ...) { } - #' @export r2.felm <- function(model, ...) { model_summary <- summary(model) @@ -740,8 +725,6 @@ r2.felm <- function(model, ...) { } - - #' @export r2.iv_robust <- function(model, ...) { out <- list( @@ -754,7 +737,6 @@ r2.iv_robust <- function(model, ...) { } - #' @export r2.ivreg <- function(model, ...) { model_summary <- summary(model) @@ -768,7 +750,6 @@ r2.ivreg <- function(model, ...) { } - #' @export r2.bigglm <- function(model, ...) { out <- list(R2_CoxSnell = summary(model)$rsq) @@ -778,7 +759,6 @@ r2.bigglm <- function(model, ...) { } - #' @export r2.biglm <- function(model, ...) { df.int <- as.numeric(insight::has_intercept(model)) @@ -800,7 +780,6 @@ r2.biglm <- function(model, ...) { } - #' @export r2.lmrob <- function(model, ...) { model_summary <- summary(model) @@ -817,7 +796,6 @@ r2.lmrob <- function(model, ...) { r2.complmrob <- r2.lmrob - #' @export r2.mmclogit <- function(model, ...) { list(R2 = NA) @@ -834,7 +812,6 @@ r2.Arima <- function(model, ...) { } - #' @export r2.plm <- function(model, ...) { model_summary <- summary(model) @@ -848,7 +825,6 @@ r2.plm <- function(model, ...) { } - #' @export r2.selection <- function(model, ...) { model_summary <- summary(model) @@ -865,7 +841,6 @@ r2.selection <- function(model, ...) { } - #' @export r2.svyglm <- function(model, ...) { rsq <- (model$null.deviance - model$deviance) / model$null.deviance @@ -881,7 +856,6 @@ r2.svyglm <- function(model, ...) { } - #' @export r2.vglm <- function(model, ...) { out <- list(R2_McKelvey = r2_mckelvey(model)) @@ -894,7 +868,6 @@ r2.vglm <- function(model, ...) { r2.vgam <- r2.vglm - #' @export r2.DirichletRegModel <- function(model, ...) { out <- list(R2_Nagelkerke = r2_nagelkerke(model)) @@ -904,9 +877,6 @@ r2.DirichletRegModel <- function(model, ...) { } - - - # helper ------------------- .check_r2_ci_args <- function(ci = NULL, ci_method = "bootstrap", valid_ci_method = NULL, verbose = TRUE) { diff --git a/R/r2_bayes.R b/R/r2_bayes.R index 4831a4bd2..c12319a0e 100644 --- a/R/r2_bayes.R +++ b/R/r2_bayes.R @@ -303,7 +303,6 @@ r2_posterior.BFBayesFactor <- function(model, } - #' @keywords internal .r2_posterior_model_average <- function(model, prior_odds = NULL, verbose = TRUE) { insight::check_if_installed("BayesFactor") @@ -361,7 +360,6 @@ r2_posterior.BFBayesFactor <- function(model, } - #' @export as.data.frame.r2_bayes <- function(x, ...) { out <- data.frame( @@ -395,7 +393,6 @@ as.data.frame.r2_bayes <- function(x, ...) { } - # Utils ------------------------------------------------------------------- .get_bfbf_predictions <- function(model, iterations = 4000, verbose = TRUE) { diff --git a/R/r2_coxsnell.R b/R/r2_coxsnell.R index 5215c283b..ed603409b 100644 --- a/R/r2_coxsnell.R +++ b/R/r2_coxsnell.R @@ -59,7 +59,6 @@ r2_coxsnell <- function(model, ...) { } - # r2-coxsnell based on model information --------------------------- @@ -168,7 +167,6 @@ r2_coxsnell.bife <- function(model, ...) { } - # mfx models --------------------- @@ -196,8 +194,6 @@ r2_coxsnell.negbinirr <- r2_coxsnell.logitmfx r2_coxsnell.negbinmfx <- r2_coxsnell.logitmfx - - # r2-coxsnell based on loglik stored in model object --------------------------- @@ -217,7 +213,6 @@ r2_coxsnell.svycoxph <- function(model, ...) { } - # r2-coxsnell based on loglik of null-model (update) --------------------------- diff --git a/R/r2_loo.R b/R/r2_loo.R index dbcaf38b3..4aaa8dcab 100644 --- a/R/r2_loo.R +++ b/R/r2_loo.R @@ -166,7 +166,6 @@ r2_loo_posterior.BFBayesFactor <- function(model, verbose = TRUE, ...) { } - #' @export as.data.frame.r2_loo <- function(x, ...) { out <- data.frame( diff --git a/R/r2_mcfadden.R b/R/r2_mcfadden.R index 2da19787c..64f430caa 100644 --- a/R/r2_mcfadden.R +++ b/R/r2_mcfadden.R @@ -29,7 +29,6 @@ r2_mcfadden <- function(model, ...) { } - # helper ----------------------- @@ -49,11 +48,6 @@ r2_mcfadden <- function(model, ...) { } - - - - - # r2 via loglik and update -------------------------- @@ -132,9 +126,6 @@ r2_mcfadden.mblogit <- function(model, ...) { } - - - # mfx models --------------------- @@ -162,7 +153,6 @@ r2_mcfadden.probitmfx <- r2_mcfadden.logitmfx r2_mcfadden.negbinmfx <- r2_mcfadden.logitmfx - # special models ------------------------------------------- @@ -184,7 +174,6 @@ r2_mcfadden.clm2 <- function(model, ...) { } - #' @export r2_mcfadden.multinom <- function(model, ...) { l_null <- insight::get_loglikelihood(stats::update(model, ~1, trace = FALSE)) diff --git a/R/r2_nagelkerke.R b/R/r2_nagelkerke.R index 9b5b40f8f..4c64ca668 100644 --- a/R/r2_nagelkerke.R +++ b/R/r2_nagelkerke.R @@ -22,8 +22,6 @@ r2_nagelkerke <- function(model, ...) { } - - # helper --------------------------- @@ -47,9 +45,6 @@ r2_nagelkerke <- function(model, ...) { } - - - # Nagelkerke's R2 based on Cox&Snell's R2 ---------------- #' @export @@ -143,7 +138,6 @@ r2_nagelkerke.bife <- function(model, ...) { } - # mfx models --------------------- @@ -171,8 +165,6 @@ r2_nagelkerke.negbinirr <- r2_nagelkerke.logitmfx r2_nagelkerke.negbinmfx <- r2_nagelkerke.logitmfx - - # Nagelkerke's R2 based on LogLik ---------------- @@ -226,7 +218,6 @@ r2_nagelkerke.truncreg <- r2_nagelkerke.clm r2_nagelkerke.DirichletRegModel <- r2_coxsnell.clm - # Nagelkerke's R2 based on LogLik stored in model object ---------------- diff --git a/R/r2_nakagawa.R b/R/r2_nakagawa.R index aeb4df1c1..03fcb092f 100644 --- a/R/r2_nakagawa.R +++ b/R/r2_nakagawa.R @@ -235,7 +235,6 @@ r2_nakagawa <- function(model, } - # methods ------ #' @export @@ -282,7 +281,6 @@ print.r2_nakagawa <- function(x, digits = 3, ...) { } - # bootstrapping -------------- # bootstrapping using package "boot" diff --git a/R/test_bf.R b/R/test_bf.R index 38b0e421d..658883c76 100644 --- a/R/test_bf.R +++ b/R/test_bf.R @@ -30,7 +30,6 @@ test_bf.default <- function(..., reference = 1, text_length = NULL) { } - #' @export test_bf.ListModels <- function(objects, reference = 1, text_length = NULL, ...) { if (.test_bf_areAllBayesian(objects) == "mixed") { @@ -79,7 +78,6 @@ test_bf.ListModels <- function(objects, reference = 1, text_length = NULL, ...) } - # Helpers ----------------------------------------------------------------- .test_bf_areAllBayesian <- function(objects) { diff --git a/R/test_likelihoodratio.R b/R/test_likelihoodratio.R index 21ae2694d..20a58f6fb 100644 --- a/R/test_likelihoodratio.R +++ b/R/test_likelihoodratio.R @@ -16,7 +16,6 @@ test_likelihoodratio <- function(..., estimator = "ML", verbose = TRUE) { test_lrt <- test_likelihoodratio - # default -------------------- #' @export @@ -55,7 +54,6 @@ test_likelihoodratio.default <- function(..., estimator = "OLS", verbose = TRUE) } - # methods ------------------------------ #' @export diff --git a/R/test_performance.R b/R/test_performance.R index f818b02dd..76877bb0b 100644 --- a/R/test_performance.R +++ b/R/test_performance.R @@ -230,7 +230,6 @@ test_performance <- function(..., reference = 1, verbose = TRUE) { } - # default -------------------------------- #' @export @@ -253,7 +252,6 @@ test_performance.default <- function(..., reference = 1, include_formula = FALSE } - # methods ------------------------------ #' @export @@ -315,7 +313,6 @@ display.test_performance <- function(object, format = "markdown", digits = 2, .. } - # other classes ----------------------------------- #' @export @@ -406,7 +403,6 @@ test_performance.ListNonNestedRegressions <- function(objects, } - # TESTS IMPLEMENTED IN OTHER PACKAGES # # Non-nested @@ -416,7 +412,6 @@ test_performance.ListNonNestedRegressions <- function(objects, # nonnest2::icci(m2, m3) - # Helpers ----------------------------------------------------------------- @@ -432,7 +427,6 @@ test_performance.ListNonNestedRegressions <- function(objects, } - .test_performance_checks <- function(objects, multiple = TRUE, same_response = TRUE, verbose = TRUE) { # TODO: we could actually generate a baseline model 'y ~ 1' whenever a single model is passed if (multiple && insight::is_model(objects)) { @@ -472,7 +466,6 @@ test_performance.ListNonNestedRegressions <- function(objects, } - .check_objectnames <- function(objects, dot_names) { # Replace with names from the global environment, if these are not yet properly set object_names <- insight::compact_character(names(objects)) diff --git a/R/test_vuong.R b/R/test_vuong.R index f0cce6d16..26c3d70dc 100644 --- a/R/test_vuong.R +++ b/R/test_vuong.R @@ -39,9 +39,6 @@ test_vuong.ListNonNestedRegressions <- function(objects, reference = 1, ...) { } - - - # ------------------------------------------------------------------------- # Utils ------------------------------------------------------------------- # ------------------------------------------------------------------------- @@ -185,10 +182,6 @@ test_vuong.ListNonNestedRegressions <- function(objects, reference = 1, ...) { } - - - - # Compute lambda (Eq 3.6) ------------------------------------------------- # ------------------------------------------------------------------------- @@ -224,9 +217,6 @@ test_vuong.ListNonNestedRegressions <- function(objects, reference = 1, ...) { } - - - # Compute AB (Eq 2.1 and 2.2) --------------------------------------------- # ------------------------------------------------------------------------- diff --git a/R/test_wald.R b/R/test_wald.R index ddfe21829..6873cf72c 100644 --- a/R/test_wald.R +++ b/R/test_wald.R @@ -25,7 +25,6 @@ test_wald.default <- function(..., verbose = TRUE) { } - #' @export test_wald.ListNestedRegressions <- function(objects, verbose = TRUE, ...) { # for binomial models, only chisq-test diff --git a/tests/testthat/test-check_collinearity.R b/tests/testthat/test-check_collinearity.R index 8bab16003..e01bcda39 100644 --- a/tests/testthat/test-check_collinearity.R +++ b/tests/testthat/test-check_collinearity.R @@ -54,7 +54,6 @@ test_that("check_collinearity", { }) - test_that("check_collinearity", { skip_if_not_installed("glmmTMB") skip_if_not(getRversion() >= "4.0.0") @@ -232,8 +231,8 @@ test_that("check_collinearity, glmmTMB hurdle w/o zi", { count ~ spp + mined + (1 | site), data = Salamanders[Salamanders$count > 0, , drop = FALSE], family = glmmTMB::truncated_nbinom2(), - ziformula = ~ 0, - dispformula = ~ 1 + ziformula = ~0, + dispformula = ~1 ) out <- check_collinearity(mod_trunc_error) expect_equal(out$VIF, c(1.03414, 1.03414), tolerance = 1e-3) diff --git a/tests/testthat/test-pkg-fixest.R b/tests/testthat/test-pkg-fixest.R index 8a187e33b..b6c7e93b0 100644 --- a/tests/testthat/test-pkg-fixest.R +++ b/tests/testthat/test-pkg-fixest.R @@ -48,7 +48,6 @@ test_that("fixest: model_performance", { }) - test_that("fixest_multi: r2", { skip_if_not_installed("fixest") fixest::setFixest_nthreads(1) diff --git a/tests/testthat/test-r2_mcfadden.R b/tests/testthat/test-r2_mcfadden.R index decbf8f9b..354f6884e 100644 --- a/tests/testthat/test-r2_mcfadden.R +++ b/tests/testthat/test-r2_mcfadden.R @@ -39,7 +39,7 @@ withr::with_environment( dd$y <- glmmTMB::simulate_new( ~ 1 + x, newdata = dd, - newparams = list(beta = c(0,1), betadisp = -1), + newparams = list(beta = c(0, 1), betadisp = -1), weights = rep(10, nrow(dd)), family = glmmTMB::betabinomial() )[[1]] @@ -47,7 +47,7 @@ withr::with_environment( d <<- dd m <- glmmTMB::glmmTMB( - y/10 ~ 1 + x, + y / 10 ~ 1 + x, data = d, weights = rep(10, nrow(d)), family = glmmTMB::betabinomial()