From 65a0642a3b21eab59496075d5fb986af8467940a Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 08:02:21 +0100 Subject: [PATCH 01/56] Wording of table headers Fixes #651 --- DESCRIPTION | 2 +- R/estimate_means.R | 8 ++++---- R/estimate_predicted.R | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ab52c93ac..bd5799535 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: modelbased Title: Estimation of Model-Based Predictions, Contrasts and Means -Version: 0.18.0.5 +Version: 0.18.0.6 Authors@R: c(person(given = "Dominique", family = "Makowski", diff --git a/R/estimate_means.R b/R/estimate_means.R index 9ef4803f9..0f61a1e4f 100644 --- a/R/estimate_means.R +++ b/R/estimate_means.R @@ -527,10 +527,10 @@ estimate_means <- function( attr(means, "table_title") <- c( switch( estimate, - specific = "Model-based Predictions", - typical = "Estimated Marginal Means", - average = "Average Predictions", - population = "Average Counterfactual Predictions" + specific = , + typical = "Conditional Predictions", + average = , + population = "Marginal Predictions" ), "blue" ) diff --git a/R/estimate_predicted.R b/R/estimate_predicted.R index dffd9d318..72f1553d4 100644 --- a/R/estimate_predicted.R +++ b/R/estimate_predicted.R @@ -588,7 +588,7 @@ estimate_relation <- function( attr(out, "datagrid") <- data attr(out, "focal_terms") <- grid_specs$at_specs$varname attr(out, "preserve_range") <- grid_specs$preserve_range - attr(out, "table_title") <- c("Model-based Predictions", "blue") + attr(out, "table_title") <- c("Conditional Predictions", "blue") attr(out, "coef_name") <- "Predicted" attr(out, "model_info") <- insight::model_info(model, response = 1) attr(out, "predict") <- predict From 0a54d85acb8ed96f7ad8e87af685b7f4a841cae2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 08:10:58 +0100 Subject: [PATCH 02/56] Change footer line --- R/estimate_contrasts.R | 10 +++++----- R/estimate_means.R | 4 ++-- R/table_footer.R | 13 ++++++++----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/R/estimate_contrasts.R b/R/estimate_contrasts.R index f49b783d8..e92b36a26 100644 --- a/R/estimate_contrasts.R +++ b/R/estimate_contrasts.R @@ -600,15 +600,15 @@ estimate_contrasts.default <- function( suffix <- "Inequality Analysis" type <- "inequality" } else { - suffix <- "Contrasts Analysis" + suffix <- "Contrasts" } attr(out, "table_title") <- c( switch( estimate, - specific = paste("Model-based", suffix), - typical = paste("Marginal", suffix), - average = paste("Averaged", suffix), - population = paste("Counterfactual", suffix, "(G-computation)") + specific = , + typical = paste("Conditional", suffix), + average = paste("Marginal", suffix), + population = paste("Marginal", suffix, "(G-computation)") ), "blue" ) diff --git a/R/estimate_means.R b/R/estimate_means.R index 0f61a1e4f..ae2beea14 100644 --- a/R/estimate_means.R +++ b/R/estimate_means.R @@ -529,8 +529,8 @@ estimate_means <- function( estimate, specific = , typical = "Conditional Predictions", - average = , - population = "Marginal Predictions" + average = "Marginal Predictions", + population = "Marginal Predictions (G-computation)" ), "blue" ) diff --git a/R/table_footer.R b/R/table_footer.R index f82650d6e..e9861294f 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -68,11 +68,14 @@ } } } - # The "predictors averaged" line does not strictly apply to `estimate = - # "average"`, because we average across all predictions, we do not take an - # "average value" of a non-focal predictor. Thus, we skip this line in the - # footer - if (!identical(marginalization, "average")) { + # The "predictors averaged" line does not strictly apply to marginal + # predictions like `estimate = "average"` or `estimate = "population"`, + # because we average across all predictions, we do not take an "average + # value" of a non-focal predictor. Thus, we skip this line in the footer + if ( + !is.null(marginalization) && + !marginalization %in% c("average", "population", "counterfactual") + ) { average_string <- switch(type, predictions = "controlled", "averaged") table_footer <- paste0( table_footer, From af3ba19c0866a726f9c440923df4698d40e8a945 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 08:18:54 +0100 Subject: [PATCH 03/56] minor fix --- R/table_footer.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/table_footer.R b/R/table_footer.R index e9861294f..b1ea6f4cf 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -73,7 +73,7 @@ # because we average across all predictions, we do not take an "average # value" of a non-focal predictor. Thus, we skip this line in the footer if ( - !is.null(marginalization) && + is.null(marginalization) || !marginalization %in% c("average", "population", "counterfactual") ) { average_string <- switch(type, predictions = "controlled", "averaged") From c8216b15880b97a23b90fefd2629967d11d28294 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 08:26:58 +0100 Subject: [PATCH 04/56] fix test --- tests/testthat/_snaps/betareg.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/betareg.md b/tests/testthat/_snaps/betareg.md index f5414f889..a2cc6bebb 100644 --- a/tests/testthat/_snaps/betareg.md +++ b/tests/testthat/_snaps/betareg.md @@ -3,7 +3,7 @@ Code print(out, zap_small = TRUE) Output - Estimated Marginal Means + Conditional Predictions batch | Proportion | SE | 95% CI | z ------------------------------------------------ @@ -28,7 +28,7 @@ Code print(out, zap_small = TRUE) Output - Model-based Predictions + Conditional Predictions batch | Predicted | 95% CI -------------------------------- From b656c45a9f93aa8b57d8e719aff9156ba77efe01 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 08:48:20 +0100 Subject: [PATCH 05/56] update snaps --- tests/testthat/_snaps/estimate_contrasts.md | 688 ------------------ tests/testthat/_snaps/estimate_means_mixed.md | 6 +- tests/testthat/_snaps/transform_response.md | 4 +- 3 files changed, 5 insertions(+), 693 deletions(-) diff --git a/tests/testthat/_snaps/estimate_contrasts.md b/tests/testthat/_snaps/estimate_contrasts.md index 736383b01..ed63639be 100644 --- a/tests/testthat/_snaps/estimate_contrasts.md +++ b/tests/testthat/_snaps/estimate_contrasts.md @@ -228,691 +228,3 @@ p-value adjustment method: Holm (1979) Contrasts are on the response-scale. -# estimate_contrasts - filtering works - - Code - print(estimate_contrasts(fit, "c172code", backend = "marginaleffects"), - table_width = Inf, zap_small = TRUE) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(827) | p - -------------------------------------------------------------------- - mid | low | -0.09 | 0.34 | [-0.76, 0.58] | -0.25 | 0.802 - high | low | 0.61 | 0.43 | [-0.24, 1.45] | 1.40 | 0.162 - high | mid | 0.69 | 0.36 | [-0.02, 1.40] | 1.92 | 0.055 - - Variable predicted: neg_c_7 - Predictors contrasted: c172code - Predictors averaged: e16sex, c161sex - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(fit, c("c161sex", "c172code"), backend = "marginaleffects"), - table_width = Inf, zap_small = TRUE) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(825) | p - ------------------------------------------------------------------------------- - Male, mid | Male, low | 0.29 | 0.71 | [-1.10, 1.68] | 0.41 | 0.684 - Male, high | Male, low | 0.69 | 0.83 | [-0.95, 2.32] | 0.82 | 0.410 - Female, low | Male, low | 1.05 | 0.69 | [-0.31, 2.40] | 1.51 | 0.131 - Female, mid | Male, low | 0.85 | 0.64 | [-0.40, 2.10] | 1.33 | 0.183 - Female, high | Male, low | 1.65 | 0.71 | [ 0.24, 3.05] | 2.30 | 0.022 - Male, high | Male, mid | 0.40 | 0.68 | [-0.94, 1.73] | 0.59 | 0.558 - Female, low | Male, mid | 0.76 | 0.50 | [-0.22, 1.73] | 1.52 | 0.129 - Female, mid | Male, mid | 0.56 | 0.42 | [-0.26, 1.38] | 1.35 | 0.178 - Female, high | Male, mid | 1.36 | 0.53 | [ 0.32, 2.39] | 2.58 | 0.010 - Female, low | Male, high | 0.36 | 0.66 | [-0.95, 1.66] | 0.54 | 0.589 - Female, mid | Male, high | 0.16 | 0.61 | [-1.03, 1.35] | 0.27 | 0.789 - Female, high | Male, high | 0.96 | 0.69 | [-0.39, 2.30] | 1.40 | 0.163 - Female, mid | Female, low | -0.20 | 0.39 | [-0.96, 0.57] | -0.51 | 0.613 - Female, high | Female, low | 0.60 | 0.51 | [-0.39, 1.59] | 1.18 | 0.236 - Female, high | Female, mid | 0.80 | 0.43 | [-0.04, 1.63] | 1.87 | 0.061 - - Variable predicted: neg_c_7 - Predictors contrasted: c161sex, c172code - Predictors averaged: e16sex - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(fit, "c161sex", "c172code", backend = "marginaleffects"), - table_width = Inf, zap_small = TRUE) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | c172code | Difference | SE | 95% CI | t(825) | p - ------------------------------------------------------------------------------- - Female | Male | low | 1.05 | 0.69 | [-0.31, 2.40] | 1.51 | 0.131 - Female | Male | mid | 0.56 | 0.42 | [-0.26, 1.38] | 1.35 | 0.178 - Female | Male | high | 0.96 | 0.69 | [-0.39, 2.30] | 1.40 | 0.163 - - Variable predicted: neg_c_7 - Predictors contrasted: c161sex - Predictors averaged: e16sex - p-values are uncorrected. - ---- - - Code - print(estimate_slopes(fit, "barthtot", backend = "marginaleffects"), - table_width = Inf, zap_small = TRUE) - Output - Estimated Marginal Effects - - Slope | SE | 95% CI | t(810) | p - ----------------------------------------------- - -0.05 | 0.00 | [-0.06, -0.05] | -12.77 | < .001 - - Marginal effects estimated for barthtot - Type of slope was dY/dX - ---- - - Code - print(estimate_slopes(fit, "barthtot", by = "c172code", backend = "marginaleffects"), - table_width = Inf, zap_small = TRUE) - Output - Estimated Marginal Effects - - c172code | Slope | SE | 95% CI | t(808) | p - ---------------------------------------------------------- - low | -0.06 | 0.01 | [-0.08, -0.05] | -7.08 | < .001 - mid | -0.05 | 0.01 | [-0.06, -0.04] | -9.82 | < .001 - high | -0.05 | 0.01 | [-0.07, -0.03] | -4.53 | < .001 - - Marginal effects estimated for barthtot - Type of slope was dY/dX - ---- - - Code - print(estimate_contrasts(fit, "barthtot", "c172code", backend = "marginaleffects"), - table_width = Inf, zap_small = TRUE) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(808) | p - -------------------------------------------------------------------- - mid | low | 0.01 | 0.01 | [-0.01, 0.03] | 1.17 | 0.243 - high | low | 0.02 | 0.01 | [-0.01, 0.04] | 1.10 | 0.270 - high | mid | 0.00 | 0.01 | [-0.02, 0.03] | 0.27 | 0.786 - - Variable predicted: neg_c_7 - Predictors contrasted: barthtot - Predictors averaged: e16sex, barthtot (65) - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(fit, "barthtot", c("c172code", "e16sex"), backend = "marginaleffects"), - table_width = Inf, zap_small = TRUE) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(803) | p - ------------------------------------------------------------------------------- - low, female | low, male | -0.01 | 0.02 | [-0.04, 0.03] | -0.35 | 0.729 - mid, male | low, male | -0.01 | 0.02 | [-0.04, 0.02] | -0.46 | 0.648 - mid, female | low, male | 0.02 | 0.01 | [-0.01, 0.05] | 1.24 | 0.217 - high, male | low, male | 0.00 | 0.02 | [-0.05, 0.04] | -0.16 | 0.876 - high, female | low, male | 0.02 | 0.02 | [-0.01, 0.06] | 1.19 | 0.236 - mid, male | low, female | 0.00 | 0.02 | [-0.03, 0.03] | -0.08 | 0.940 - mid, female | low, female | 0.02 | 0.01 | [ 0.00, 0.05] | 1.76 | 0.079 - high, male | low, female | 0.00 | 0.02 | [-0.04, 0.05] | 0.12 | 0.908 - high, female | low, female | 0.03 | 0.02 | [-0.01, 0.06] | 1.58 | 0.115 - mid, female | mid, male | 0.03 | 0.01 | [ 0.00, 0.05] | 2.23 | 0.026 - high, male | mid, male | 0.00 | 0.02 | [-0.04, 0.05] | 0.18 | 0.859 - high, female | mid, male | 0.03 | 0.02 | [ 0.00, 0.06] | 1.83 | 0.068 - high, male | mid, female | -0.02 | 0.02 | [-0.06, 0.02] | -1.08 | 0.280 - high, female | mid, female | 0.00 | 0.01 | [-0.02, 0.03] | 0.26 | 0.792 - high, female | high, male | 0.03 | 0.02 | [-0.02, 0.07] | 1.11 | 0.269 - - Variable predicted: neg_c_7 - Predictors contrasted: barthtot - Predictors averaged: barthtot (65) - p-values are uncorrected. - -# estimate_contrasts - simple contrasts and with - in levels works - - Code - print(estimate_contrasts(model, "Species", backend = "marginaleffects"), - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(146) | p - ---------------------------------------------------------------------------- - versicolor | setosa | 1.46 | 0.11 | [1.24, 1.68] | 13.01 | < .001 - virginica | setosa | 1.95 | 0.10 | [1.75, 2.14] | 19.47 | < .001 - virginica | versicolor | 0.49 | 0.09 | [0.31, 0.67] | 5.41 | < .001 - - Variable predicted: Sepal.Length - Predictors contrasted: Species - Predictors averaged: Sepal.Width (3.1) - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(m, c("time", "coffee"), backend = "marginaleffects"), - zap_small = TRUE, table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(113) | p - --------------------------------------------------------------------------------------------- - morning, control | morning, coffee | -5.78 | 1.99 | [-9.73, -1.83] | -2.90 | 0.004 - noon, coffee | morning, coffee | -1.93 | 1.99 | [-5.88, 2.02] | -0.97 | 0.336 - noon, control | morning, coffee | 0.00 | 1.99 | [-3.95, 3.95] | 0.00 | > .999 - afternoon, coffee | morning, coffee | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 - afternoon, control | morning, coffee | 0.00 | 1.99 | [-3.95, 3.95] | 0.00 | > .999 - noon, coffee | morning, control | 3.86 | 1.99 | [-0.09, 7.81] | 1.93 | 0.056 - noon, control | morning, control | 5.78 | 1.99 | [ 1.83, 9.73] | 2.90 | 0.004 - afternoon, coffee | morning, control | 7.71 | 1.99 | [ 3.76, 11.66] | 3.87 | < .001 - afternoon, control | morning, control | 5.78 | 1.99 | [ 1.83, 9.73] | 2.90 | 0.004 - noon, control | noon, coffee | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 - afternoon, coffee | noon, coffee | 3.86 | 1.99 | [-0.09, 7.81] | 1.93 | 0.056 - afternoon, control | noon, coffee | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 - afternoon, coffee | noon, control | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 - afternoon, control | noon, control | 0.00 | 1.99 | [-3.95, 3.95] | 0.00 | > .999 - afternoon, control | afternoon, coffee | -1.93 | 1.99 | [-5.88, 2.02] | -0.97 | 0.336 - - Variable predicted: alertness - Predictors contrasted: time, coffee - Predictors averaged: sex - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(m, contrast = "time", by = "coffee", backend = "marginaleffects"), - zap_small = TRUE, table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | coffee | Difference | SE | 95% CI | t(113) | p - ----------------------------------------------------------------------------------- - noon | morning | coffee | -1.93 | 1.99 | [-5.88, 2.02] | -0.97 | 0.336 - afternoon | morning | coffee | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 - afternoon | noon | coffee | 3.86 | 1.99 | [-0.09, 7.81] | 1.93 | 0.056 - noon | morning | control | 5.78 | 1.99 | [ 1.83, 9.73] | 2.90 | 0.004 - afternoon | morning | control | 5.78 | 1.99 | [ 1.83, 9.73] | 2.90 | 0.004 - afternoon | noon | control | 0.00 | 1.99 | [-3.95, 3.95] | 0.00 | > .999 - - Variable predicted: alertness - Predictors contrasted: time - Predictors averaged: sex - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model, contrast = c("mined", "spp"), backend = "marginaleffects"), - zap_small = TRUE, table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | z | p - ----------------------------------------------------------------------------- - yes, PR | yes, GP | 0.06 | 0.05 | [-0.04, 0.16] | 1.10 | 0.271 - yes, DM | yes, GP | 0.32 | 0.11 | [ 0.10, 0.54] | 2.89 | 0.004 - yes, EC-A | yes, GP | 0.04 | 0.05 | [-0.05, 0.13] | 0.80 | 0.421 - yes, EC-L | yes, GP | 0.17 | 0.08 | [ 0.02, 0.32] | 2.19 | 0.028 - yes, DES-L | yes, GP | 0.43 | 0.14 | [ 0.17, 0.70] | 3.19 | 0.001 - yes, DF | yes, GP | 0.43 | 0.14 | [ 0.17, 0.70] | 3.19 | 0.001 - no, GP | yes, GP | 2.59 | 0.55 | [ 1.50, 3.67] | 4.67 | < .001 - no, PR | yes, GP | 0.51 | 0.16 | [ 0.20, 0.82] | 3.21 | 0.001 - no, DM | yes, GP | 2.86 | 0.61 | [ 1.68, 4.05] | 4.73 | < .001 - no, EC-A | yes, GP | 1.10 | 0.27 | [ 0.57, 1.64] | 4.03 | < .001 - no, EC-L | yes, GP | 4.67 | 0.94 | [ 2.82, 6.52] | 4.95 | < .001 - no, DES-L | yes, GP | 4.62 | 0.93 | [ 2.79, 6.45] | 4.95 | < .001 - no, DF | yes, GP | 2.24 | 0.49 | [ 1.28, 3.20] | 4.58 | < .001 - yes, DM | yes, PR | 0.26 | 0.11 | [ 0.05, 0.48] | 2.43 | 0.015 - yes, EC-A | yes, PR | -0.02 | 0.06 | [-0.13, 0.09] | -0.33 | 0.740 - yes, EC-L | yes, PR | 0.11 | 0.08 | [-0.04, 0.27] | 1.43 | 0.154 - yes, DES-L | yes, PR | 0.38 | 0.13 | [ 0.12, 0.64] | 2.86 | 0.004 - yes, DF | yes, PR | 0.38 | 0.13 | [ 0.12, 0.64] | 2.86 | 0.004 - no, GP | yes, PR | 2.53 | 0.56 | [ 1.44, 3.62] | 4.54 | < .001 - no, PR | yes, PR | 0.45 | 0.16 | [ 0.13, 0.77] | 2.75 | 0.006 - no, DM | yes, PR | 2.80 | 0.61 | [ 1.61, 4.00] | 4.61 | < .001 - no, EC-A | yes, PR | 1.05 | 0.28 | [ 0.50, 1.59] | 3.76 | < .001 - no, EC-L | yes, PR | 4.61 | 0.95 | [ 2.76, 6.47] | 4.87 | < .001 - no, DES-L | yes, PR | 4.56 | 0.94 | [ 2.73, 6.40] | 4.87 | < .001 - no, DF | yes, PR | 2.18 | 0.49 | [ 1.22, 3.15] | 4.44 | < .001 - yes, EC-A | yes, DM | -0.28 | 0.11 | [-0.50, -0.07] | -2.59 | 0.010 - yes, EC-L | yes, DM | -0.15 | 0.11 | [-0.36, 0.06] | -1.39 | 0.164 - yes, DES-L | yes, DM | 0.11 | 0.13 | [-0.14, 0.36] | 0.89 | 0.375 - yes, DF | yes, DM | 0.11 | 0.13 | [-0.14, 0.36] | 0.89 | 0.375 - no, GP | yes, DM | 2.27 | 0.58 | [ 1.14, 3.40] | 3.93 | < .001 - no, PR | yes, DM | 0.19 | 0.20 | [-0.21, 0.58] | 0.93 | 0.352 - no, DM | yes, DM | 2.54 | 0.63 | [ 1.31, 3.77] | 4.04 | < .001 - no, EC-A | yes, DM | 0.78 | 0.31 | [ 0.18, 1.38] | 2.56 | 0.011 - no, EC-L | yes, DM | 4.35 | 0.96 | [ 2.46, 6.24] | 4.51 | < .001 - no, DES-L | yes, DM | 4.30 | 0.95 | [ 2.43, 6.17] | 4.51 | < .001 - no, DF | yes, DM | 1.92 | 0.51 | [ 0.91, 2.93] | 3.74 | < .001 - yes, EC-L | yes, EC-A | 0.13 | 0.08 | [-0.02, 0.29] | 1.68 | 0.093 - yes, DES-L | yes, EC-A | 0.40 | 0.13 | [ 0.14, 0.66] | 2.97 | 0.003 - yes, DF | yes, EC-A | 0.40 | 0.13 | [ 0.14, 0.66] | 2.97 | 0.003 - no, GP | yes, EC-A | 2.55 | 0.56 | [ 1.46, 3.64] | 4.58 | < .001 - no, PR | yes, EC-A | 0.47 | 0.16 | [ 0.15, 0.79] | 2.90 | 0.004 - no, DM | yes, EC-A | 2.82 | 0.61 | [ 1.63, 4.01] | 4.65 | < .001 - no, EC-A | yes, EC-A | 1.06 | 0.28 | [ 0.52, 1.61] | 3.85 | < .001 - no, EC-L | yes, EC-A | 4.63 | 0.95 | [ 2.78, 6.48] | 4.90 | < .001 - no, DES-L | yes, EC-A | 4.58 | 0.94 | [ 2.75, 6.42] | 4.90 | < .001 - no, DF | yes, EC-A | 2.20 | 0.49 | [ 1.24, 3.17] | 4.49 | < .001 - yes, DES-L | yes, EC-L | 0.26 | 0.13 | [ 0.02, 0.51] | 2.08 | 0.037 - yes, DF | yes, EC-L | 0.26 | 0.13 | [ 0.02, 0.51] | 2.08 | 0.037 - no, GP | yes, EC-L | 2.42 | 0.57 | [ 1.31, 3.53] | 4.28 | < .001 - no, PR | yes, EC-L | 0.34 | 0.18 | [-0.01, 0.69] | 1.89 | 0.058 - no, DM | yes, EC-L | 2.69 | 0.62 | [ 1.48, 3.90] | 4.37 | < .001 - no, EC-A | yes, EC-L | 0.93 | 0.29 | [ 0.37, 1.50] | 3.23 | 0.001 - no, EC-L | yes, EC-L | 4.50 | 0.95 | [ 2.63, 6.37] | 4.72 | < .001 - no, DES-L | yes, EC-L | 4.45 | 0.94 | [ 2.60, 6.30] | 4.71 | < .001 - no, DF | yes, EC-L | 2.07 | 0.50 | [ 1.09, 3.05] | 4.14 | < .001 - yes, DF | yes, DES-L | 0.00 | 0.13 | [-0.26, 0.26] | 0.00 | > .999 - no, GP | yes, DES-L | 2.15 | 0.59 | [ 1.00, 3.31] | 3.67 | < .001 - no, PR | yes, DES-L | 0.07 | 0.22 | [-0.36, 0.50] | 0.33 | 0.738 - no, DM | yes, DES-L | 2.43 | 0.64 | [ 1.18, 3.68] | 3.81 | < .001 - no, EC-A | yes, DES-L | 0.67 | 0.32 | [ 0.04, 1.29] | 2.09 | 0.037 - no, EC-L | yes, DES-L | 4.24 | 0.97 | [ 2.33, 6.14] | 4.36 | < .001 - no, DES-L | yes, DES-L | 4.19 | 0.96 | [ 2.30, 6.07] | 4.35 | < .001 - no, DF | yes, DES-L | 1.81 | 0.52 | [ 0.78, 2.83] | 3.45 | < .001 - no, GP | yes, DF | 2.15 | 0.59 | [ 1.00, 3.31] | 3.67 | < .001 - no, PR | yes, DF | 0.07 | 0.22 | [-0.36, 0.50] | 0.33 | 0.738 - no, DM | yes, DF | 2.43 | 0.64 | [ 1.18, 3.68] | 3.81 | < .001 - no, EC-A | yes, DF | 0.67 | 0.32 | [ 0.04, 1.29] | 2.09 | 0.037 - no, EC-L | yes, DF | 4.24 | 0.97 | [ 2.33, 6.14] | 4.36 | < .001 - no, DES-L | yes, DF | 4.19 | 0.96 | [ 2.30, 6.07] | 4.35 | < .001 - no, DF | yes, DF | 1.81 | 0.52 | [ 0.78, 2.83] | 3.45 | < .001 - no, PR | no, GP | -2.08 | 0.48 | [-3.02, -1.14] | -4.35 | < .001 - no, DM | no, GP | 0.27 | 0.37 | [-0.46, 1.00] | 0.73 | 0.466 - no, EC-A | no, GP | -1.49 | 0.41 | [-2.29, -0.68] | -3.61 | < .001 - no, EC-L | no, GP | 2.08 | 0.58 | [ 0.95, 3.21] | 3.61 | < .001 - no, DES-L | no, GP | 2.03 | 0.57 | [ 0.92, 3.15] | 3.57 | < .001 - no, DF | no, GP | -0.35 | 0.35 | [-1.04, 0.35] | -0.98 | 0.328 - no, DM | no, PR | 2.35 | 0.53 | [ 1.32, 3.39] | 4.47 | < .001 - no, EC-A | no, PR | 0.59 | 0.23 | [ 0.14, 1.05] | 2.56 | 0.011 - no, EC-L | no, PR | 4.16 | 0.86 | [ 2.49, 5.84] | 4.87 | < .001 - no, DES-L | no, PR | 4.11 | 0.85 | [ 2.45, 5.77] | 4.86 | < .001 - no, DF | no, PR | 1.73 | 0.42 | [ 0.92, 2.55] | 4.15 | < .001 - no, EC-A | no, DM | -1.76 | 0.46 | [-2.65, -0.87] | -3.86 | < .001 - no, EC-L | no, DM | 1.81 | 0.55 | [ 0.73, 2.89] | 3.29 | < .001 - no, DES-L | no, DM | 1.76 | 0.54 | [ 0.70, 2.82] | 3.24 | 0.001 - no, DF | no, DM | -0.62 | 0.38 | [-1.36, 0.12] | -1.65 | 0.100 - no, EC-L | no, EC-A | 3.57 | 0.77 | [ 2.07, 5.07] | 4.66 | < .001 - no, DES-L | no, EC-A | 3.52 | 0.76 | [ 2.03, 5.00] | 4.65 | < .001 - no, DF | no, EC-A | 1.14 | 0.36 | [ 0.43, 1.85] | 3.16 | 0.002 - no, DES-L | no, EC-L | -0.05 | 0.48 | [-0.99, 0.89] | -0.10 | 0.918 - no, DF | no, EC-L | -2.43 | 0.61 | [-3.63, -1.22] | -3.95 | < .001 - no, DF | no, DES-L | -2.38 | 0.61 | [-3.57, -1.19] | -3.92 | < .001 - - Variable predicted: count - Predictors contrasted: mined, spp - Predictors averaged: cover (8.7e-11), site - p-values are uncorrected. - Contrasts are on the response-scale. - ---- - - Code - print(estimate_contrasts(model, contrast = "mined", by = "spp", backend = "marginaleffects"), - zap_small = TRUE, table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | spp | Difference | SE | 95% CI | z | p - -------------------------------------------------------------------------- - no | yes | GP | 2.59 | 0.55 | [1.50, 3.67] | 4.67 | < .001 - no | yes | PR | 0.45 | 0.16 | [0.13, 0.77] | 2.75 | 0.006 - no | yes | DM | 2.54 | 0.63 | [1.31, 3.77] | 4.04 | < .001 - no | yes | EC-A | 1.06 | 0.28 | [0.52, 1.61] | 3.85 | < .001 - no | yes | EC-L | 4.50 | 0.95 | [2.63, 6.37] | 4.72 | < .001 - no | yes | DES-L | 4.19 | 0.96 | [2.30, 6.07] | 4.35 | < .001 - no | yes | DF | 1.81 | 0.52 | [0.78, 2.83] | 3.45 | < .001 - - Variable predicted: count - Predictors contrasted: mined - Predictors averaged: cover (8.7e-11), site - p-values are uncorrected. - Contrasts are on the response-scale. - -# estimate_contrasts - examples from docs work as intendec - - Code - print(estimate_contrasts(model, contrast = "Petal.Width", by = "Species"), - zap_small = TRUE, table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(144) | p - ---------------------------------------------------------------------------- - versicolor | setosa | 0.22 | 0.46 | [-0.70, 1.13] | 0.47 | 0.640 - virginica | setosa | -0.21 | 0.44 | [-1.07, 0.66] | -0.47 | 0.638 - virginica | versicolor | -0.42 | 0.27 | [-0.95, 0.11] | -1.58 | 0.116 - - Variable predicted: Sepal.Width - Predictors contrasted: Petal.Width - Predictors averaged: Petal.Width (1.2) - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model, contrast = c("Species", "Petal.Width"), length = 2), - zap_small = TRUE, table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(144) | p - ---------------------------------------------------------------------------------------- - setosa, 2.5 | setosa, 0.1 | 2.01 | 0.98 | [ 0.08, 3.94] | 2.06 | 0.041 - versicolor, 0.1 | setosa, 0.1 | -1.83 | 0.28 | [-2.38, -1.28] | -6.55 | < .001 - versicolor, 2.5 | setosa, 0.1 | 0.70 | 0.27 | [ 0.17, 1.23] | 2.61 | 0.010 - virginica, 0.1 | setosa, 0.1 | -1.55 | 0.31 | [-2.17, -0.93] | -4.95 | < .001 - virginica, 2.5 | setosa, 0.1 | -0.03 | 0.11 | [-0.25, 0.19] | -0.29 | 0.773 - versicolor, 0.1 | setosa, 2.5 | -3.84 | 0.96 | [-5.73, -1.95] | -4.01 | < .001 - versicolor, 2.5 | setosa, 2.5 | -1.31 | 0.95 | [-3.19, 0.58] | -1.37 | 0.172 - virginica, 0.1 | setosa, 2.5 | -3.56 | 0.97 | [-5.47, -1.65] | -3.68 | < .001 - virginica, 2.5 | setosa, 2.5 | -2.04 | 0.92 | [-3.86, -0.22] | -2.21 | 0.028 - versicolor, 2.5 | versicolor, 0.1 | 2.53 | 0.52 | [ 1.50, 3.56] | 4.86 | < .001 - virginica, 0.1 | versicolor, 0.1 | 0.28 | 0.41 | [-0.52, 1.08] | 0.69 | 0.492 - virginica, 2.5 | versicolor, 0.1 | 1.80 | 0.28 | [ 1.24, 2.35] | 6.35 | < .001 - virginica, 0.1 | versicolor, 2.5 | -2.25 | 0.40 | [-3.04, -1.46] | -5.64 | < .001 - virginica, 2.5 | versicolor, 2.5 | -0.73 | 0.27 | [-1.27, -0.20] | -2.70 | 0.008 - virginica, 2.5 | virginica, 0.1 | 1.52 | 0.37 | [ 0.77, 2.26] | 4.04 | < .001 - - Variable predicted: Sepal.Width - Predictors contrasted: Species, Petal.Width - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model, contrast = c("Species", "Petal.Width=c(1, 2)")), - zap_small = TRUE, table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(144) | p - ------------------------------------------------------------------------------------ - setosa, 2 | setosa, 1 | 0.84 | 0.41 | [ 0.03, 1.64] | 2.06 | 0.041 - versicolor, 1 | setosa, 1 | -1.63 | 0.32 | [-2.27, -1.00] | -5.09 | < .001 - versicolor, 2 | setosa, 1 | -0.58 | 0.35 | [-1.26, 0.10] | -1.68 | 0.096 - virginica, 1 | setosa, 1 | -1.73 | 0.35 | [-2.43, -1.04] | -4.93 | < .001 - virginica, 2 | setosa, 1 | -1.10 | 0.31 | [-1.72, -0.48] | -3.52 | < .001 - versicolor, 1 | setosa, 2 | -2.47 | 0.72 | [-3.89, -1.05] | -3.43 | < .001 - versicolor, 2 | setosa, 2 | -1.42 | 0.73 | [-2.86, 0.03] | -1.94 | 0.055 - virginica, 1 | setosa, 2 | -2.57 | 0.73 | [-4.02, -1.12] | -3.50 | < .001 - virginica, 2 | setosa, 2 | -1.94 | 0.72 | [-3.35, -0.52] | -2.71 | 0.008 - versicolor, 2 | versicolor, 1 | 1.05 | 0.22 | [ 0.62, 1.48] | 4.86 | < .001 - virginica, 1 | versicolor, 1 | -0.10 | 0.19 | [-0.47, 0.27] | -0.54 | 0.589 - virginica, 2 | versicolor, 1 | 0.53 | 0.09 | [ 0.35, 0.71] | 5.72 | < .001 - virginica, 1 | versicolor, 2 | -1.15 | 0.23 | [-1.60, -0.71] | -5.13 | < .001 - virginica, 2 | versicolor, 2 | -0.52 | 0.16 | [-0.84, -0.21] | -3.31 | 0.001 - virginica, 2 | virginica, 1 | 0.63 | 0.16 | [ 0.32, 0.94] | 4.04 | < .001 - - Variable predicted: Sepal.Width - Predictors contrasted: Species, Petal.Width=c(1, 2) - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model, by = "Petal.Width", length = 4), zap_small = TRUE, - table_width = Inf) - Message - We selected `contrast=c("Species")`. - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Petal.Width | Difference | SE | 95% CI | t(144) | p - -------------------------------------------------------------------------------------------- - versicolor | setosa | 0.10 | -1.83 | 0.28 | [-2.38, -1.28] | -6.55 | < .001 - virginica | setosa | 0.10 | -1.55 | 0.31 | [-2.17, -0.93] | -4.95 | < .001 - virginica | versicolor | 0.10 | 0.28 | 0.41 | [-0.52, 1.08] | 0.69 | 0.492 - versicolor | setosa | 0.90 | -1.65 | 0.29 | [-2.22, -1.08] | -5.74 | < .001 - virginica | setosa | 0.90 | -1.71 | 0.32 | [-2.35, -1.07] | -5.28 | < .001 - virginica | versicolor | 0.90 | -0.06 | 0.21 | [-0.47, 0.35] | -0.28 | 0.780 - versicolor | setosa | 1.70 | -1.48 | 0.60 | [-2.67, -0.29] | -2.47 | 0.015 - virginica | setosa | 1.70 | -1.88 | 0.60 | [-3.06, -0.70] | -3.14 | 0.002 - virginica | versicolor | 1.70 | -0.40 | 0.11 | [-0.62, -0.17] | -3.50 | < .001 - versicolor | setosa | 2.50 | -1.31 | 0.95 | [-3.19, 0.58] | -1.37 | 0.172 - virginica | setosa | 2.50 | -2.04 | 0.92 | [-3.86, -0.22] | -2.21 | 0.028 - virginica | versicolor | 2.50 | -0.73 | 0.27 | [-1.27, -0.20] | -2.70 | 0.008 - - Variable predicted: Sepal.Width - Predictors contrasted: Species - p-values are uncorrected. - -# estimate_contrasts - test all combinations of contrast and by, with filtering - - Code - print(estimate_contrasts(model2, c("grp", "time", "x")), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(992) | p - -------------------------------------------------------------------------------------- - control, 1, b | control, 1, a | 0.15 | 0.13 | [-0.10, 0.40] | 1.20 | 0.231 - control, 2, a | control, 1, a | 0.03 | 0.13 | [-0.23, 0.28] | 0.19 | 0.847 - control, 2, b | control, 1, a | 0.09 | 0.13 | [-0.16, 0.34] | 0.73 | 0.465 - treatment, 1, a | control, 1, a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 - treatment, 1, b | control, 1, a | -0.03 | 0.13 | [-0.28, 0.22] | -0.22 | 0.824 - treatment, 2, a | control, 1, a | 0.02 | 0.13 | [-0.23, 0.27] | 0.19 | 0.850 - treatment, 2, b | control, 1, a | 0.05 | 0.12 | [-0.19, 0.28] | 0.37 | 0.712 - control, 2, a | control, 1, b | -0.12 | 0.13 | [-0.38, 0.13] | -0.97 | 0.332 - control, 2, b | control, 1, b | -0.06 | 0.12 | [-0.30, 0.19] | -0.46 | 0.648 - treatment, 1, a | control, 1, b | 0.04 | 0.13 | [-0.20, 0.29] | 0.34 | 0.730 - treatment, 1, b | control, 1, b | -0.18 | 0.12 | [-0.42, 0.06] | -1.45 | 0.147 - treatment, 2, a | control, 1, b | -0.13 | 0.12 | [-0.37, 0.12] | -1.02 | 0.307 - treatment, 2, b | control, 1, b | -0.10 | 0.12 | [-0.34, 0.13] | -0.89 | 0.376 - control, 2, b | control, 2, a | 0.07 | 0.13 | [-0.19, 0.32] | 0.52 | 0.604 - treatment, 1, a | control, 2, a | 0.17 | 0.13 | [-0.09, 0.43] | 1.26 | 0.207 - treatment, 1, b | control, 2, a | -0.05 | 0.13 | [-0.31, 0.20] | -0.41 | 0.680 - treatment, 2, a | control, 2, a | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 - treatment, 2, b | control, 2, a | 0.02 | 0.13 | [-0.23, 0.27] | 0.16 | 0.876 - treatment, 1, a | control, 2, b | 0.10 | 0.13 | [-0.15, 0.35] | 0.78 | 0.437 - treatment, 1, b | control, 2, b | -0.12 | 0.13 | [-0.37, 0.12] | -0.97 | 0.333 - treatment, 2, a | control, 2, b | -0.07 | 0.13 | [-0.32, 0.18] | -0.55 | 0.582 - treatment, 2, b | control, 2, b | -0.05 | 0.12 | [-0.29, 0.19] | -0.40 | 0.691 - treatment, 1, b | treatment, 1, a | -0.22 | 0.13 | [-0.47, 0.03] | -1.73 | 0.083 - treatment, 2, a | treatment, 1, a | -0.17 | 0.13 | [-0.42, 0.08] | -1.32 | 0.187 - treatment, 2, b | treatment, 1, a | -0.15 | 0.12 | [-0.39, 0.09] | -1.20 | 0.230 - treatment, 2, a | treatment, 1, b | 0.05 | 0.12 | [-0.19, 0.30] | 0.42 | 0.676 - treatment, 2, b | treatment, 1, b | 0.07 | 0.12 | [-0.16, 0.31] | 0.61 | 0.541 - treatment, 2, b | treatment, 2, a | 0.02 | 0.12 | [-0.21, 0.26] | 0.18 | 0.861 - - Variable predicted: score - Predictors contrasted: grp, time, x - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model2, c("grp", "time"), by = "x"), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | x | Difference | SE | 95% CI | t(992) | p - ------------------------------------------------------------------------------------ - control, 2 | control, 1 | a | 0.03 | 0.13 | [-0.23, 0.28] | 0.19 | 0.847 - treatment, 1 | control, 1 | a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 - treatment, 2 | control, 1 | a | 0.02 | 0.13 | [-0.23, 0.27] | 0.19 | 0.850 - treatment, 1 | control, 2 | a | 0.17 | 0.13 | [-0.09, 0.43] | 1.26 | 0.207 - treatment, 2 | control, 2 | a | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 - treatment, 2 | treatment, 1 | a | -0.17 | 0.13 | [-0.42, 0.08] | -1.32 | 0.187 - control, 2 | control, 1 | b | -0.06 | 0.12 | [-0.30, 0.19] | -0.46 | 0.648 - treatment, 1 | control, 1 | b | -0.18 | 0.12 | [-0.42, 0.06] | -1.45 | 0.147 - treatment, 2 | control, 1 | b | -0.10 | 0.12 | [-0.34, 0.13] | -0.89 | 0.376 - treatment, 1 | control, 2 | b | -0.12 | 0.13 | [-0.37, 0.12] | -0.97 | 0.333 - treatment, 2 | control, 2 | b | -0.05 | 0.12 | [-0.29, 0.19] | -0.40 | 0.691 - treatment, 2 | treatment, 1 | b | 0.07 | 0.12 | [-0.16, 0.31] | 0.61 | 0.541 - - Variable predicted: score - Predictors contrasted: grp, time - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model2, "grp", by = c("time", "x")), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | time | x | Difference | SE | 95% CI | t(992) | p - ----------------------------------------------------------------------------------- - treatment | control | 1 | a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 - treatment | control | 2 | a | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 - treatment | control | 1 | b | -0.18 | 0.12 | [-0.42, 0.06] | -1.45 | 0.147 - treatment | control | 2 | b | -0.05 | 0.12 | [-0.29, 0.19] | -0.40 | 0.691 - - Variable predicted: score - Predictors contrasted: grp - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model2, "grp", by = "time"), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | time | Difference | SE | 95% CI | t(992) | p - ------------------------------------------------------------------------------- - treatment | control | 1 | 0.01 | 0.09 | [-0.17, 0.18] | 0.09 | 0.931 - treatment | control | 2 | -0.02 | 0.09 | [-0.20, 0.15] | -0.28 | 0.780 - - Variable predicted: score - Predictors contrasted: grp - Predictors averaged: x - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model2, c("grp", "time", "x='a'")), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(992) | p - -------------------------------------------------------------------------------- - control, 2 | control, 1 | 0.03 | 0.13 | [-0.23, 0.28] | 0.19 | 0.847 - treatment, 1 | control, 1 | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 - treatment, 2 | control, 1 | 0.02 | 0.13 | [-0.23, 0.27] | 0.19 | 0.850 - treatment, 1 | control, 2 | 0.17 | 0.13 | [-0.09, 0.43] | 1.26 | 0.207 - treatment, 2 | control, 2 | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 - treatment, 2 | treatment, 1 | -0.17 | 0.13 | [-0.42, 0.08] | -1.32 | 0.187 - - Variable predicted: score - Predictors contrasted: grp, time, x='a' - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model2, c("grp", "time=1"), by = "x"), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | x | Difference | SE | 95% CI | t(992) | p - ---------------------------------------------------------------------------- - treatment | control | a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 - treatment | control | b | -0.18 | 0.12 | [-0.42, 0.06] | -1.45 | 0.147 - - Variable predicted: score - Predictors contrasted: grp, time=1 - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model2, "grp", by = c("time", "x='a'")), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | time | x | Difference | SE | 95% CI | t(992) | p - ----------------------------------------------------------------------------------- - treatment | control | 1 | a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 - treatment | control | 2 | a | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 - - Variable predicted: score - Predictors contrasted: grp - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model2, "time=c(1,2)", by = "grp"), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | grp | Difference | SE | 95% CI | t(994) | p - -------------------------------------------------------------------------------- - 2 | 1 | control | 0.14 | 0.11 | [-0.08, 0.36] | 1.24 | 0.216 - 2 | 1 | treatment | -0.07 | 0.11 | [-0.28, 0.14] | -0.63 | 0.529 - - Variable predicted: score - Predictors contrasted: time=c(1,2) - p-values are uncorrected. - ---- - - Code - print(estimate_contrasts(model2, c("grp", "time=2")), zap_small = TRUE, - table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(994) | p - ------------------------------------------------------------------------ - treatment | control | -0.15 | 0.11 | [-0.36, 0.05] | -1.47 | 0.143 - - Variable predicted: score - Predictors contrasted: grp, time=2 - p-values are uncorrected. - -# estimate_contrast, slopes with emmeans-2 - - Code - print(out, table_width = Inf) - Output - Marginal Contrasts Analysis - - Level1 | Level2 | Difference | 95% CI | p - ---------------------------------------------------------- - 0, 0.725 | 0, -2.012 | 1.12 | [0.37, 3.43] | 0.839 - 0, 3.463 | 0, -2.012 | 1.26 | [0.14, 11.76] | 0.839 - 1, -2.012 | 0, -2.012 | 1.00 | [0.35, 2.82] | 0.999 - 1, 0.725 | 0, -2.012 | 1.12 | [0.23, 5.43] | 0.887 - 1, 3.463 | 0, -2.012 | 1.26 | [0.10, 15.76] | 0.858 - 0, 3.463 | 0, 0.725 | 1.12 | [0.37, 3.43] | 0.839 - 1, -2.012 | 0, 0.725 | 0.89 | [0.20, 3.87] | 0.877 - 1, 0.725 | 0, 0.725 | 1.00 | [0.35, 2.82] | 0.999 - 1, 3.463 | 0, 0.725 | 1.12 | [0.23, 5.43] | 0.887 - 1, -2.012 | 0, 3.463 | 0.79 | [0.07, 8.71] | 0.849 - 1, 0.725 | 0, 3.463 | 0.89 | [0.20, 3.87] | 0.877 - 1, 3.463 | 0, 3.463 | 1.00 | [0.35, 2.82] | 0.999 - 1, 0.725 | 1, -2.012 | 1.12 | [0.37, 3.43] | 0.839 - 1, 3.463 | 1, -2.012 | 1.26 | [0.14, 11.76] | 0.839 - 1, 3.463 | 1, 0.725 | 1.12 | [0.37, 3.43] | 0.839 - - Variable predicted: outcome - Predictors contrasted: var_binom, var_cont - p-values are uncorrected. - Contrasts are on the exp-transformed link-scale. - diff --git a/tests/testthat/_snaps/estimate_means_mixed.md b/tests/testthat/_snaps/estimate_means_mixed.md index 5cc62fcbe..96bcbbfdd 100644 --- a/tests/testthat/_snaps/estimate_means_mixed.md +++ b/tests/testthat/_snaps/estimate_means_mixed.md @@ -3,7 +3,7 @@ Code estimate_means(m, c("mined", "spp"), backend = "marginaleffects", predict = "inverse_link") Output - Estimated Marginal Means + Conditional Predictions mined | spp | Mean | SE | 95% CI | z -------------------------------------------------- @@ -32,7 +32,7 @@ Code estimate_means(m, c("mined", "spp"), backend = "marginaleffects") Output - Estimated Marginal Means + Conditional Predictions mined | spp | Mean | SE | 95% CI | z -------------------------------------------------- @@ -61,7 +61,7 @@ Code estimate_means(m, c("mined", "spp"), backend = "marginaleffects") Output - Estimated Marginal Means + Conditional Predictions mined | spp | Mean | 95% CI ----------------------------------- diff --git a/tests/testthat/_snaps/transform_response.md b/tests/testthat/_snaps/transform_response.md index 7d0fd64a3..c9b28abea 100644 --- a/tests/testthat/_snaps/transform_response.md +++ b/tests/testthat/_snaps/transform_response.md @@ -3,7 +3,7 @@ Code out Output - Estimated Marginal Means + Conditional Predictions speed | Mean | SE | 95% CI | t(48) ------------------------------------------ @@ -27,7 +27,7 @@ Code out1 Output - Estimated Marginal Means + Conditional Predictions speed | Mean | 95% CI | df ------------------------------------- From 4a4dfb076cea4684c2e2e11ee58c883cb0d03acd Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 09:03:55 +0100 Subject: [PATCH 06/56] fix test --- tests/testthat/test-estimate_means_mixed.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-estimate_means_mixed.R b/tests/testthat/test-estimate_means_mixed.R index 14e8fd05c..c97b85c68 100644 --- a/tests/testthat/test-estimate_means_mixed.R +++ b/tests/testthat/test-estimate_means_mixed.R @@ -98,7 +98,7 @@ test_that("estimate_means() - mixed models", { c(0.20293, 0.08627, 0.07612, 0.04984), tolerance = 1e-3 ) - expect_equal(estim2$CI_low, c(0.13928, 0.04915, 0.04159, 0.02229), tolerance = 1e-3) + expect_equal(estim2$CI_low, c(0.13899, 0.04888, 0.04133, 0.02207), tolerance = 1e-3) expect_true(all(estim2$CI_low >= 0 & estim2$CI_low <= 1)) expect_true(all(estim2$CI_high >= 0 & estim2$CI_high <= 1)) From 59d1714512d17e459a6d0ec85cd421983c4b99dc Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 09:07:30 +0100 Subject: [PATCH 07/56] snaps --- tests/testthat/_snaps/brms.md | 8 ++++---- tests/testthat/_snaps/estimate_contrasts.md | 20 +++++++++---------- .../estimate_contrasts_counterfactual.md | 6 ++---- tests/testthat/_snaps/joint_test.md | 2 +- tests/testthat/test-brms.R | 6 +++--- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/tests/testthat/_snaps/brms.md b/tests/testthat/_snaps/brms.md index e96144b43..a203edd35 100644 --- a/tests/testthat/_snaps/brms.md +++ b/tests/testthat/_snaps/brms.md @@ -3,7 +3,7 @@ Code print(out) Output - Model-based Predictions: rt + Conditional Predictions: rt Row | rt | Predicted | SE | 95% CI -------------------------------------------- @@ -13,7 +13,7 @@ 4 | 1.54 | 1.20 | 0.85 | [0.32, 3.37] 5 | 1.48 | 1.19 | 0.83 | [0.33, 3.38] - Model-based Predictions: response + Conditional Predictions: response Row | response | Predicted | SE | 95% CI ------------------------------------------------ @@ -32,7 +32,7 @@ Code print(out, table_width = Inf) Output - Model-based Predictions: rt + Conditional Predictions: rt Row | rt | Predicted | SE | 95% CI | iter_1 | iter_2 | iter_3 ----------------------------------------------------------------------- @@ -42,7 +42,7 @@ 4 | 1.54 | 1.20 | 0.85 | [0.32, 3.37] | 0.42 | 1.29 | 1.28 5 | 1.48 | 1.19 | 0.83 | [0.33, 3.38] | 2.15 | 0.51 | 1.38 - Model-based Predictions: response + Conditional Predictions: response Row | response | Predicted | SE | 95% CI | iter_1 | iter_2 | iter_3 --------------------------------------------------------------------------- diff --git a/tests/testthat/_snaps/estimate_contrasts.md b/tests/testthat/_snaps/estimate_contrasts.md index ed63639be..acca9a65c 100644 --- a/tests/testthat/_snaps/estimate_contrasts.md +++ b/tests/testthat/_snaps/estimate_contrasts.md @@ -4,7 +4,7 @@ print(estimate_contrasts(model, contrast = c("vs", "am"), by = "gear", backend = "marginaleffects"), zap_small = TRUE, table_width = Inf) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | gear | Difference | SE | 95% CI | t(25) | p ------------------------------------------------------------------------------------ @@ -37,7 +37,7 @@ print(estimate_contrasts(m, c("time", "coffee"), backend = "marginaleffects", p_adjust = "none"), zap_small = TRUE, table_width = Inf) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | t(113) | p --------------------------------------------------------------------------------------------- @@ -69,7 +69,7 @@ p_adjust = "none", comparison = ratio ~ reference | coffee), zap_small = TRUE, table_width = Inf) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | coffee | Ratio | SE | 95% CI | t(113) | p ---------------------------------------------------------------------------- @@ -90,7 +90,7 @@ p_adjust = "none", comparison = "(b2-b1)=(b4-b3)"), zap_small = TRUE, table_width = Inf) Output - Marginal Contrasts Analysis + Conditional Contrasts Parameter | Difference | SE | 95% CI | t(113) | p ---------------------------------------------------------------- @@ -112,7 +112,7 @@ print(estimate_contrasts(m, c("time", "coffee"), backend = "marginaleffects", p_adjust = "none", comparison = "b5=b3"), zap_small = TRUE, table_width = Inf) Output - Marginal Contrasts Analysis + Conditional Contrasts Parameter | Difference | SE | 95% CI | t(113) | p -------------------------------------------------------------- @@ -132,7 +132,7 @@ estimate_contrasts(fit, c("e42dep", "c172code"), comparison = "b6-b3=0", backend = "marginaleffects") Output - Marginal Contrasts Analysis + Conditional Contrasts Parameter | Difference | SE | 95% CI | t(800) | p -------------------------------------------------------------- @@ -154,7 +154,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | z | p ----------------------------------------------------------------------------- @@ -174,7 +174,7 @@ Message We selected `contrast=c("Species")`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | z | p ----------------------------------------------------------------------------- @@ -195,7 +195,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | z | p ---------------------------------------------------------------------------- @@ -215,7 +215,7 @@ Message We selected `contrast=c("Species")`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | z | p ----------------------------------------------------------------------------- diff --git a/tests/testthat/_snaps/estimate_contrasts_counterfactual.md b/tests/testthat/_snaps/estimate_contrasts_counterfactual.md index 3bee94140..07a4f0709 100644 --- a/tests/testthat/_snaps/estimate_contrasts_counterfactual.md +++ b/tests/testthat/_snaps/estimate_contrasts_counterfactual.md @@ -3,7 +3,7 @@ Code print(out, table_width = Inf) Output - Counterfactual Contrasts Analysis (G-computation) + Marginal Contrasts (G-computation) Level1 | Level2 | Difference | SE | 95% CI | z | p ------------------------------------------------------------------ @@ -11,7 +11,6 @@ Variable predicted: QoL Predictors contrasted: treatment - Predictors averaged: time, education, hospital (0.95), age (0.22), phq4 (-0.076), ID p-values are uncorrected. --- @@ -19,7 +18,7 @@ Code print(out, table_width = Inf) Output - Counterfactual Contrasts Analysis (G-computation) + Marginal Contrasts (G-computation) Level1 | Level2 | time | Difference | SE | 95% CI | z | p ----------------------------------------------------------------------------- @@ -29,6 +28,5 @@ Variable predicted: QoL Predictors contrasted: treatment - Predictors averaged: education, hospital (0.95), age (0.22), phq4 (-0.076), ID p-values are uncorrected. diff --git a/tests/testthat/_snaps/joint_test.md b/tests/testthat/_snaps/joint_test.md index 2567a8d60..193122a89 100644 --- a/tests/testthat/_snaps/joint_test.md +++ b/tests/testthat/_snaps/joint_test.md @@ -3,7 +3,7 @@ Code estimate_contrasts(m, contrast = "time", by = "coffee", comparison = "joint") Output - Marginal Joint Test + Conditional Joint Test Contrast | coffee | df1 | df2 | F | p --------------------------------------------- diff --git a/tests/testthat/test-brms.R b/tests/testthat/test-brms.R index 93fb1fec1..056876280 100644 --- a/tests/testthat/test-brms.R +++ b/tests/testthat/test-brms.R @@ -140,7 +140,7 @@ test_that("estimate_means - brms, Wiener", { expect_identical( capture.output(print(est)), c( - "Estimated Marginal Means", + "onditional Predictions", "", "Median | 95% CI | pd | ROPE | % in ROPE", "--------------------------------------------------------", @@ -170,7 +170,7 @@ test_that("estimate_means - brms, Wiener, printing", { expect_identical( capture.output(print(est)), c( - "Estimated Marginal Means", + "Conditional Predictions", "", "x | Mu | 95% CI | pd | ROPE | % in ROPE", "----------------------------------------------------------", @@ -187,7 +187,7 @@ test_that("estimate_means - brms, Wiener, printing", { expect_identical( capture.output(print(cont)), c( - "Marginal Contrasts Analysis", + "Conditional Contrasts", "", "Level1 | Level2 | Median | 95% CI | pd | ROPE | % in ROPE", "--------------------------------------------------------------------------", From a33fc1e0af48b2ab899cd37af00cec3b4461cf89 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 09:09:58 +0100 Subject: [PATCH 08/56] snaps --- .../windows/estimate_contrasts_effectsize.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/testthat/_snaps/windows/estimate_contrasts_effectsize.md b/tests/testthat/_snaps/windows/estimate_contrasts_effectsize.md index b46a9e4db..169160fda 100644 --- a/tests/testthat/_snaps/windows/estimate_contrasts_effectsize.md +++ b/tests/testthat/_snaps/windows/estimate_contrasts_effectsize.md @@ -6,7 +6,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | t(147) | p ------------------------------------------------------------------------------ @@ -26,7 +26,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | t(147) | p ------------------------------------------------------------------------------ @@ -46,7 +46,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | t(147) | p ------------------------------------------------------------------------------ @@ -72,7 +72,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | t(147) | p | marginal_d ------------------------------------------------------------------------------------------- @@ -92,7 +92,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | t(147) | p ------------------------------------------------------------------------------ @@ -119,7 +119,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | t(147) | p ------------------------------------------------------------------------------ @@ -145,7 +145,7 @@ No variable was specified for contrast estimation. Selecting `contrast = "Species"`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | 95% CI | SE | t(147) | p ------------------------------------------------------------------------------ @@ -170,7 +170,7 @@ Message We selected `contrast=c("Species")`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | t(147) | p ------------------------------------------------------------------------------ @@ -189,7 +189,7 @@ Message We selected `contrast=c("Species")`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | t(147) | p ------------------------------------------------------------------------------ @@ -208,7 +208,7 @@ Message We selected `contrast=c("Species")`. Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | t(147) | p | marginal_d ------------------------------------------------------------------------------------------- From 98dfaae0fe4c06255a968ede36abd97e37d51a49 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 09:15:51 +0100 Subject: [PATCH 09/56] update snaps --- tests/testthat/_snaps/estimate_contrasts.md | 80 +++ .../_snaps/windows/estimate_contrasts.md | 608 ++++++++++++++++++ tests/testthat/test-estimate_contrasts.R | 324 ++++++---- 3 files changed, 888 insertions(+), 124 deletions(-) diff --git a/tests/testthat/_snaps/estimate_contrasts.md b/tests/testthat/_snaps/estimate_contrasts.md index acca9a65c..90e1eadcd 100644 --- a/tests/testthat/_snaps/estimate_contrasts.md +++ b/tests/testthat/_snaps/estimate_contrasts.md @@ -228,3 +228,83 @@ p-value adjustment method: Holm (1979) Contrasts are on the response-scale. +# estimate_contrasts - filtering works + + Code + print(estimate_contrasts(fit, c("c161sex", "c172code"), backend = "marginaleffects"), + table_width = Inf, zap_small = TRUE) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(825) | p + ------------------------------------------------------------------------------- + Male, mid | Male, low | 0.29 | 0.71 | [-1.10, 1.68] | 0.41 | 0.684 + Male, high | Male, low | 0.69 | 0.83 | [-0.95, 2.32] | 0.82 | 0.410 + Female, low | Male, low | 1.05 | 0.69 | [-0.31, 2.40] | 1.51 | 0.131 + Female, mid | Male, low | 0.85 | 0.64 | [-0.40, 2.10] | 1.33 | 0.183 + Female, high | Male, low | 1.65 | 0.71 | [ 0.24, 3.05] | 2.30 | 0.022 + Male, high | Male, mid | 0.40 | 0.68 | [-0.94, 1.73] | 0.59 | 0.558 + Female, low | Male, mid | 0.76 | 0.50 | [-0.22, 1.73] | 1.52 | 0.129 + Female, mid | Male, mid | 0.56 | 0.42 | [-0.26, 1.38] | 1.35 | 0.178 + Female, high | Male, mid | 1.36 | 0.53 | [ 0.32, 2.39] | 2.58 | 0.010 + Female, low | Male, high | 0.36 | 0.66 | [-0.95, 1.66] | 0.54 | 0.589 + Female, mid | Male, high | 0.16 | 0.61 | [-1.03, 1.35] | 0.27 | 0.789 + Female, high | Male, high | 0.96 | 0.69 | [-0.39, 2.30] | 1.40 | 0.163 + Female, mid | Female, low | -0.20 | 0.39 | [-0.96, 0.57] | -0.51 | 0.613 + Female, high | Female, low | 0.60 | 0.51 | [-0.39, 1.59] | 1.18 | 0.236 + Female, high | Female, mid | 0.80 | 0.43 | [-0.04, 1.63] | 1.87 | 0.061 + + Variable predicted: neg_c_7 + Predictors contrasted: c161sex, c172code + Predictors averaged: e16sex + p-values are uncorrected. + +# estimate_contrasts - examples from docs work as intendec + + Code + print(estimate_contrasts(model, contrast = "Petal.Width", by = "Species"), + zap_small = TRUE, table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(144) | p + ---------------------------------------------------------------------------- + versicolor | setosa | 0.22 | 0.46 | [-0.70, 1.13] | 0.47 | 0.640 + virginica | setosa | -0.21 | 0.44 | [-1.07, 0.66] | -0.47 | 0.638 + virginica | versicolor | -0.42 | 0.27 | [-0.95, 0.11] | -1.58 | 0.116 + + Variable predicted: Sepal.Width + Predictors contrasted: Petal.Width + Predictors averaged: Petal.Width (1.2) + p-values are uncorrected. + +# estimate_contrast, slopes with emmeans-2 + + Code + print(out, table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | 95% CI | p + ---------------------------------------------------------- + 0, 0.725 | 0, -2.012 | 1.12 | [0.37, 3.43] | 0.839 + 0, 3.463 | 0, -2.012 | 1.26 | [0.14, 11.76] | 0.839 + 1, -2.012 | 0, -2.012 | 1.00 | [0.35, 2.82] | 0.999 + 1, 0.725 | 0, -2.012 | 1.12 | [0.23, 5.43] | 0.887 + 1, 3.463 | 0, -2.012 | 1.26 | [0.10, 15.76] | 0.858 + 0, 3.463 | 0, 0.725 | 1.12 | [0.37, 3.43] | 0.839 + 1, -2.012 | 0, 0.725 | 0.89 | [0.20, 3.87] | 0.877 + 1, 0.725 | 0, 0.725 | 1.00 | [0.35, 2.82] | 0.999 + 1, 3.463 | 0, 0.725 | 1.12 | [0.23, 5.43] | 0.887 + 1, -2.012 | 0, 3.463 | 0.79 | [0.07, 8.71] | 0.849 + 1, 0.725 | 0, 3.463 | 0.89 | [0.20, 3.87] | 0.877 + 1, 3.463 | 0, 3.463 | 1.00 | [0.35, 2.82] | 0.999 + 1, 0.725 | 1, -2.012 | 1.12 | [0.37, 3.43] | 0.839 + 1, 3.463 | 1, -2.012 | 1.26 | [0.14, 11.76] | 0.839 + 1, 3.463 | 1, 0.725 | 1.12 | [0.37, 3.43] | 0.839 + + Variable predicted: outcome + Predictors contrasted: var_binom, var_cont + p-values are uncorrected. + Contrasts are on the exp-transformed link-scale. + diff --git a/tests/testthat/_snaps/windows/estimate_contrasts.md b/tests/testthat/_snaps/windows/estimate_contrasts.md index aa1afe550..db7ac5b9c 100644 --- a/tests/testthat/_snaps/windows/estimate_contrasts.md +++ b/tests/testthat/_snaps/windows/estimate_contrasts.md @@ -58,3 +58,611 @@ Predictors averaged: three, vs p-values are uncorrected. +# estimate_contrasts - filtering works + + Code + print(estimate_contrasts(fit, "c172code", backend = "marginaleffects"), + table_width = Inf, zap_small = TRUE) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(827) | p + -------------------------------------------------------------------- + mid | low | -0.09 | 0.34 | [-0.76, 0.58] | -0.25 | 0.802 + high | low | 0.61 | 0.43 | [-0.24, 1.45] | 1.40 | 0.162 + high | mid | 0.69 | 0.36 | [-0.02, 1.40] | 1.92 | 0.055 + + Variable predicted: neg_c_7 + Predictors contrasted: c172code + Predictors averaged: e16sex, c161sex + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(fit, "c161sex", "c172code", backend = "marginaleffects"), + table_width = Inf, zap_small = TRUE) + Output + Conditional Contrasts + + Level1 | Level2 | c172code | Difference | SE | 95% CI | t(825) | p + ------------------------------------------------------------------------------- + Female | Male | low | 1.05 | 0.69 | [-0.31, 2.40] | 1.51 | 0.131 + Female | Male | mid | 0.56 | 0.42 | [-0.26, 1.38] | 1.35 | 0.178 + Female | Male | high | 0.96 | 0.69 | [-0.39, 2.30] | 1.40 | 0.163 + + Variable predicted: neg_c_7 + Predictors contrasted: c161sex + Predictors averaged: e16sex + p-values are uncorrected. + +--- + + Code + print(estimate_slopes(fit, "barthtot", backend = "marginaleffects"), + table_width = Inf, zap_small = TRUE) + Output + Estimated Marginal Effects + + Slope | SE | 95% CI | t(810) | p + ----------------------------------------------- + -0.05 | 0.00 | [-0.06, -0.05] | -12.77 | < .001 + + Marginal effects estimated for barthtot + Type of slope was dY/dX + +--- + + Code + print(estimate_slopes(fit, "barthtot", by = "c172code", backend = "marginaleffects"), + table_width = Inf, zap_small = TRUE) + Output + Estimated Marginal Effects + + c172code | Slope | SE | 95% CI | t(808) | p + ---------------------------------------------------------- + low | -0.06 | 0.01 | [-0.08, -0.05] | -7.08 | < .001 + mid | -0.05 | 0.01 | [-0.06, -0.04] | -9.82 | < .001 + high | -0.05 | 0.01 | [-0.07, -0.03] | -4.53 | < .001 + + Marginal effects estimated for barthtot + Type of slope was dY/dX + +--- + + Code + print(estimate_contrasts(fit, "barthtot", "c172code", backend = "marginaleffects"), + table_width = Inf, zap_small = TRUE) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(808) | p + -------------------------------------------------------------------- + mid | low | 0.01 | 0.01 | [-0.01, 0.03] | 1.17 | 0.243 + high | low | 0.02 | 0.01 | [-0.01, 0.04] | 1.10 | 0.270 + high | mid | 0.00 | 0.01 | [-0.02, 0.03] | 0.27 | 0.786 + + Variable predicted: neg_c_7 + Predictors contrasted: barthtot + Predictors averaged: e16sex, barthtot (65) + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(fit, "barthtot", c("c172code", "e16sex"), backend = "marginaleffects"), + table_width = Inf, zap_small = TRUE) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(803) | p + ------------------------------------------------------------------------------- + low, female | low, male | -0.01 | 0.02 | [-0.04, 0.03] | -0.35 | 0.729 + mid, male | low, male | -0.01 | 0.02 | [-0.04, 0.02] | -0.46 | 0.648 + mid, female | low, male | 0.02 | 0.01 | [-0.01, 0.05] | 1.24 | 0.217 + high, male | low, male | 0.00 | 0.02 | [-0.05, 0.04] | -0.16 | 0.876 + high, female | low, male | 0.02 | 0.02 | [-0.01, 0.06] | 1.19 | 0.236 + mid, male | low, female | 0.00 | 0.02 | [-0.03, 0.03] | -0.08 | 0.940 + mid, female | low, female | 0.02 | 0.01 | [ 0.00, 0.05] | 1.76 | 0.079 + high, male | low, female | 0.00 | 0.02 | [-0.04, 0.05] | 0.12 | 0.908 + high, female | low, female | 0.03 | 0.02 | [-0.01, 0.06] | 1.58 | 0.115 + mid, female | mid, male | 0.03 | 0.01 | [ 0.00, 0.05] | 2.23 | 0.026 + high, male | mid, male | 0.00 | 0.02 | [-0.04, 0.05] | 0.18 | 0.859 + high, female | mid, male | 0.03 | 0.02 | [ 0.00, 0.06] | 1.83 | 0.068 + high, male | mid, female | -0.02 | 0.02 | [-0.06, 0.02] | -1.08 | 0.280 + high, female | mid, female | 0.00 | 0.01 | [-0.02, 0.03] | 0.26 | 0.792 + high, female | high, male | 0.03 | 0.02 | [-0.02, 0.07] | 1.11 | 0.269 + + Variable predicted: neg_c_7 + Predictors contrasted: barthtot + Predictors averaged: barthtot (65) + p-values are uncorrected. + +# estimate_contrasts - simple contrasts and with - in levels works + + Code + print(estimate_contrasts(model, "Species", backend = "marginaleffects"), + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(146) | p + ---------------------------------------------------------------------------- + versicolor | setosa | 1.46 | 0.11 | [1.24, 1.68] | 13.01 | < .001 + virginica | setosa | 1.95 | 0.10 | [1.75, 2.14] | 19.47 | < .001 + virginica | versicolor | 0.49 | 0.09 | [0.31, 0.67] | 5.41 | < .001 + + Variable predicted: Sepal.Length + Predictors contrasted: Species + Predictors averaged: Sepal.Width (3.1) + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(m, c("time", "coffee"), backend = "marginaleffects"), + zap_small = TRUE, table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(113) | p + --------------------------------------------------------------------------------------------- + morning, control | morning, coffee | -5.78 | 1.99 | [-9.73, -1.83] | -2.90 | 0.004 + noon, coffee | morning, coffee | -1.93 | 1.99 | [-5.88, 2.02] | -0.97 | 0.336 + noon, control | morning, coffee | 0.00 | 1.99 | [-3.95, 3.95] | 0.00 | > .999 + afternoon, coffee | morning, coffee | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 + afternoon, control | morning, coffee | 0.00 | 1.99 | [-3.95, 3.95] | 0.00 | > .999 + noon, coffee | morning, control | 3.86 | 1.99 | [-0.09, 7.81] | 1.93 | 0.056 + noon, control | morning, control | 5.78 | 1.99 | [ 1.83, 9.73] | 2.90 | 0.004 + afternoon, coffee | morning, control | 7.71 | 1.99 | [ 3.76, 11.66] | 3.87 | < .001 + afternoon, control | morning, control | 5.78 | 1.99 | [ 1.83, 9.73] | 2.90 | 0.004 + noon, control | noon, coffee | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 + afternoon, coffee | noon, coffee | 3.86 | 1.99 | [-0.09, 7.81] | 1.93 | 0.056 + afternoon, control | noon, coffee | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 + afternoon, coffee | noon, control | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 + afternoon, control | noon, control | 0.00 | 1.99 | [-3.95, 3.95] | 0.00 | > .999 + afternoon, control | afternoon, coffee | -1.93 | 1.99 | [-5.88, 2.02] | -0.97 | 0.336 + + Variable predicted: alertness + Predictors contrasted: time, coffee + Predictors averaged: sex + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(m, contrast = "time", by = "coffee", backend = "marginaleffects"), + zap_small = TRUE, table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | coffee | Difference | SE | 95% CI | t(113) | p + ----------------------------------------------------------------------------------- + noon | morning | coffee | -1.93 | 1.99 | [-5.88, 2.02] | -0.97 | 0.336 + afternoon | morning | coffee | 1.93 | 1.99 | [-2.02, 5.88] | 0.97 | 0.336 + afternoon | noon | coffee | 3.86 | 1.99 | [-0.09, 7.81] | 1.93 | 0.056 + noon | morning | control | 5.78 | 1.99 | [ 1.83, 9.73] | 2.90 | 0.004 + afternoon | morning | control | 5.78 | 1.99 | [ 1.83, 9.73] | 2.90 | 0.004 + afternoon | noon | control | 0.00 | 1.99 | [-3.95, 3.95] | 0.00 | > .999 + + Variable predicted: alertness + Predictors contrasted: time + Predictors averaged: sex + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model, contrast = c("mined", "spp"), backend = "marginaleffects"), + zap_small = TRUE, table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------- + yes, PR | yes, GP | 0.06 | 0.05 | [-0.04, 0.16] | 1.10 | 0.271 + yes, DM | yes, GP | 0.32 | 0.11 | [ 0.10, 0.54] | 2.89 | 0.004 + yes, EC-A | yes, GP | 0.04 | 0.05 | [-0.05, 0.13] | 0.80 | 0.421 + yes, EC-L | yes, GP | 0.17 | 0.08 | [ 0.02, 0.32] | 2.19 | 0.028 + yes, DES-L | yes, GP | 0.43 | 0.14 | [ 0.17, 0.70] | 3.19 | 0.001 + yes, DF | yes, GP | 0.43 | 0.14 | [ 0.17, 0.70] | 3.19 | 0.001 + no, GP | yes, GP | 2.59 | 0.55 | [ 1.50, 3.67] | 4.67 | < .001 + no, PR | yes, GP | 0.51 | 0.16 | [ 0.20, 0.82] | 3.21 | 0.001 + no, DM | yes, GP | 2.86 | 0.61 | [ 1.68, 4.05] | 4.73 | < .001 + no, EC-A | yes, GP | 1.10 | 0.27 | [ 0.57, 1.64] | 4.03 | < .001 + no, EC-L | yes, GP | 4.67 | 0.94 | [ 2.82, 6.52] | 4.95 | < .001 + no, DES-L | yes, GP | 4.62 | 0.93 | [ 2.79, 6.45] | 4.95 | < .001 + no, DF | yes, GP | 2.24 | 0.49 | [ 1.28, 3.20] | 4.58 | < .001 + yes, DM | yes, PR | 0.26 | 0.11 | [ 0.05, 0.48] | 2.43 | 0.015 + yes, EC-A | yes, PR | -0.02 | 0.06 | [-0.13, 0.09] | -0.33 | 0.740 + yes, EC-L | yes, PR | 0.11 | 0.08 | [-0.04, 0.27] | 1.43 | 0.154 + yes, DES-L | yes, PR | 0.38 | 0.13 | [ 0.12, 0.64] | 2.86 | 0.004 + yes, DF | yes, PR | 0.38 | 0.13 | [ 0.12, 0.64] | 2.86 | 0.004 + no, GP | yes, PR | 2.53 | 0.56 | [ 1.44, 3.62] | 4.54 | < .001 + no, PR | yes, PR | 0.45 | 0.16 | [ 0.13, 0.77] | 2.75 | 0.006 + no, DM | yes, PR | 2.80 | 0.61 | [ 1.61, 4.00] | 4.61 | < .001 + no, EC-A | yes, PR | 1.05 | 0.28 | [ 0.50, 1.59] | 3.76 | < .001 + no, EC-L | yes, PR | 4.61 | 0.95 | [ 2.76, 6.47] | 4.87 | < .001 + no, DES-L | yes, PR | 4.56 | 0.94 | [ 2.73, 6.40] | 4.87 | < .001 + no, DF | yes, PR | 2.18 | 0.49 | [ 1.22, 3.15] | 4.44 | < .001 + yes, EC-A | yes, DM | -0.28 | 0.11 | [-0.50, -0.07] | -2.59 | 0.010 + yes, EC-L | yes, DM | -0.15 | 0.11 | [-0.36, 0.06] | -1.39 | 0.164 + yes, DES-L | yes, DM | 0.11 | 0.13 | [-0.14, 0.36] | 0.89 | 0.375 + yes, DF | yes, DM | 0.11 | 0.13 | [-0.14, 0.36] | 0.89 | 0.375 + no, GP | yes, DM | 2.27 | 0.58 | [ 1.14, 3.40] | 3.93 | < .001 + no, PR | yes, DM | 0.19 | 0.20 | [-0.21, 0.58] | 0.93 | 0.352 + no, DM | yes, DM | 2.54 | 0.63 | [ 1.31, 3.77] | 4.04 | < .001 + no, EC-A | yes, DM | 0.78 | 0.31 | [ 0.18, 1.38] | 2.56 | 0.011 + no, EC-L | yes, DM | 4.35 | 0.96 | [ 2.46, 6.24] | 4.51 | < .001 + no, DES-L | yes, DM | 4.30 | 0.95 | [ 2.43, 6.17] | 4.51 | < .001 + no, DF | yes, DM | 1.92 | 0.51 | [ 0.91, 2.93] | 3.74 | < .001 + yes, EC-L | yes, EC-A | 0.13 | 0.08 | [-0.02, 0.29] | 1.68 | 0.093 + yes, DES-L | yes, EC-A | 0.40 | 0.13 | [ 0.14, 0.66] | 2.97 | 0.003 + yes, DF | yes, EC-A | 0.40 | 0.13 | [ 0.14, 0.66] | 2.97 | 0.003 + no, GP | yes, EC-A | 2.55 | 0.56 | [ 1.46, 3.64] | 4.58 | < .001 + no, PR | yes, EC-A | 0.47 | 0.16 | [ 0.15, 0.79] | 2.90 | 0.004 + no, DM | yes, EC-A | 2.82 | 0.61 | [ 1.63, 4.01] | 4.65 | < .001 + no, EC-A | yes, EC-A | 1.06 | 0.28 | [ 0.52, 1.61] | 3.85 | < .001 + no, EC-L | yes, EC-A | 4.63 | 0.95 | [ 2.78, 6.48] | 4.90 | < .001 + no, DES-L | yes, EC-A | 4.58 | 0.94 | [ 2.75, 6.42] | 4.90 | < .001 + no, DF | yes, EC-A | 2.20 | 0.49 | [ 1.24, 3.17] | 4.49 | < .001 + yes, DES-L | yes, EC-L | 0.26 | 0.13 | [ 0.02, 0.51] | 2.08 | 0.037 + yes, DF | yes, EC-L | 0.26 | 0.13 | [ 0.02, 0.51] | 2.08 | 0.037 + no, GP | yes, EC-L | 2.42 | 0.57 | [ 1.31, 3.53] | 4.28 | < .001 + no, PR | yes, EC-L | 0.34 | 0.18 | [-0.01, 0.69] | 1.89 | 0.058 + no, DM | yes, EC-L | 2.69 | 0.62 | [ 1.48, 3.90] | 4.37 | < .001 + no, EC-A | yes, EC-L | 0.93 | 0.29 | [ 0.37, 1.50] | 3.23 | 0.001 + no, EC-L | yes, EC-L | 4.50 | 0.95 | [ 2.63, 6.37] | 4.72 | < .001 + no, DES-L | yes, EC-L | 4.45 | 0.94 | [ 2.60, 6.30] | 4.71 | < .001 + no, DF | yes, EC-L | 2.07 | 0.50 | [ 1.09, 3.05] | 4.14 | < .001 + yes, DF | yes, DES-L | 0.00 | 0.13 | [-0.26, 0.26] | 0.00 | > .999 + no, GP | yes, DES-L | 2.15 | 0.59 | [ 1.00, 3.31] | 3.67 | < .001 + no, PR | yes, DES-L | 0.07 | 0.22 | [-0.36, 0.50] | 0.33 | 0.738 + no, DM | yes, DES-L | 2.43 | 0.64 | [ 1.18, 3.68] | 3.81 | < .001 + no, EC-A | yes, DES-L | 0.67 | 0.32 | [ 0.04, 1.29] | 2.09 | 0.037 + no, EC-L | yes, DES-L | 4.24 | 0.97 | [ 2.33, 6.14] | 4.36 | < .001 + no, DES-L | yes, DES-L | 4.19 | 0.96 | [ 2.30, 6.07] | 4.35 | < .001 + no, DF | yes, DES-L | 1.81 | 0.52 | [ 0.78, 2.83] | 3.45 | < .001 + no, GP | yes, DF | 2.15 | 0.59 | [ 1.00, 3.31] | 3.67 | < .001 + no, PR | yes, DF | 0.07 | 0.22 | [-0.36, 0.50] | 0.33 | 0.738 + no, DM | yes, DF | 2.43 | 0.64 | [ 1.18, 3.68] | 3.81 | < .001 + no, EC-A | yes, DF | 0.67 | 0.32 | [ 0.04, 1.29] | 2.09 | 0.037 + no, EC-L | yes, DF | 4.24 | 0.97 | [ 2.33, 6.14] | 4.36 | < .001 + no, DES-L | yes, DF | 4.19 | 0.96 | [ 2.30, 6.07] | 4.35 | < .001 + no, DF | yes, DF | 1.81 | 0.52 | [ 0.78, 2.83] | 3.45 | < .001 + no, PR | no, GP | -2.08 | 0.48 | [-3.02, -1.14] | -4.35 | < .001 + no, DM | no, GP | 0.27 | 0.37 | [-0.46, 1.00] | 0.73 | 0.466 + no, EC-A | no, GP | -1.49 | 0.41 | [-2.29, -0.68] | -3.61 | < .001 + no, EC-L | no, GP | 2.08 | 0.58 | [ 0.95, 3.21] | 3.61 | < .001 + no, DES-L | no, GP | 2.03 | 0.57 | [ 0.92, 3.15] | 3.57 | < .001 + no, DF | no, GP | -0.35 | 0.35 | [-1.04, 0.35] | -0.98 | 0.328 + no, DM | no, PR | 2.35 | 0.53 | [ 1.32, 3.39] | 4.47 | < .001 + no, EC-A | no, PR | 0.59 | 0.23 | [ 0.14, 1.05] | 2.56 | 0.011 + no, EC-L | no, PR | 4.16 | 0.86 | [ 2.49, 5.84] | 4.87 | < .001 + no, DES-L | no, PR | 4.11 | 0.85 | [ 2.45, 5.77] | 4.86 | < .001 + no, DF | no, PR | 1.73 | 0.42 | [ 0.92, 2.55] | 4.15 | < .001 + no, EC-A | no, DM | -1.76 | 0.46 | [-2.65, -0.87] | -3.86 | < .001 + no, EC-L | no, DM | 1.81 | 0.55 | [ 0.73, 2.89] | 3.29 | < .001 + no, DES-L | no, DM | 1.76 | 0.54 | [ 0.70, 2.82] | 3.24 | 0.001 + no, DF | no, DM | -0.62 | 0.38 | [-1.36, 0.12] | -1.65 | 0.100 + no, EC-L | no, EC-A | 3.57 | 0.77 | [ 2.07, 5.07] | 4.66 | < .001 + no, DES-L | no, EC-A | 3.52 | 0.76 | [ 2.03, 5.00] | 4.65 | < .001 + no, DF | no, EC-A | 1.14 | 0.36 | [ 0.43, 1.85] | 3.16 | 0.002 + no, DES-L | no, EC-L | -0.05 | 0.48 | [-0.99, 0.89] | -0.10 | 0.918 + no, DF | no, EC-L | -2.43 | 0.61 | [-3.63, -1.22] | -3.95 | < .001 + no, DF | no, DES-L | -2.38 | 0.61 | [-3.57, -1.19] | -3.92 | < .001 + + Variable predicted: count + Predictors contrasted: mined, spp + Predictors averaged: cover (8.7e-11), site + p-values are uncorrected. + Contrasts are on the response-scale. + +--- + + Code + print(estimate_contrasts(model, contrast = "mined", by = "spp", backend = "marginaleffects"), + zap_small = TRUE, table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | spp | Difference | SE | 95% CI | z | p + -------------------------------------------------------------------------- + no | yes | GP | 2.59 | 0.55 | [1.50, 3.67] | 4.67 | < .001 + no | yes | PR | 0.45 | 0.16 | [0.13, 0.77] | 2.75 | 0.006 + no | yes | DM | 2.54 | 0.63 | [1.31, 3.77] | 4.04 | < .001 + no | yes | EC-A | 1.06 | 0.28 | [0.52, 1.61] | 3.85 | < .001 + no | yes | EC-L | 4.50 | 0.95 | [2.63, 6.37] | 4.72 | < .001 + no | yes | DES-L | 4.19 | 0.96 | [2.30, 6.07] | 4.35 | < .001 + no | yes | DF | 1.81 | 0.52 | [0.78, 2.83] | 3.45 | < .001 + + Variable predicted: count + Predictors contrasted: mined + Predictors averaged: cover (8.7e-11), site + p-values are uncorrected. + Contrasts are on the response-scale. + +# estimate_contrasts - examples from docs work as intendec + + Code + print(estimate_contrasts(model, contrast = c("Species", "Petal.Width"), length = 2), + zap_small = TRUE, table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(144) | p + ---------------------------------------------------------------------------------------- + setosa, 2.5 | setosa, 0.1 | 2.01 | 0.98 | [ 0.08, 3.94] | 2.06 | 0.041 + versicolor, 0.1 | setosa, 0.1 | -1.83 | 0.28 | [-2.38, -1.28] | -6.55 | < .001 + versicolor, 2.5 | setosa, 0.1 | 0.70 | 0.27 | [ 0.17, 1.23] | 2.61 | 0.010 + virginica, 0.1 | setosa, 0.1 | -1.55 | 0.31 | [-2.17, -0.93] | -4.95 | < .001 + virginica, 2.5 | setosa, 0.1 | -0.03 | 0.11 | [-0.25, 0.19] | -0.29 | 0.773 + versicolor, 0.1 | setosa, 2.5 | -3.84 | 0.96 | [-5.73, -1.95] | -4.01 | < .001 + versicolor, 2.5 | setosa, 2.5 | -1.31 | 0.95 | [-3.19, 0.58] | -1.37 | 0.172 + virginica, 0.1 | setosa, 2.5 | -3.56 | 0.97 | [-5.47, -1.65] | -3.68 | < .001 + virginica, 2.5 | setosa, 2.5 | -2.04 | 0.92 | [-3.86, -0.22] | -2.21 | 0.028 + versicolor, 2.5 | versicolor, 0.1 | 2.53 | 0.52 | [ 1.50, 3.56] | 4.86 | < .001 + virginica, 0.1 | versicolor, 0.1 | 0.28 | 0.41 | [-0.52, 1.08] | 0.69 | 0.492 + virginica, 2.5 | versicolor, 0.1 | 1.80 | 0.28 | [ 1.24, 2.35] | 6.35 | < .001 + virginica, 0.1 | versicolor, 2.5 | -2.25 | 0.40 | [-3.04, -1.46] | -5.64 | < .001 + virginica, 2.5 | versicolor, 2.5 | -0.73 | 0.27 | [-1.27, -0.20] | -2.70 | 0.008 + virginica, 2.5 | virginica, 0.1 | 1.52 | 0.37 | [ 0.77, 2.26] | 4.04 | < .001 + + Variable predicted: Sepal.Width + Predictors contrasted: Species, Petal.Width + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model, contrast = c("Species", "Petal.Width=c(1, 2)")), + zap_small = TRUE, table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(144) | p + ------------------------------------------------------------------------------------ + setosa, 2 | setosa, 1 | 0.84 | 0.41 | [ 0.03, 1.64] | 2.06 | 0.041 + versicolor, 1 | setosa, 1 | -1.63 | 0.32 | [-2.27, -1.00] | -5.09 | < .001 + versicolor, 2 | setosa, 1 | -0.58 | 0.35 | [-1.26, 0.10] | -1.68 | 0.096 + virginica, 1 | setosa, 1 | -1.73 | 0.35 | [-2.43, -1.04] | -4.93 | < .001 + virginica, 2 | setosa, 1 | -1.10 | 0.31 | [-1.72, -0.48] | -3.52 | < .001 + versicolor, 1 | setosa, 2 | -2.47 | 0.72 | [-3.89, -1.05] | -3.43 | < .001 + versicolor, 2 | setosa, 2 | -1.42 | 0.73 | [-2.86, 0.03] | -1.94 | 0.055 + virginica, 1 | setosa, 2 | -2.57 | 0.73 | [-4.02, -1.12] | -3.50 | < .001 + virginica, 2 | setosa, 2 | -1.94 | 0.72 | [-3.35, -0.52] | -2.71 | 0.008 + versicolor, 2 | versicolor, 1 | 1.05 | 0.22 | [ 0.62, 1.48] | 4.86 | < .001 + virginica, 1 | versicolor, 1 | -0.10 | 0.19 | [-0.47, 0.27] | -0.54 | 0.589 + virginica, 2 | versicolor, 1 | 0.53 | 0.09 | [ 0.35, 0.71] | 5.72 | < .001 + virginica, 1 | versicolor, 2 | -1.15 | 0.23 | [-1.60, -0.71] | -5.13 | < .001 + virginica, 2 | versicolor, 2 | -0.52 | 0.16 | [-0.84, -0.21] | -3.31 | 0.001 + virginica, 2 | virginica, 1 | 0.63 | 0.16 | [ 0.32, 0.94] | 4.04 | < .001 + + Variable predicted: Sepal.Width + Predictors contrasted: Species, Petal.Width=c(1, 2) + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model, by = "Petal.Width", length = 4), zap_small = TRUE, + table_width = Inf) + Message + We selected `contrast=c("Species")`. + Output + Conditional Contrasts + + Level1 | Level2 | Petal.Width | Difference | SE | 95% CI | t(144) | p + -------------------------------------------------------------------------------------------- + versicolor | setosa | 0.10 | -1.83 | 0.28 | [-2.38, -1.28] | -6.55 | < .001 + virginica | setosa | 0.10 | -1.55 | 0.31 | [-2.17, -0.93] | -4.95 | < .001 + virginica | versicolor | 0.10 | 0.28 | 0.41 | [-0.52, 1.08] | 0.69 | 0.492 + versicolor | setosa | 0.90 | -1.65 | 0.29 | [-2.22, -1.08] | -5.74 | < .001 + virginica | setosa | 0.90 | -1.71 | 0.32 | [-2.35, -1.07] | -5.28 | < .001 + virginica | versicolor | 0.90 | -0.06 | 0.21 | [-0.47, 0.35] | -0.28 | 0.780 + versicolor | setosa | 1.70 | -1.48 | 0.60 | [-2.67, -0.29] | -2.47 | 0.015 + virginica | setosa | 1.70 | -1.88 | 0.60 | [-3.06, -0.70] | -3.14 | 0.002 + virginica | versicolor | 1.70 | -0.40 | 0.11 | [-0.62, -0.17] | -3.50 | < .001 + versicolor | setosa | 2.50 | -1.31 | 0.95 | [-3.19, 0.58] | -1.37 | 0.172 + virginica | setosa | 2.50 | -2.04 | 0.92 | [-3.86, -0.22] | -2.21 | 0.028 + virginica | versicolor | 2.50 | -0.73 | 0.27 | [-1.27, -0.20] | -2.70 | 0.008 + + Variable predicted: Sepal.Width + Predictors contrasted: Species + p-values are uncorrected. + +# estimate_contrasts - test all combinations of contrast and by, with filtering + + Code + print(estimate_contrasts(model2, c("grp", "time", "x")), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(992) | p + -------------------------------------------------------------------------------------- + control, 1, b | control, 1, a | 0.15 | 0.13 | [-0.10, 0.40] | 1.20 | 0.231 + control, 2, a | control, 1, a | 0.03 | 0.13 | [-0.23, 0.28] | 0.19 | 0.847 + control, 2, b | control, 1, a | 0.09 | 0.13 | [-0.16, 0.34] | 0.73 | 0.465 + treatment, 1, a | control, 1, a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 + treatment, 1, b | control, 1, a | -0.03 | 0.13 | [-0.28, 0.22] | -0.22 | 0.824 + treatment, 2, a | control, 1, a | 0.02 | 0.13 | [-0.23, 0.27] | 0.19 | 0.850 + treatment, 2, b | control, 1, a | 0.05 | 0.12 | [-0.19, 0.28] | 0.37 | 0.712 + control, 2, a | control, 1, b | -0.12 | 0.13 | [-0.38, 0.13] | -0.97 | 0.332 + control, 2, b | control, 1, b | -0.06 | 0.12 | [-0.30, 0.19] | -0.46 | 0.648 + treatment, 1, a | control, 1, b | 0.04 | 0.13 | [-0.20, 0.29] | 0.34 | 0.730 + treatment, 1, b | control, 1, b | -0.18 | 0.12 | [-0.42, 0.06] | -1.45 | 0.147 + treatment, 2, a | control, 1, b | -0.13 | 0.12 | [-0.37, 0.12] | -1.02 | 0.307 + treatment, 2, b | control, 1, b | -0.10 | 0.12 | [-0.34, 0.13] | -0.89 | 0.376 + control, 2, b | control, 2, a | 0.07 | 0.13 | [-0.19, 0.32] | 0.52 | 0.604 + treatment, 1, a | control, 2, a | 0.17 | 0.13 | [-0.09, 0.43] | 1.26 | 0.207 + treatment, 1, b | control, 2, a | -0.05 | 0.13 | [-0.31, 0.20] | -0.41 | 0.680 + treatment, 2, a | control, 2, a | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 + treatment, 2, b | control, 2, a | 0.02 | 0.13 | [-0.23, 0.27] | 0.16 | 0.876 + treatment, 1, a | control, 2, b | 0.10 | 0.13 | [-0.15, 0.35] | 0.78 | 0.437 + treatment, 1, b | control, 2, b | -0.12 | 0.13 | [-0.37, 0.12] | -0.97 | 0.333 + treatment, 2, a | control, 2, b | -0.07 | 0.13 | [-0.32, 0.18] | -0.55 | 0.582 + treatment, 2, b | control, 2, b | -0.05 | 0.12 | [-0.29, 0.19] | -0.40 | 0.691 + treatment, 1, b | treatment, 1, a | -0.22 | 0.13 | [-0.47, 0.03] | -1.73 | 0.083 + treatment, 2, a | treatment, 1, a | -0.17 | 0.13 | [-0.42, 0.08] | -1.32 | 0.187 + treatment, 2, b | treatment, 1, a | -0.15 | 0.12 | [-0.39, 0.09] | -1.20 | 0.230 + treatment, 2, a | treatment, 1, b | 0.05 | 0.12 | [-0.19, 0.30] | 0.42 | 0.676 + treatment, 2, b | treatment, 1, b | 0.07 | 0.12 | [-0.16, 0.31] | 0.61 | 0.541 + treatment, 2, b | treatment, 2, a | 0.02 | 0.12 | [-0.21, 0.26] | 0.18 | 0.861 + + Variable predicted: score + Predictors contrasted: grp, time, x + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model2, c("grp", "time"), by = "x"), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | x | Difference | SE | 95% CI | t(992) | p + ------------------------------------------------------------------------------------ + control, 2 | control, 1 | a | 0.03 | 0.13 | [-0.23, 0.28] | 0.19 | 0.847 + treatment, 1 | control, 1 | a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 + treatment, 2 | control, 1 | a | 0.02 | 0.13 | [-0.23, 0.27] | 0.19 | 0.850 + treatment, 1 | control, 2 | a | 0.17 | 0.13 | [-0.09, 0.43] | 1.26 | 0.207 + treatment, 2 | control, 2 | a | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 + treatment, 2 | treatment, 1 | a | -0.17 | 0.13 | [-0.42, 0.08] | -1.32 | 0.187 + control, 2 | control, 1 | b | -0.06 | 0.12 | [-0.30, 0.19] | -0.46 | 0.648 + treatment, 1 | control, 1 | b | -0.18 | 0.12 | [-0.42, 0.06] | -1.45 | 0.147 + treatment, 2 | control, 1 | b | -0.10 | 0.12 | [-0.34, 0.13] | -0.89 | 0.376 + treatment, 1 | control, 2 | b | -0.12 | 0.13 | [-0.37, 0.12] | -0.97 | 0.333 + treatment, 2 | control, 2 | b | -0.05 | 0.12 | [-0.29, 0.19] | -0.40 | 0.691 + treatment, 2 | treatment, 1 | b | 0.07 | 0.12 | [-0.16, 0.31] | 0.61 | 0.541 + + Variable predicted: score + Predictors contrasted: grp, time + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model2, "grp", by = c("time", "x")), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | time | x | Difference | SE | 95% CI | t(992) | p + ----------------------------------------------------------------------------------- + treatment | control | 1 | a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 + treatment | control | 2 | a | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 + treatment | control | 1 | b | -0.18 | 0.12 | [-0.42, 0.06] | -1.45 | 0.147 + treatment | control | 2 | b | -0.05 | 0.12 | [-0.29, 0.19] | -0.40 | 0.691 + + Variable predicted: score + Predictors contrasted: grp + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model2, "grp", by = "time"), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | time | Difference | SE | 95% CI | t(992) | p + ------------------------------------------------------------------------------- + treatment | control | 1 | 0.01 | 0.09 | [-0.17, 0.18] | 0.09 | 0.931 + treatment | control | 2 | -0.02 | 0.09 | [-0.20, 0.15] | -0.28 | 0.780 + + Variable predicted: score + Predictors contrasted: grp + Predictors averaged: x + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model2, c("grp", "time", "x='a'")), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(992) | p + -------------------------------------------------------------------------------- + control, 2 | control, 1 | 0.03 | 0.13 | [-0.23, 0.28] | 0.19 | 0.847 + treatment, 1 | control, 1 | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 + treatment, 2 | control, 1 | 0.02 | 0.13 | [-0.23, 0.27] | 0.19 | 0.850 + treatment, 1 | control, 2 | 0.17 | 0.13 | [-0.09, 0.43] | 1.26 | 0.207 + treatment, 2 | control, 2 | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 + treatment, 2 | treatment, 1 | -0.17 | 0.13 | [-0.42, 0.08] | -1.32 | 0.187 + + Variable predicted: score + Predictors contrasted: grp, time, x='a' + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model2, c("grp", "time=1"), by = "x"), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | x | Difference | SE | 95% CI | t(992) | p + ---------------------------------------------------------------------------- + treatment | control | a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 + treatment | control | b | -0.18 | 0.12 | [-0.42, 0.06] | -1.45 | 0.147 + + Variable predicted: score + Predictors contrasted: grp, time=1 + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model2, "grp", by = c("time", "x='a'")), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | time | x | Difference | SE | 95% CI | t(992) | p + ----------------------------------------------------------------------------------- + treatment | control | 1 | a | 0.19 | 0.13 | [-0.06, 0.45] | 1.49 | 0.137 + treatment | control | 2 | a | 0.00 | 0.13 | [-0.26, 0.25] | -0.01 | 0.991 + + Variable predicted: score + Predictors contrasted: grp + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model2, "time=c(1,2)", by = "grp"), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | grp | Difference | SE | 95% CI | t(994) | p + -------------------------------------------------------------------------------- + 2 | 1 | control | 0.14 | 0.11 | [-0.08, 0.36] | 1.24 | 0.216 + 2 | 1 | treatment | -0.07 | 0.11 | [-0.28, 0.14] | -0.63 | 0.529 + + Variable predicted: score + Predictors contrasted: time=c(1,2) + p-values are uncorrected. + +--- + + Code + print(estimate_contrasts(model2, c("grp", "time=2")), zap_small = TRUE, + table_width = Inf) + Output + Conditional Contrasts + + Level1 | Level2 | Difference | SE | 95% CI | t(994) | p + ------------------------------------------------------------------------ + treatment | control | -0.15 | 0.11 | [-0.36, 0.05] | -1.47 | 0.143 + + Variable predicted: score + Predictors contrasted: grp, time=2 + p-values are uncorrected. + diff --git a/tests/testthat/test-estimate_contrasts.R b/tests/testthat/test-estimate_contrasts.R index aec502ae1..6b5e09c58 100644 --- a/tests/testthat/test-estimate_contrasts.R +++ b/tests/testthat/test-estimate_contrasts.R @@ -1078,8 +1078,6 @@ test_that("estimate_contrasts - different options for comparison", { }) -skip_on_os(c("mac", "linux")) - test_that("estimate_contrasts - filtering works", { data(efc, package = "modelbased") @@ -1087,11 +1085,14 @@ test_that("estimate_contrasts - filtering works", { efc <- datawizard::to_factor(efc, c("c161sex", "c172code", "e16sex")) levels(efc$c172code) <- c("low", "mid", "high") fit <- lm(neg_c_7 ~ e16sex + c161sex + c172code, data = efc) - expect_snapshot(print( - estimate_contrasts(fit, "c172code", backend = "marginaleffects"), - table_width = Inf, - zap_small = TRUE - )) + expect_snapshot( + print( + estimate_contrasts(fit, "c172code", backend = "marginaleffects"), + table_width = Inf, + zap_small = TRUE + ), + variant = "windows" + ) fit <- lm(neg_c_7 ~ e16sex + c161sex * c172code, data = efc) expect_snapshot(print( @@ -1099,18 +1100,24 @@ test_that("estimate_contrasts - filtering works", { table_width = Inf, zap_small = TRUE )) - expect_snapshot(print( - estimate_contrasts(fit, "c161sex", "c172code", backend = "marginaleffects"), - table_width = Inf, - zap_small = TRUE - )) + expect_snapshot( + print( + estimate_contrasts(fit, "c161sex", "c172code", backend = "marginaleffects"), + table_width = Inf, + zap_small = TRUE + ), + variant = "windows" + ) fit <- lm(neg_c_7 ~ barthtot + c161sex + c172code, data = efc) - expect_snapshot(print( - estimate_slopes(fit, "barthtot", backend = "marginaleffects"), - table_width = Inf, - zap_small = TRUE - )) + expect_snapshot( + print( + estimate_slopes(fit, "barthtot", backend = "marginaleffects"), + table_width = Inf, + zap_small = TRUE + ), + variant = "windows" + ) # error expect_error( estimate_contrasts(fit, "barthtot", backend = "marginaleffects"), @@ -1118,27 +1125,36 @@ test_that("estimate_contrasts - filtering works", { ) fit <- lm(neg_c_7 ~ e16sex + barthtot * c172code, data = efc) - expect_snapshot(print( - estimate_slopes(fit, "barthtot", by = "c172code", backend = "marginaleffects"), - table_width = Inf, - zap_small = TRUE - )) - expect_snapshot(print( - estimate_contrasts(fit, "barthtot", "c172code", backend = "marginaleffects"), - table_width = Inf, - zap_small = TRUE - )) + expect_snapshot( + print( + estimate_slopes(fit, "barthtot", by = "c172code", backend = "marginaleffects"), + table_width = Inf, + zap_small = TRUE + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(fit, "barthtot", "c172code", backend = "marginaleffects"), + table_width = Inf, + zap_small = TRUE + ), + variant = "windows" + ) fit <- lm(neg_c_7 ~ e16sex * barthtot * c172code, data = efc) - expect_snapshot(print( - estimate_contrasts( - fit, - "barthtot", - c("c172code", "e16sex"), - backend = "marginaleffects" + expect_snapshot( + print( + estimate_contrasts( + fit, + "barthtot", + c("c172code", "e16sex"), + backend = "marginaleffects" + ), + table_width = Inf, + zap_small = TRUE ), - table_width = Inf, - zap_small = TRUE - )) + variant = "windows" + ) # error expect_error( estimate_contrasts(fit, c("barthtot", "c172code"), backend = "marginaleffects"), @@ -1152,24 +1168,38 @@ test_that("estimate_contrasts - simple contrasts and with - in levels works", { data(iris) model <- lm(Sepal.Length ~ Species + Sepal.Width, data = iris) - expect_snapshot(print( - estimate_contrasts(model, "Species", backend = "marginaleffects"), - table_width = Inf - )) + expect_snapshot( + print( + estimate_contrasts(model, "Species", backend = "marginaleffects"), + table_width = Inf + ), + variant = "windows" + ) data(coffee_data, package = "modelbased") m <- lm(alertness ~ time * coffee + sex, data = coffee_data) - expect_snapshot(print( - estimate_contrasts(m, c("time", "coffee"), backend = "marginaleffects"), - zap_small = TRUE, - table_width = Inf - )) + expect_snapshot( + print( + estimate_contrasts(m, c("time", "coffee"), backend = "marginaleffects"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) - expect_snapshot(print( - estimate_contrasts(m, contrast = "time", by = "coffee", backend = "marginaleffects"), - zap_small = TRUE, - table_width = Inf - )) + expect_snapshot( + print( + estimate_contrasts( + m, + contrast = "time", + by = "coffee", + backend = "marginaleffects" + ), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) data(Salamanders, package = "glmmTMB") model <- glmmTMB::glmmTMB( @@ -1177,21 +1207,31 @@ test_that("estimate_contrasts - simple contrasts and with - in levels works", { data = Salamanders, family = "poisson" ) - expect_snapshot(print( - estimate_contrasts(model, contrast = c("mined", "spp"), backend = "marginaleffects"), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts( - model, - contrast = "mined", - by = "spp", - backend = "marginaleffects" + expect_snapshot( + print( + estimate_contrasts( + model, + contrast = c("mined", "spp"), + backend = "marginaleffects" + ), + zap_small = TRUE, + table_width = Inf ), - zap_small = TRUE, - table_width = Inf - )) + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts( + model, + contrast = "mined", + by = "spp", + backend = "marginaleffects" + ), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) }) @@ -1388,21 +1428,30 @@ test_that("estimate_contrasts - examples from docs work as intendec", { zap_small = TRUE, table_width = Inf )) - expect_snapshot(print( - estimate_contrasts(model, contrast = c("Species", "Petal.Width"), length = 2), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model, contrast = c("Species", "Petal.Width=c(1, 2)")), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model, by = "Petal.Width", length = 4), - zap_small = TRUE, - table_width = Inf - )) + expect_snapshot( + print( + estimate_contrasts(model, contrast = c("Species", "Petal.Width"), length = 2), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model, contrast = c("Species", "Petal.Width=c(1, 2)")), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model, by = "Petal.Width", length = 4), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) }) @@ -1418,41 +1467,62 @@ test_that("estimate_contrasts - test all combinations of contrast and by, with f ) model2 <- lm(score ~ grp * time * x, data = d) - expect_snapshot(print( - estimate_contrasts(model2, c("grp", "time", "x")), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model2, c("grp", "time"), by = "x"), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model2, "grp", by = c("time", "x")), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model2, "grp", by = "time"), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model2, c("grp", "time", "x='a'")), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model2, c("grp", "time=1"), by = "x"), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model2, "grp", by = c("time", "x='a'")), - zap_small = TRUE, - table_width = Inf - )) + expect_snapshot( + print( + estimate_contrasts(model2, c("grp", "time", "x")), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model2, c("grp", "time"), by = "x"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model2, "grp", by = c("time", "x")), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model2, "grp", by = "time"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model2, c("grp", "time", "x='a'")), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model2, c("grp", "time=1"), by = "x"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model2, "grp", by = c("time", "x='a'")), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) set.seed(123) n <- 1000 @@ -1463,16 +1533,22 @@ test_that("estimate_contrasts - test all combinations of contrast and by, with f ) model2 <- lm(score ~ grp * time, data = d) - expect_snapshot(print( - estimate_contrasts(model2, "time=c(1,2)", by = "grp"), - zap_small = TRUE, - table_width = Inf - )) - expect_snapshot(print( - estimate_contrasts(model2, c("grp", "time=2")), - zap_small = TRUE, - table_width = Inf - )) + expect_snapshot( + print( + estimate_contrasts(model2, "time=c(1,2)", by = "grp"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) + expect_snapshot( + print( + estimate_contrasts(model2, c("grp", "time=2")), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) }) From b4d61935f7216f326aff5c7f44d1302b95f936b7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:05:12 +0100 Subject: [PATCH 10/56] fix --- tests/testthat/test-brms.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-brms.R b/tests/testthat/test-brms.R index 056876280..d1903693a 100644 --- a/tests/testthat/test-brms.R +++ b/tests/testthat/test-brms.R @@ -140,7 +140,7 @@ test_that("estimate_means - brms, Wiener", { expect_identical( capture.output(print(est)), c( - "onditional Predictions", + "Conditional Predictions", "", "Median | 95% CI | pd | ROPE | % in ROPE", "--------------------------------------------------------", From 1b5e8ef3bfd1f959494b95a2dd95a3aef07a3256 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:12:56 +0100 Subject: [PATCH 11/56] snaps --- tests/testthat/_snaps/windows/estimate_contrasts.md | 4 ++-- tests/testthat/test-estimate_contrasts_context.R | 4 ++-- tests/testthat/test-estimate_contrasts_counterfactual.R | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/testthat/_snaps/windows/estimate_contrasts.md b/tests/testthat/_snaps/windows/estimate_contrasts.md index db7ac5b9c..e111f8afc 100644 --- a/tests/testthat/_snaps/windows/estimate_contrasts.md +++ b/tests/testthat/_snaps/windows/estimate_contrasts.md @@ -4,7 +4,7 @@ print(estimate_contrasts(model, contrast = c("three", "vs", "am"), backend = "marginaleffects"), digits = 1, zap_small = TRUE, table_width = Inf) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | t(24) | p ---------------------------------------------------------------------------------------------- @@ -47,7 +47,7 @@ print(estimate_contrasts(model, contrast = "am", backend = "marginaleffects"), zap_small = TRUE, table_width = Inf) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | t(24) | p ------------------------------------------------------------------- diff --git a/tests/testthat/test-estimate_contrasts_context.R b/tests/testthat/test-estimate_contrasts_context.R index 5929f03af..d96345420 100644 --- a/tests/testthat/test-estimate_contrasts_context.R +++ b/tests/testthat/test-estimate_contrasts_context.R @@ -76,7 +76,7 @@ test_that("estimate_contrast, context effects, linear", { expect_identical( capture.output(out), c( - "Marginal Contrasts Analysis", + "Conditional Contrasts", "", "sex | year | Difference | SE | 95% CI | z | p", "-------------------------------------------------------------------", @@ -100,7 +100,7 @@ test_that("estimate_contrast, context effects, linear", { expect_identical( capture.output(out), c( - "Marginal Contrasts Analysis", + "Conditional Contrasts", "", "Level1 | Level2 | year | Difference | SE | 95% CI | z | p", "--------------------------------------------------------------------------", diff --git a/tests/testthat/test-estimate_contrasts_counterfactual.R b/tests/testthat/test-estimate_contrasts_counterfactual.R index fb73e27f3..bc4794fbe 100644 --- a/tests/testthat/test-estimate_contrasts_counterfactual.R +++ b/tests/testthat/test-estimate_contrasts_counterfactual.R @@ -35,7 +35,7 @@ test_that("estimate_contrast, counterfactual", { ) expect_identical( attributes(out2)$table_title, - c("Counterfactual Contrasts Analysis (G-computation)", "blue") + c("Marginal Contrasts (G-computation)", "blue") ) out1 <- marginaleffects::avg_comparisons( From 911e213fc8c6b780f2a7d68e1a96cf6d81ba3894 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:15:46 +0100 Subject: [PATCH 12/56] snap --- .../plot-ordinal/plot-ordinal-bracl.new.svg | 85 +++ tests/testthat/_snaps/print.md | 42 +- .../estimate_contrasts_counterfactual.new.md | 20 + .../estimate_means_counterfactuals.new.md | 139 +++++ tests/testthat/_snaps/windows/ordinal.new.md | 224 +++++++ tests/testthat/_snaps/windows/print.new.md | 584 ++++++++++++++++++ 6 files changed, 1073 insertions(+), 21 deletions(-) create mode 100644 tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.new.svg create mode 100644 tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.new.md create mode 100644 tests/testthat/_snaps/windows/estimate_means_counterfactuals.new.md create mode 100644 tests/testthat/_snaps/windows/ordinal.new.md create mode 100644 tests/testthat/_snaps/windows/print.new.md diff --git a/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.new.svg b/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.new.svg new file mode 100644 index 000000000..48b824030 --- /dev/null +++ b/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.new.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +10% +20% +30% +40% +50% + + + + + + + +male +female +gender +Probability of research + +Response + + + + + + + + + + + + +definitely +probably +probably not +definitely not +plot-ordinal-bracl + + diff --git a/tests/testthat/_snaps/print.md b/tests/testthat/_snaps/print.md index e6edff890..d0d14ab0d 100644 --- a/tests/testthat/_snaps/print.md +++ b/tests/testthat/_snaps/print.md @@ -35,7 +35,7 @@ | Variable predicted: neg_c_7
Predictors modulated: c12hour = c(50, 100), c172code, | | c161sex
Predictors averaged: barthtot (65) | +=========+=================================+=========+=======+======+================+========+ - Table: Estimated Marginal Means + Table: Conditional Predictions # estimate_contrasts - by with special character @@ -43,7 +43,7 @@ print(estimate_contrasts(fit, "c172code", "barthtot = [sd]", backend = "marginaleffects", p_adjust = "holm"), table_width = Inf, zap_small = TRUE) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | barthtot | Difference | SE | 95% CI | t(810) | p -------------------------------------------------------------------------------- @@ -67,7 +67,7 @@ print(estimate_contrasts(fit, c("c172code", "barthtot = [sd]"), backend = "marginaleffects", p_adjust = "holm"), table_width = Inf, zap_small = TRUE) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | t(810) | p ---------------------------------------------------------------------------------- @@ -118,7 +118,7 @@ print(estimate_contrasts(fit, "c172code", "barthtot = [sd]", backend = "marginaleffects"), table_width = Inf, zap_small = TRUE) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | barthtot | Difference | SE | 95% CI | t(810) | p ------------------------------------------------------------------------------- @@ -142,7 +142,7 @@ print(estimate_contrasts(fit, c("c172code", "barthtot = [sd]"), backend = "marginaleffects"), table_width = Inf, zap_small = TRUE) Output - Marginal Contrasts Analysis + Conditional Contrasts Level1 | Level2 | Difference | SE | 95% CI | t(810) | p ---------------------------------------------------------------------------------- @@ -194,7 +194,7 @@ "Female", "Male")), backend = "marginaleffects"), table_width = Inf, zap_small = TRUE) Output - Estimated Marginal Means + Conditional Predictions c172code | c161sex | Mean | SE | 95% CI | t(825) ----------------------------------------------------------- @@ -214,7 +214,7 @@ "c161sex = c('Female', 'Male')"), backend = "marginaleffects"), table_width = Inf, zap_small = TRUE) Output - Estimated Marginal Means + Conditional Predictions c172code | c161sex | Mean | SE | 95% CI | t(825) ----------------------------------------------------------- @@ -232,7 +232,7 @@ Code print(estimate_expectation(m, by = "spp", predict = "conditional"), zap_small = TRUE) Output - Model-based Predictions + Conditional Predictions spp | Predicted | SE | CI --------------------------------------- @@ -254,7 +254,7 @@ Code print(out) Output - Estimated Marginal Means + Conditional Predictions Species | Mean | SE | 95% CI | t(147) ------------------------------------------------ @@ -270,9 +270,9 @@ Code print(out, select = "minimal") Output - Estimated Marginal Means + Conditional Predictions - Species | Mean (CI) + Species | Mean (95% CI) ------------------------------ setosa | 1.46 (1.34, 1.58) versicolor | 4.26 (4.14, 4.38) @@ -286,13 +286,13 @@ Code print(out, select = "minimal") Output - Marginal Contrasts Analysis + Conditional Contrasts - Level1 | Level2 | Difference (CI) | p - ---------------------------------------------------- - versicolor | setosa | 2.80 (2.63, 2.97) | <0.001 - virginica | setosa | 4.09 (3.92, 4.26) | <0.001 - virginica | versicolor | 1.29 (1.12, 1.46) | <0.001 + Level1 | Level2 | Difference (95% CI) | p + ------------------------------------------------------ + versicolor | setosa | 2.80 (2.63, 2.97) | <0.001 + virginica | setosa | 4.09 (3.92, 4.26) | <0.001 + virginica | versicolor | 1.29 (1.12, 1.46) | <0.001 Variable predicted: Petal.Length Predictors contrasted: Species @@ -303,9 +303,9 @@ Code print(out, select = "{estimate}{stars}|{ci}") Output - Marginal Contrasts Analysis + Conditional Contrasts - Level1 | Level2 | Difference | CI + Level1 | Level2 | Difference | 95% CI ------------------------------------------------- versicolor | setosa | 2.80*** | 2.63, 2.97 virginica | setosa | 4.09*** | 3.92, 4.26 @@ -320,7 +320,7 @@ Code print(estimate_relation(m, by = "qsec")) Output - Model-based Predictions + Conditional Predictions qsec | Predicted | SE | 95% CI --------------------------------------- @@ -344,7 +344,7 @@ Code print(estimate_relation(m, by = "qsec"), include_grid = TRUE) Output - Model-based Predictions + Conditional Predictions qsec | mpg | Predicted | SE | 95% CI ----------------------------------------------- diff --git a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.new.md b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.new.md new file mode 100644 index 000000000..73c64943d --- /dev/null +++ b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.new.md @@ -0,0 +1,20 @@ +# estimate_contrast, counterfactual, snapshots, Level-columns + + Code + print(out, table_width = Inf) + Output + Marginal Contrasts (G-computation) + + Level1 | Level2 | treatment | Difference | SE | 95% CI | z | p + --------------------------------------------------------------------------------- + post | pre | control | 1.85 | 1.22 | [-0.53, 4.23] | 1.52 | 0.128 + end | pre | control | 0.86 | 1.21 | [-1.51, 3.24] | 0.71 | 0.477 + end | post | control | -0.99 | 1.22 | [-3.37, 1.39] | -0.81 | 0.417 + post | pre | tx | 6.57 | 1.57 | [ 3.50, 9.65] | 4.19 | < .001 + end | pre | tx | 17.26 | 1.57 | [14.18, 20.34] | 10.99 | < .001 + end | post | tx | 10.69 | 1.57 | [ 7.62, 13.76] | 6.82 | < .001 + + Variable predicted: QoL + Predictors contrasted: time + p-values are uncorrected. + diff --git a/tests/testthat/_snaps/windows/estimate_means_counterfactuals.new.md b/tests/testthat/_snaps/windows/estimate_means_counterfactuals.new.md new file mode 100644 index 000000000..14e1ca9bf --- /dev/null +++ b/tests/testthat/_snaps/windows/estimate_means_counterfactuals.new.md @@ -0,0 +1,139 @@ +# estimate_means() - counterfactuals + + Code + print(estimate_means(m, "spp", backend = "marginaleffects"), zap_small = TRUE, + table_width = Inf) + Output + Conditional Predictions + + spp | Mean | SE | 95% CI | z + ----------------------------------------- + GP | 1.24 | 0.22 | [0.80, 1.67] | 5.55 + PR | 0.31 | 0.08 | [0.16, 0.46] | 4.08 + DM | 1.56 | 0.27 | [1.02, 2.09] | 5.72 + EC-A | 0.57 | 0.12 | [0.34, 0.81] | 4.81 + EC-L | 2.30 | 0.39 | [1.54, 3.06] | 5.96 + DES-L | 2.44 | 0.41 | [1.64, 3.24] | 5.99 + DF | 1.34 | 0.24 | [0.87, 1.81] | 5.62 + + Variable predicted: count + Predictors modulated: spp + Predictors averaged: mined, site + Predictions are on the response-scale. + +--- + + Code + print(estimate_means(m, "spp", backend = "marginaleffects", estimate = "population"), + zap_small = TRUE, table_width = Inf) + Output + Marginal Predictions (G-computation) + + spp | Mean | SE | 95% CI | z + ----------------------------------------- + GP | 1.17 | 0.21 | [0.76, 1.58] | 5.60 + PR | 0.29 | 0.07 | [0.15, 0.43] | 4.09 + DM | 1.48 | 0.26 | [0.97, 1.98] | 5.77 + EC-A | 0.54 | 0.11 | [0.32, 0.76] | 4.84 + EC-L | 2.18 | 0.36 | [1.47, 2.89] | 6.01 + DES-L | 2.31 | 0.38 | [1.56, 3.06] | 6.04 + DF | 1.27 | 0.22 | [0.83, 1.71] | 5.66 + + Variable predicted: count + Predictors modulated: spp + Predictions are on the response-scale. + +--- + + Code + print(estimate_means(m, "spp", backend = "marginaleffects", predict = "inverse_link"), + zap_small = TRUE, table_width = Inf) + Output + Conditional Predictions + + spp | Mean | SE | 95% CI | z + ------------------------------------------ + GP | 0.62 | 0.10 | [0.45, 0.87] | -2.83 + PR | 0.16 | 0.04 | [0.10, 0.25] | -7.88 + DM | 0.79 | 0.13 | [0.57, 1.08] | -1.50 + EC-A | 0.29 | 0.06 | [0.20, 0.42] | -6.32 + EC-L | 1.16 | 0.18 | [0.86, 1.57] | 0.97 + DES-L | 1.23 | 0.19 | [0.91, 1.66] | 1.36 + DF | 0.68 | 0.11 | [0.49, 0.93] | -2.38 + + Variable predicted: count + Predictors modulated: spp + Predictors averaged: mined, site + Predictions are on the response-scale. + +--- + + Code + print(estimate_means(m, "spp", backend = "marginaleffects", estimate = "population", + predict = "inverse_link"), zap_small = TRUE, table_width = Inf) + Output + Marginal Predictions (G-computation) + + spp | Mean | SE | 95% CI | z + ------------------------------------------ + GP | 0.66 | 0.11 | [0.47, 0.91] | -2.55 + PR | 0.16 | 0.04 | [0.10, 0.26] | -7.70 + DM | 0.82 | 0.13 | [0.60, 1.13] | -1.20 + EC-A | 0.30 | 0.06 | [0.21, 0.44] | -6.10 + EC-L | 1.22 | 0.19 | [0.90, 1.64] | 1.30 + DES-L | 1.29 | 0.20 | [0.96, 1.74] | 1.69 + DF | 0.71 | 0.12 | [0.52, 0.98] | -2.10 + + Variable predicted: count + Predictors modulated: spp + Predictions are on the response-scale. + +--- + + Code + print(estimate_means(m, "Days", backend = "marginaleffects"), zap_small = TRUE, + table_width = Inf) + Output + Conditional Predictions + + Days | Mean | SE | 95% CI | t(174) + ------------------------------------------------- + 0 | 251.32 | 7.59 | [236.34, 266.31] | 33.11 + 1 | 261.49 | 7.55 | [246.57, 276.40] | 34.61 + 2 | 271.65 | 7.89 | [256.08, 287.21] | 34.45 + 3 | 281.81 | 8.54 | [264.95, 298.67] | 33.00 + 4 | 291.97 | 9.45 | [273.31, 310.63] | 30.89 + 5 | 302.13 | 10.56 | [281.30, 322.97] | 28.62 + 6 | 312.29 | 11.80 | [289.01, 335.58] | 26.47 + 7 | 322.46 | 13.13 | [296.53, 348.38] | 24.55 + 8 | 332.62 | 14.54 | [303.91, 361.33] | 22.87 + 9 | 342.78 | 16.01 | [311.19, 374.37] | 21.41 + + Variable predicted: Reaction + Predictors modulated: Days + Predictors averaged: Subject + +--- + + Code + print(estimate_means(m, "Days", backend = "marginaleffects", estimate = "population"), + zap_small = TRUE, table_width = Inf) + Output + Marginal Predictions (G-computation) + + Days | Mean | SE | 95% CI | t(174) + ------------------------------------------------- + 0 | 248.80 | 7.59 | [233.82, 263.79] | 32.78 + 1 | 259.04 | 7.55 | [244.13, 273.95] | 34.29 + 2 | 269.28 | 7.89 | [253.72, 284.85] | 34.15 + 3 | 279.52 | 8.54 | [262.67, 296.38] | 32.73 + 4 | 289.76 | 9.45 | [271.11, 308.42] | 30.65 + 5 | 300.01 | 10.56 | [279.17, 320.84] | 28.42 + 6 | 310.25 | 11.80 | [286.96, 333.53] | 26.30 + 7 | 320.49 | 13.13 | [294.56, 346.41] | 24.40 + 8 | 330.73 | 14.54 | [302.02, 359.43] | 22.74 + 9 | 340.97 | 16.01 | [309.37, 372.56] | 21.30 + + Variable predicted: Reaction + Predictors modulated: Days + diff --git a/tests/testthat/_snaps/windows/ordinal.new.md b/tests/testthat/_snaps/windows/ordinal.new.md new file mode 100644 index 000000000..52a6b203e --- /dev/null +++ b/tests/testthat/_snaps/windows/ordinal.new.md @@ -0,0 +1,224 @@ +# estimate_relation prints ordinal models correctly + + Code + print(out, zap_small = TRUE) + Output + Conditional Predictions + + Row | Response | Sepal.Width | Predicted | SE | 95% CI + ---------------------------------------------------------------- + 1 | setosa | 2.00 | 0.00 | 0.00 | [0.00, 0.01] + 1 | versicolor | 2.00 | 0.85 | 0.08 | [0.65, 0.95] + 1 | virginica | 2.00 | 0.15 | 0.08 | [0.05, 0.34] + 2 | setosa | 2.27 | 0.01 | 0.01 | [0.00, 0.02] + 2 | versicolor | 2.27 | 0.77 | 0.08 | [0.60, 0.90] + 2 | virginica | 2.27 | 0.22 | 0.08 | [0.10, 0.40] + 3 | setosa | 2.53 | 0.02 | 0.01 | [0.01, 0.06] + 3 | versicolor | 2.53 | 0.65 | 0.07 | [0.52, 0.78] + 3 | virginica | 2.53 | 0.32 | 0.07 | [0.20, 0.45] + 4 | setosa | 2.80 | 0.09 | 0.03 | [0.04, 0.16] + 4 | versicolor | 2.80 | 0.49 | 0.05 | [0.39, 0.59] + 4 | virginica | 2.80 | 0.42 | 0.05 | [0.32, 0.52] + 5 | setosa | 3.07 | 0.27 | 0.05 | [0.19, 0.36] + 5 | versicolor | 3.07 | 0.29 | 0.05 | [0.21, 0.39] + 5 | virginica | 3.07 | 0.43 | 0.05 | [0.33, 0.53] + 6 | setosa | 3.33 | 0.58 | 0.06 | [0.47, 0.68] + 6 | versicolor | 3.33 | 0.12 | 0.04 | [0.06, 0.21] + 6 | virginica | 3.33 | 0.30 | 0.05 | [0.20, 0.40] + 7 | setosa | 3.60 | 0.82 | 0.06 | [0.68, 0.91] + 7 | versicolor | 3.60 | 0.04 | 0.02 | [0.01, 0.08] + 7 | virginica | 3.60 | 0.15 | 0.05 | [0.07, 0.26] + 8 | setosa | 3.87 | 0.93 | 0.04 | [0.83, 0.98] + 8 | versicolor | 3.87 | 0.01 | 0.01 | [0.00, 0.03] + 8 | virginica | 3.87 | 0.06 | 0.04 | [0.02, 0.15] + 9 | setosa | 4.13 | 0.97 | 0.02 | [0.91, 1.00] + 9 | versicolor | 4.13 | 0.00 | 0.00 | [0.00, 0.01] + 9 | virginica | 4.13 | 0.02 | 0.02 | [0.00, 0.08] + 10 | setosa | 4.40 | 0.99 | 0.01 | [0.95, 1.00] + 10 | versicolor | 4.40 | 0.00 | 0.00 | [0.00, 0.00] + 10 | virginica | 4.40 | 0.01 | 0.01 | [0.00, 0.04] + + Variable predicted: Species + Predictors modulated: Sepal.Width + Predictions are on the response-scale. + +--- + + Code + print(out, zap_small = TRUE) + Output + Conditional Predictions + + Sepal.Width | Response | Median | 95% CI | pd | ROPE | % in ROPE + ----------------------------------------------------------------------------------- + 2.00 | setosa | 0.00 | [0.00, 0.01] | 100% | [-0.10, 0.10] | 100% + 2.00 | versicolor | 0.86 | [0.65, 0.95] | 100% | [-0.10, 0.10] | 0% + 2.00 | virginica | 0.14 | [0.05, 0.34] | 100% | [-0.10, 0.10] | 28.00% + 2.27 | setosa | 0.00 | [0.00, 0.02] | 100% | [-0.10, 0.10] | 100% + 2.27 | versicolor | 0.78 | [0.60, 0.90] | 100% | [-0.10, 0.10] | 0% + 2.27 | virginica | 0.21 | [0.10, 0.40] | 100% | [-0.10, 0.10] | 0% + 2.53 | setosa | 0.02 | [0.01, 0.06] | 100% | [-0.10, 0.10] | 100% + 2.53 | versicolor | 0.66 | [0.52, 0.78] | 100% | [-0.10, 0.10] | 0% + 2.53 | virginica | 0.32 | [0.20, 0.45] | 100% | [-0.10, 0.10] | 0% + 2.80 | setosa | 0.09 | [0.04, 0.16] | 100% | [-0.10, 0.10] | 65.72% + 2.80 | versicolor | 0.49 | [0.39, 0.59] | 100% | [-0.10, 0.10] | 0% + 2.80 | virginica | 0.41 | [0.32, 0.52] | 100% | [-0.10, 0.10] | 0% + 3.07 | setosa | 0.27 | [0.19, 0.36] | 100% | [-0.10, 0.10] | 0% + 3.07 | versicolor | 0.30 | [0.21, 0.39] | 100% | [-0.10, 0.10] | 0% + 3.07 | virginica | 0.43 | [0.33, 0.53] | 100% | [-0.10, 0.10] | 0% + 3.33 | setosa | 0.57 | [0.47, 0.68] | 100% | [-0.10, 0.10] | 0% + 3.33 | versicolor | 0.12 | [0.06, 0.21] | 100% | [-0.10, 0.10] | 29.76% + 3.33 | virginica | 0.30 | [0.20, 0.40] | 100% | [-0.10, 0.10] | 0% + 3.60 | setosa | 0.82 | [0.68, 0.91] | 100% | [-0.10, 0.10] | 0% + 3.60 | versicolor | 0.03 | [0.01, 0.08] | 100% | [-0.10, 0.10] | 100% + 3.60 | virginica | 0.14 | [0.07, 0.26] | 100% | [-0.10, 0.10] | 17.37% + 3.87 | setosa | 0.94 | [0.83, 0.98] | 100% | [-0.10, 0.10] | 0% + 3.87 | versicolor | 0.01 | [0.00, 0.03] | 100% | [-0.10, 0.10] | 100% + 3.87 | virginica | 0.05 | [0.02, 0.15] | 100% | [-0.10, 0.10] | 89.59% + 4.13 | setosa | 0.98 | [0.91, 1.00] | 100% | [-0.10, 0.10] | 0% + 4.13 | versicolor | 0.00 | [0.00, 0.01] | 100% | [-0.10, 0.10] | 100% + 4.13 | virginica | 0.02 | [0.00, 0.08] | 100% | [-0.10, 0.10] | 100% + 4.40 | setosa | 0.99 | [0.95, 1.00] | 100% | [-0.10, 0.10] | 0% + 4.40 | versicolor | 0.00 | [0.00, 0.00] | 100% | [-0.10, 0.10] | 100% + 4.40 | virginica | 0.01 | [0.00, 0.04] | 100% | [-0.10, 0.10] | 100% + + Variable predicted: Species + Predictors modulated: Sepal.Width + Predictions are on the response-scale. + +--- + + Code + print(out, zap_small = TRUE) + Output + Conditional Predictions + + Row | Response | Sepal.Width | Predicted | 95% CI + --------------------------------------------------------- + 1 | setosa | 2.00 | 0.05 | [0.01, 0.22] + 1 | versicolor | 2.00 | 0.17 | [0.04, 0.51] + 1 | virginica | 2.00 | 0.78 | [0.41, 0.95] + 2 | setosa | 2.27 | 0.09 | [0.02, 0.38] + 2 | versicolor | 2.27 | 0.24 | [0.05, 0.67] + 2 | virginica | 2.27 | 0.67 | [0.24, 0.93] + 3 | setosa | 2.53 | 0.15 | [0.02, 0.57] + 3 | versicolor | 2.53 | 0.32 | [0.06, 0.78] + 3 | virginica | 2.53 | 0.54 | [0.13, 0.90] + 4 | setosa | 2.80 | 0.23 | [0.03, 0.74] + 4 | versicolor | 2.80 | 0.37 | [0.06, 0.85] + 4 | virginica | 2.80 | 0.40 | [0.06, 0.86] + 5 | setosa | 3.07 | 0.34 | [0.04, 0.86] + 5 | versicolor | 3.07 | 0.38 | [0.05, 0.88] + 5 | virginica | 3.07 | 0.28 | [0.03, 0.82] + 6 | setosa | 3.33 | 0.47 | [0.06, 0.93] + 6 | versicolor | 3.33 | 0.35 | [0.03, 0.89] + 6 | virginica | 3.33 | 0.18 | [0.01, 0.77] + 7 | setosa | 3.60 | 0.61 | [0.08, 0.97] + 7 | versicolor | 3.60 | 0.28 | [0.02, 0.88] + 7 | virginica | 3.60 | 0.11 | [0.01, 0.70] + 8 | setosa | 3.87 | 0.73 | [0.11, 0.98] + 8 | versicolor | 3.87 | 0.20 | [0.01, 0.85] + 8 | virginica | 3.87 | 0.07 | [0.00, 0.63] + 9 | setosa | 4.13 | 0.82 | [0.14, 0.99] + 9 | versicolor | 4.13 | 0.14 | [0.01, 0.82] + 9 | virginica | 4.13 | 0.04 | [0.00, 0.55] + 10 | setosa | 4.40 | 0.89 | [0.19, 1.00] + 10 | versicolor | 4.40 | 0.09 | [0.00, 0.77] + 10 | virginica | 4.40 | 0.02 | [0.00, 0.46] + + Variable predicted: Species + Predictors modulated: Sepal.Width + Predictions are on the response-scale. + +--- + + Code + print(out, zap_small = TRUE) + Output + Conditional Predictions + + Sepal.Width | Response | Probability | SE | 95% CI | t(147) + ---------------------------------------------------------------------- + 2.00 | setosa | 0.05 | 0.02 | [ 0.01, 0.10] | 2.21 + 2.00 | versicolor | 0.17 | 0.05 | [ 0.07, 0.27] | 3.22 + 2.00 | virginica | 0.78 | 0.07 | [ 0.63, 0.92] | 10.56 + 2.27 | setosa | 0.09 | 0.03 | [ 0.03, 0.15] | 2.89 + 2.27 | versicolor | 0.24 | 0.05 | [ 0.14, 0.34] | 4.89 + 2.27 | virginica | 0.67 | 0.07 | [ 0.52, 0.81] | 9.15 + 2.53 | setosa | 0.15 | 0.04 | [ 0.07, 0.22] | 4.05 + 2.53 | versicolor | 0.32 | 0.04 | [ 0.23, 0.40] | 7.35 + 2.53 | virginica | 0.54 | 0.06 | [ 0.42, 0.66] | 8.81 + 2.80 | setosa | 0.23 | 0.04 | [ 0.15, 0.30] | 5.96 + 2.80 | versicolor | 0.37 | 0.04 | [ 0.29, 0.46] | 8.71 + 2.80 | virginica | 0.40 | 0.05 | [ 0.31, 0.49] | 8.76 + 3.07 | setosa | 0.34 | 0.04 | [ 0.26, 0.42] | 8.09 + 3.07 | versicolor | 0.38 | 0.04 | [ 0.30, 0.47] | 8.73 + 3.07 | virginica | 0.28 | 0.04 | [ 0.20, 0.35] | 7.23 + 3.33 | setosa | 0.47 | 0.05 | [ 0.36, 0.58] | 8.72 + 3.33 | versicolor | 0.35 | 0.04 | [ 0.26, 0.43] | 8.10 + 3.33 | virginica | 0.18 | 0.04 | [ 0.11, 0.25] | 4.94 + 3.60 | setosa | 0.61 | 0.07 | [ 0.47, 0.74] | 8.83 + 3.60 | versicolor | 0.28 | 0.05 | [ 0.19, 0.37] | 5.91 + 3.60 | virginica | 0.11 | 0.03 | [ 0.05, 0.18] | 3.40 + 3.87 | setosa | 0.73 | 0.07 | [ 0.58, 0.88] | 9.72 + 3.87 | versicolor | 0.20 | 0.05 | [ 0.10, 0.31] | 3.85 + 3.87 | virginica | 0.07 | 0.03 | [ 0.01, 0.12] | 2.51 + 4.13 | setosa | 0.82 | 0.07 | [ 0.69, 0.96] | 11.84 + 4.13 | versicolor | 0.14 | 0.05 | [ 0.04, 0.24] | 2.66 + 4.13 | virginica | 0.04 | 0.02 | [ 0.00, 0.08] | 1.97 + 4.40 | setosa | 0.89 | 0.06 | [ 0.78, 1.00] | 15.64 + 4.40 | versicolor | 0.09 | 0.04 | [ 0.00, 0.17] | 2.00 + 4.40 | virginica | 0.02 | 0.01 | [-0.01, 0.05] | 1.62 + + Variable predicted: Species + Predictors modulated: Sepal.Width + Predictions are on the probs-scale. + +# estimate_means, print bracl + + Code + print(out, zap_small = TRUE) + Output + Conditional Predictions + + island | Response | Probability | SE | 95% CI | z + ------------------------------------------------------------------ + Biscoe | Adelie | 0.27 | 0.02 | [ 0.24, 0.30] | 17.09 + Biscoe | Chinstrap | 0.00 | 0.00 | [ 0.00, 0.00] | 22.91 + Biscoe | Gentoo | 0.72 | 0.02 | [ 0.69, 0.76] | 45.96 + Dream | Adelie | 0.45 | 0.01 | [ 0.43, 0.46] | 52.85 + Dream | Chinstrap | 0.55 | 0.02 | [ 0.51, 0.59] | 29.50 + Dream | Gentoo | 0.00 | 0.01 | [-0.02, 0.02] | 0.40 + Torgersen | Adelie | 0.98 | 0.05 | [ 0.89, 1.07] | 21.13 + Torgersen | Chinstrap | 0.01 | 0.03 | [-0.05, 0.08] | 0.32 + Torgersen | Gentoo | 0.01 | 0.01 | [-0.02, 0.04] | 0.72 + + Variable predicted: species + Predictors modulated: island + Predictors averaged: sex + Predictions are on the probs-scale. + +--- + + Code + print(out, zap_small = TRUE) + Output + Conditional Predictions + + island | Response | Probability | SE | 95% CI | t(325) + -------------------------------------------------------------------- + Biscoe | Adelie | 0.27 | 0.03 | [ 0.20, 0.34] | 7.76 + Biscoe | Chinstrap | 0.00 | 0.00 | [ 0.00, 0.00] | 0.00 + Biscoe | Gentoo | 0.73 | 0.03 | [ 0.66, 0.80] | 20.99 + Dream | Adelie | 0.45 | 0.04 | [ 0.36, 0.54] | 9.97 + Dream | Chinstrap | 0.55 | 0.04 | [ 0.46, 0.64] | 12.33 + Dream | Gentoo | 0.00 | 0.00 | [ 0.00, 0.00] | 0.00 + Torgersen | Adelie | 1.00 | 0.00 | [ 1.00, 1.00] | 4448.49 + Torgersen | Chinstrap | 0.00 | 0.00 | [ 0.00, 0.00] | 0.00 + Torgersen | Gentoo | 0.00 | 0.00 | [ 0.00, 0.00] | 0.01 + + Variable predicted: species + Predictors modulated: island + Predictors averaged: sex + Predictions are on the probs-scale. + diff --git a/tests/testthat/_snaps/windows/print.new.md b/tests/testthat/_snaps/windows/print.new.md new file mode 100644 index 000000000..9c7990db5 --- /dev/null +++ b/tests/testthat/_snaps/windows/print.new.md @@ -0,0 +1,584 @@ +# estimate_slopes - print summary + + Code + estimate_slopes(model_lm, trend = "x", by = "x", backend = "emmeans") + Output + Estimated Marginal Effects + + x | Slope | SE | 95% CI | t(998) | p + ------------------------------------------------------- + -3.38 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + -2.64 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + -1.90 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + -1.16 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + -0.42 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 0.32 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 1.06 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 1.80 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 2.54 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 3.28 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + + Marginal effects estimated for x + +--- + + Code + summary(deriv) + Message + There might be too few data to accurately determine intervals. Consider + setting `length = 100` (or larger) in your call to `estimate_slopes()`. + Output + Johnson-Neymann Intervals + + Start | End | Direction | Confidence + -------------------------------------- + -3.38 | 3.28 | positive | Significant + + Marginal effects estimated for x + +--- + + Code + estimate_slopes(model_lm, trend = "x", by = "x", backend = "marginaleffects") + Output + Estimated Marginal Effects + + x | Slope | SE | 95% CI | t(998) | p + ------------------------------------------------------- + -3.38 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + -2.64 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + -1.90 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + -1.16 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + -0.42 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 0.32 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 1.06 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 1.80 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 2.54 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + 3.28 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 + + Marginal effects estimated for x + Type of slope was dY/dX + +--- + + Code + summary(deriv2) + Message + There might be too few data to accurately determine intervals. Consider + setting `length = 100` (or larger) in your call to `estimate_slopes()`. + Output + Johnson-Neymann Intervals + + Start | End | Direction | Confidence + -------------------------------------- + -3.38 | 3.28 | positive | Significant + + Marginal effects estimated for x + Type of slope was dY/dX + +# estimate_slopes - print regular + + Code + print(estimate_slopes(model, trend = "Petal.Length", backend = "emmeans")) + Output + Estimated Marginal Effects + + Slope | SE | 95% CI | t(144) | p + --------------------------------------------- + 0.79 | 0.10 | [0.59, 0.99] | 7.69 | < .001 + + Marginal effects estimated for Petal.Length + +--- + + Code + print(estimate_slopes(model, trend = "Petal.Length", backend = "marginaleffects")) + Output + Estimated Marginal Effects + + Slope | SE | 95% CI | t(144) | p + --------------------------------------------- + 0.79 | 0.10 | [0.59, 0.99] | 7.69 | < .001 + + Marginal effects estimated for Petal.Length + Type of slope was dY/dX + +# estimate_means - print multiple by's + + Code + print(estimate_means(fit, c("c12hour", "c172code", "c161sex"), length = 4, + backend = "marginaleffects"), table_width = Inf) + Output + Conditional Predictions + + c12hour | c172code | c161sex | Mean | SE | 95% CI | t(791) + -------------------------------------------------------------------------------------------- + 4.00 | low level of education | Male | 11.66 | 0.90 | [ 9.90, 13.42] | 12.99 + 58.67 | low level of education | Male | 10.93 | 1.01 | [ 8.95, 12.91] | 10.86 + 113.33 | low level of education | Male | 10.20 | 2.31 | [ 5.66, 14.74] | 4.41 + 168.00 | low level of education | Male | 9.47 | 3.72 | [ 2.17, 16.77] | 2.55 + 4.00 | intermediate level of education | Male | 11.47 | 0.48 | [10.54, 12.41] | 24.12 + 58.67 | intermediate level of education | Male | 12.52 | 0.69 | [11.16, 13.87] | 18.12 + 113.33 | intermediate level of education | Male | 13.56 | 1.46 | [10.70, 16.42] | 9.31 + 168.00 | intermediate level of education | Male | 14.61 | 2.27 | [10.15, 19.07] | 6.43 + 4.00 | high level of education | Male | 11.03 | 0.63 | [ 9.79, 12.27] | 17.41 + 58.67 | high level of education | Male | 11.83 | 0.75 | [10.36, 13.30] | 15.78 + 113.33 | high level of education | Male | 12.63 | 1.42 | [ 9.84, 15.42] | 8.90 + 168.00 | high level of education | Male | 13.43 | 2.18 | [ 9.14, 17.71] | 6.15 + 4.00 | low level of education | Female | 12.24 | 0.41 | [11.43, 13.05] | 29.60 + 58.67 | low level of education | Female | 11.94 | 0.34 | [11.28, 12.60] | 35.50 + 113.33 | low level of education | Female | 11.65 | 0.54 | [10.59, 12.71] | 21.54 + 168.00 | low level of education | Female | 11.36 | 0.84 | [ 9.70, 13.01] | 13.49 + 4.00 | intermediate level of education | Female | 11.34 | 0.24 | [10.87, 11.81] | 47.06 + 58.67 | intermediate level of education | Female | 12.24 | 0.22 | [11.80, 12.67] | 54.82 + 113.33 | intermediate level of education | Female | 13.13 | 0.40 | [12.35, 13.91] | 33.09 + 168.00 | intermediate level of education | Female | 14.03 | 0.62 | [12.82, 15.24] | 22.72 + 4.00 | high level of education | Female | 12.49 | 0.45 | [11.61, 13.38] | 27.68 + 58.67 | high level of education | Female | 12.90 | 0.48 | [11.96, 13.84] | 26.99 + 113.33 | high level of education | Female | 13.31 | 0.97 | [11.40, 15.21] | 13.72 + 168.00 | high level of education | Female | 13.71 | 1.53 | [10.71, 16.71] | 8.97 + + Variable predicted: neg_c_7 + Predictors modulated: c12hour, c172code, c161sex + Predictors averaged: barthtot (65) + +--- + + Code + print(estimate_means(fit, c("c12hour", "barthtot = [sd]", "c161sex", "c172code", + "e16sex"), backend = "marginaleffects", length = 3), table_width = Inf) + Output + Conditional Predictions + + c12hour | barthtot | c161sex | c172code | e16sex | Mean | SE | 95% CI | t(766) + ------------------------------------------------------------------------------------------------------------------- + 4 | 35.12 | Male | low level of education | male | 9.74 | 4.63 | [ 0.66, 18.83] | 2.10 + 86 | 35.12 | Male | low level of education | male | 21.80 | 21.63 | [-20.65, 64.25] | 1.01 + 168 | 35.12 | Male | low level of education | male | 33.86 | 47.25 | [-58.90, 126.61] | 0.72 + 4 | 64.73 | Male | low level of education | male | 9.39 | 1.90 | [ 5.67, 13.11] | 4.95 + 86 | 64.73 | Male | low level of education | male | 11.99 | 5.40 | [ 1.39, 22.59] | 2.22 + 168 | 64.73 | Male | low level of education | male | 14.59 | 12.26 | [ -9.47, 38.66] | 1.19 + 4 | 94.34 | Male | low level of education | male | 9.03 | 2.38 | [ 4.36, 13.71] | 3.79 + 86 | 94.34 | Male | low level of education | male | 2.18 | 16.20 | [-29.62, 33.98] | 0.13 + 168 | 94.34 | Male | low level of education | male | -4.67 | 34.35 | [-72.09, 62.75] | -0.14 + 4 | 35.12 | Female | low level of education | male | 14.36 | 0.86 | [ 12.67, 16.05] | 16.71 + 86 | 35.12 | Female | low level of education | male | 13.13 | 0.54 | [ 12.07, 14.18] | 24.50 + 168 | 35.12 | Female | low level of education | male | 11.89 | 1.03 | [ 9.87, 13.91] | 11.58 + 4 | 64.73 | Female | low level of education | male | 11.84 | 0.62 | [ 10.62, 13.07] | 18.99 + 86 | 64.73 | Female | low level of education | male | 11.56 | 0.55 | [ 10.47, 12.64] | 20.92 + 168 | 64.73 | Female | low level of education | male | 11.27 | 1.06 | [ 9.19, 13.35] | 10.62 + 4 | 94.34 | Female | low level of education | male | 9.32 | 0.93 | [ 7.50, 11.15] | 10.05 + 86 | 94.34 | Female | low level of education | male | 9.99 | 0.87 | [ 8.29, 11.69] | 11.52 + 168 | 94.34 | Female | low level of education | male | 10.65 | 1.62 | [ 7.47, 13.82] | 6.58 + 4 | 35.12 | Male | intermediate level of education | male | 22.45 | 3.74 | [ 15.10, 29.80] | 6.00 + 86 | 35.12 | Male | intermediate level of education | male | 7.37 | 6.96 | [ -6.30, 21.03] | 1.06 + 168 | 35.12 | Male | intermediate level of education | male | -7.72 | 17.20 | [-41.47, 26.04] | -0.45 + 4 | 64.73 | Male | intermediate level of education | male | 15.45 | 1.82 | [ 11.87, 19.03] | 8.47 + 86 | 64.73 | Male | intermediate level of education | male | 14.82 | 5.47 | [ 4.08, 25.56] | 2.71 + 168 | 64.73 | Male | intermediate level of education | male | 14.19 | 12.22 | [ -9.81, 38.18] | 1.16 + 4 | 94.34 | Male | intermediate level of education | male | 8.45 | 1.17 | [ 6.16, 10.74] | 7.23 + 86 | 94.34 | Male | intermediate level of education | male | 22.27 | 7.76 | [ 7.05, 37.50] | 2.87 + 168 | 94.34 | Male | intermediate level of education | male | 36.09 | 16.29 | [ 4.11, 68.07] | 2.22 + 4 | 35.12 | Female | intermediate level of education | male | 12.96 | 0.79 | [ 11.40, 14.52] | 16.34 + 86 | 35.12 | Female | intermediate level of education | male | 14.46 | 0.47 | [ 13.55, 15.38] | 31.06 + 168 | 35.12 | Female | intermediate level of education | male | 15.97 | 0.67 | [ 14.66, 17.27] | 24.00 + 4 | 64.73 | Female | intermediate level of education | male | 11.48 | 0.45 | [ 10.59, 12.38] | 25.25 + 86 | 64.73 | Female | intermediate level of education | male | 13.22 | 0.44 | [ 12.37, 14.08] | 30.36 + 168 | 64.73 | Female | intermediate level of education | male | 14.96 | 0.85 | [ 13.28, 16.64] | 17.53 + 4 | 94.34 | Female | intermediate level of education | male | 10.01 | 0.54 | [ 8.95, 11.07] | 18.59 + 86 | 94.34 | Female | intermediate level of education | male | 11.98 | 0.66 | [ 10.69, 13.27] | 18.22 + 168 | 94.34 | Female | intermediate level of education | male | 13.95 | 1.32 | [ 11.37, 16.54] | 10.60 + 4 | 35.12 | Male | high level of education | male | 11.88 | 2.02 | [ 7.91, 15.85] | 5.88 + 86 | 35.12 | Male | high level of education | male | 13.93 | 1.48 | [ 11.03, 16.83] | 9.44 + 168 | 35.12 | Male | high level of education | male | 15.97 | 2.48 | [ 11.10, 20.84] | 6.44 + 4 | 64.73 | Male | high level of education | male | 11.45 | 1.19 | [ 9.11, 13.79] | 9.62 + 86 | 64.73 | Male | high level of education | male | 12.48 | 2.02 | [ 8.53, 16.44] | 6.19 + 168 | 64.73 | Male | high level of education | male | 13.52 | 4.09 | [ 5.49, 21.55] | 3.30 + 4 | 94.34 | Male | high level of education | male | 11.02 | 1.56 | [ 7.95, 14.09] | 7.05 + 86 | 94.34 | Male | high level of education | male | 11.04 | 3.23 | [ 4.70, 17.38] | 3.42 + 168 | 94.34 | Male | high level of education | male | 11.06 | 6.59 | [ -1.88, 24.00] | 1.68 + 4 | 35.12 | Female | high level of education | male | 15.92 | 1.51 | [ 12.96, 18.88] | 10.55 + 86 | 35.12 | Female | high level of education | male | 14.36 | 1.08 | [ 12.23, 16.49] | 13.26 + 168 | 35.12 | Female | high level of education | male | 12.80 | 2.20 | [ 8.48, 17.12] | 5.82 + 4 | 64.73 | Female | high level of education | male | 13.02 | 0.88 | [ 11.29, 14.75] | 14.78 + 86 | 64.73 | Female | high level of education | male | 12.35 | 1.20 | [ 9.98, 14.71] | 10.25 + 168 | 64.73 | Female | high level of education | male | 11.67 | 2.63 | [ 6.50, 16.84] | 4.43 + 4 | 94.34 | Female | high level of education | male | 10.13 | 1.09 | [ 7.99, 12.27] | 9.29 + 86 | 94.34 | Female | high level of education | male | 10.33 | 1.88 | [ 6.65, 14.01] | 5.51 + 168 | 94.34 | Female | high level of education | male | 10.53 | 3.97 | [ 2.73, 18.33] | 2.65 + 4 | 35.12 | Male | low level of education | female | 16.94 | 2.25 | [ 12.52, 21.35] | 7.53 + 86 | 35.12 | Male | low level of education | female | 13.60 | 1.19 | [ 11.26, 15.95] | 11.39 + 168 | 35.12 | Male | low level of education | female | 10.27 | 2.16 | [ 6.03, 14.50] | 4.76 + 4 | 64.73 | Male | low level of education | female | 13.01 | 1.16 | [ 10.73, 15.29] | 11.20 + 86 | 64.73 | Male | low level of education | female | 10.57 | 1.77 | [ 7.10, 14.04] | 5.98 + 168 | 64.73 | Male | low level of education | female | 8.13 | 4.09 | [ 0.10, 16.17] | 1.99 + 4 | 94.34 | Male | low level of education | female | 9.08 | 1.81 | [ 5.52, 12.65] | 5.01 + 86 | 94.34 | Male | low level of education | female | 7.54 | 2.93 | [ 1.80, 13.29] | 2.58 + 168 | 94.34 | Male | low level of education | female | 6.00 | 6.44 | [ -6.64, 18.64] | 0.93 + 4 | 35.12 | Female | low level of education | female | 15.68 | 0.97 | [ 13.78, 17.58] | 16.19 + 86 | 35.12 | Female | low level of education | female | 14.22 | 0.59 | [ 13.06, 15.39] | 23.91 + 168 | 35.12 | Female | low level of education | female | 12.77 | 1.09 | [ 10.63, 14.90] | 11.74 + 4 | 64.73 | Female | low level of education | female | 12.73 | 0.58 | [ 11.60, 13.87] | 21.99 + 86 | 64.73 | Female | low level of education | female | 11.97 | 0.66 | [ 10.67, 13.26] | 18.09 + 168 | 64.73 | Female | low level of education | female | 11.20 | 1.39 | [ 8.48, 13.92] | 8.07 + 4 | 94.34 | Female | low level of education | female | 9.79 | 0.70 | [ 8.40, 11.17] | 13.90 + 86 | 94.34 | Female | low level of education | female | 9.71 | 1.07 | [ 7.60, 11.81] | 9.05 + 168 | 94.34 | Female | low level of education | female | 9.63 | 2.25 | [ 5.21, 14.05] | 4.28 + 4 | 35.12 | Male | intermediate level of education | female | 12.23 | 0.91 | [ 10.45, 14.01] | 13.48 + 86 | 35.12 | Male | intermediate level of education | female | 12.65 | 0.66 | [ 11.35, 13.95] | 19.13 + 168 | 35.12 | Male | intermediate level of education | female | 13.08 | 1.23 | [ 10.67, 15.49] | 10.66 + 4 | 64.73 | Male | intermediate level of education | female | 10.72 | 0.55 | [ 9.64, 11.79] | 19.58 + 86 | 64.73 | Male | intermediate level of education | female | 12.65 | 1.08 | [ 10.53, 14.77] | 11.70 + 168 | 64.73 | Male | intermediate level of education | female | 14.59 | 2.32 | [ 10.03, 19.15] | 6.28 + 4 | 94.34 | Male | intermediate level of education | female | 9.21 | 0.62 | [ 7.99, 10.42] | 14.89 + 86 | 94.34 | Male | intermediate level of education | female | 12.65 | 1.77 | [ 9.18, 16.12] | 7.16 + 168 | 94.34 | Male | intermediate level of education | female | 16.10 | 3.71 | [ 8.81, 23.39] | 4.34 + 4 | 35.12 | Female | intermediate level of education | female | 12.91 | 0.47 | [ 11.99, 13.84] | 27.33 + 86 | 35.12 | Female | intermediate level of education | female | 13.14 | 0.33 | [ 12.49, 13.79] | 39.53 + 168 | 35.12 | Female | intermediate level of education | female | 13.37 | 0.64 | [ 12.12, 14.62] | 20.93 + 4 | 64.73 | Female | intermediate level of education | female | 11.38 | 0.29 | [ 10.83, 11.94] | 39.94 + 86 | 64.73 | Female | intermediate level of education | female | 12.28 | 0.42 | [ 11.45, 13.10] | 29.25 + 168 | 64.73 | Female | intermediate level of education | female | 13.17 | 0.88 | [ 11.43, 14.91] | 14.88 + 4 | 94.34 | Female | intermediate level of education | female | 9.86 | 0.34 | [ 9.18, 10.53] | 28.57 + 86 | 94.34 | Female | intermediate level of education | female | 11.41 | 0.67 | [ 10.10, 12.72] | 17.11 + 168 | 94.34 | Female | intermediate level of education | female | 12.97 | 1.40 | [ 10.22, 15.72] | 9.26 + 4 | 35.12 | Male | high level of education | female | 10.93 | 1.13 | [ 8.72, 13.14] | 9.71 + 86 | 35.12 | Male | high level of education | female | 12.15 | 0.88 | [ 10.42, 13.87] | 13.84 + 168 | 35.12 | Male | high level of education | female | 13.36 | 1.55 | [ 10.32, 16.41] | 8.62 + 4 | 64.73 | Male | high level of education | female | 10.86 | 0.75 | [ 9.40, 12.33] | 14.57 + 86 | 64.73 | Male | high level of education | female | 12.26 | 1.24 | [ 9.82, 14.70] | 9.88 + 168 | 64.73 | Male | high level of education | female | 13.66 | 2.57 | [ 8.62, 18.70] | 5.32 + 4 | 94.34 | Male | high level of education | female | 10.79 | 1.01 | [ 8.80, 12.78] | 10.65 + 86 | 94.34 | Male | high level of education | female | 12.38 | 2.09 | [ 8.28, 16.47] | 5.93 + 168 | 94.34 | Male | high level of education | female | 13.96 | 4.30 | [ 5.51, 22.41] | 3.24 + 4 | 35.12 | Female | high level of education | female | 13.86 | 0.91 | [ 12.06, 15.65] | 15.18 + 86 | 35.12 | Female | high level of education | female | 15.00 | 0.75 | [ 13.52, 16.48] | 19.90 + 168 | 35.12 | Female | high level of education | female | 16.15 | 1.55 | [ 13.11, 19.19] | 10.43 + 4 | 64.73 | Female | high level of education | female | 12.31 | 0.52 | [ 11.29, 13.34] | 23.59 + 86 | 64.73 | Female | high level of education | female | 13.54 | 0.86 | [ 11.84, 15.24] | 15.67 + 168 | 64.73 | Female | high level of education | female | 14.76 | 1.86 | [ 11.10, 18.42] | 7.92 + 4 | 94.34 | Female | high level of education | female | 10.77 | 0.73 | [ 9.34, 12.20] | 14.77 + 86 | 94.34 | Female | high level of education | female | 12.07 | 1.35 | [ 9.42, 14.73] | 8.91 + 168 | 94.34 | Female | high level of education | female | 13.38 | 2.80 | [ 7.87, 18.88] | 4.77 + + Variable predicted: neg_c_7 + Predictors modulated: c12hour, barthtot = [sd], c161sex, c172code, e16sex + +# estimate_means - full labels + + Code + print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst"), + backend = "marginaleffects"), table_width = Inf) + Output + Conditional Predictions + + c161sex | c172code | e16sex | nur_pst | Mean | SE | 95% CI | t(402) + --------------------------------------------------------------------------------------------------------------- + Male | low level of education | male | Care Level 1 | 10.00 | 2.59 | [ 4.90, 15.10] | 3.85 + Female | low level of education | male | Care Level 1 | 13.75 | 1.06 | [ 11.67, 15.83] | 12.98 + Male | intermediate level of education | male | Care Level 1 | 12.00 | 2.12 | [ 7.84, 16.16] | 5.66 + Female | intermediate level of education | male | Care Level 1 | 10.55 | 0.78 | [ 9.01, 12.08] | 13.48 + Male | high level of education | male | Care Level 1 | 14.25 | 1.83 | [ 10.64, 17.86] | 7.77 + Female | high level of education | male | Care Level 1 | 10.00 | 3.67 | [ 2.79, 17.21] | 2.73 + Male | low level of education | female | Care Level 1 | 15.50 | 1.83 | [ 11.89, 19.11] | 8.45 + Female | low level of education | female | Care Level 1 | 11.56 | 0.92 | [ 9.76, 13.37] | 12.60 + Male | intermediate level of education | female | Care Level 1 | 10.16 | 0.84 | [ 8.50, 11.81] | 12.07 + Female | intermediate level of education | female | Care Level 1 | 11.22 | 0.50 | [ 10.24, 12.20] | 22.47 + Male | high level of education | female | Care Level 1 | 11.67 | 1.50 | [ 8.72, 14.61] | 7.79 + Female | high level of education | female | Care Level 1 | 12.44 | 0.86 | [ 10.74, 14.14] | 14.39 + Male | low level of education | male | Care Level 2 | 11.00 | 2.59 | [ 5.90, 16.10] | 4.24 + Female | low level of education | male | Care Level 2 | 12.23 | 1.02 | [ 10.23, 14.23] | 12.02 + Male | intermediate level of education | male | Care Level 2 | 13.25 | 1.30 | [ 10.70, 15.80] | 10.21 + Female | intermediate level of education | male | Care Level 2 | 13.00 | 0.68 | [ 11.66, 14.34] | 19.08 + Male | high level of education | male | Care Level 2 | 10.00 | 3.67 | [ 2.79, 17.21] | 2.73 + Female | high level of education | male | Care Level 2 | 12.78 | 1.22 | [ 10.37, 15.18] | 10.45 + Male | low level of education | female | Care Level 2 | 13.75 | 1.83 | [ 10.14, 17.36] | 7.49 + Female | low level of education | female | Care Level 2 | 11.17 | 1.06 | [ 9.08, 13.25] | 10.54 + Male | intermediate level of education | female | Care Level 2 | 11.17 | 0.86 | [ 9.47, 12.87] | 12.91 + Female | intermediate level of education | female | Care Level 2 | 11.60 | 0.50 | [ 10.61, 12.59] | 23.02 + Male | high level of education | female | Care Level 2 | 11.20 | 1.16 | [ 8.92, 13.48] | 9.65 + Female | high level of education | female | Care Level 2 | 14.56 | 0.92 | [ 12.76, 16.37] | 15.87 + Male | low level of education | male | Care Level 3/3+ | -13.53 | 7.92 | [-29.10, 2.04] | -1.71 + Female | low level of education | male | Care Level 3/3+ | 12.09 | 1.11 | [ 9.92, 14.27] | 10.93 + Male | intermediate level of education | male | Care Level 3/3+ | 13.57 | 1.39 | [ 10.85, 16.30] | 9.79 + Female | intermediate level of education | male | Care Level 3/3+ | 16.50 | 0.78 | [ 14.96, 18.04] | 21.09 + Male | high level of education | male | Care Level 3/3+ | 8.00 | 3.67 | [ 0.79, 15.21] | 2.18 + Female | high level of education | male | Care Level 3/3+ | 16.33 | 2.12 | [ 12.17, 20.50] | 7.71 + Male | low level of education | female | Care Level 3/3+ | 12.00 | 2.12 | [ 7.84, 16.16] | 5.66 + Female | low level of education | female | Care Level 3/3+ | 15.00 | 1.39 | [ 12.27, 17.73] | 10.82 + Male | intermediate level of education | female | Care Level 3/3+ | 11.54 | 1.02 | [ 9.54, 13.54] | 11.34 + Female | intermediate level of education | female | Care Level 3/3+ | 13.35 | 0.77 | [ 11.84, 14.85] | 17.45 + Male | high level of education | female | Care Level 3/3+ | 13.00 | 1.83 | [ 9.39, 16.61] | 7.09 + Female | high level of education | female | Care Level 3/3+ | 11.43 | 1.39 | [ 8.70, 14.15] | 8.24 + + Variable predicted: neg_c_7 + Predictors modulated: c161sex, c172code, e16sex, nur_pst + +--- + + Code + print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst"), + backend = "marginaleffects"), full_labels = FALSE, table_width = Inf) + Output + Conditional Predictions + + c161sex | c172code | e16sex | nur_pst | Mean | SE | 95% CI | t(402) + --------------------------------------------------------------------------------------------------------------- + Male | low level of education | male | Care Level 1 | 10.00 | 2.59 | [ 4.90, 15.10] | 3.85 + Female | | | | 13.75 | 1.06 | [ 11.67, 15.83] | 12.98 + Male | intermediate level of education | | | 12.00 | 2.12 | [ 7.84, 16.16] | 5.66 + Female | | | | 10.55 | 0.78 | [ 9.01, 12.08] | 13.48 + Male | high level of education | | | 14.25 | 1.83 | [ 10.64, 17.86] | 7.77 + Female | | | | 10.00 | 3.67 | [ 2.79, 17.21] | 2.73 + Male | low level of education | female | | 15.50 | 1.83 | [ 11.89, 19.11] | 8.45 + Female | | | | 11.56 | 0.92 | [ 9.76, 13.37] | 12.60 + Male | intermediate level of education | | | 10.16 | 0.84 | [ 8.50, 11.81] | 12.07 + Female | | | | 11.22 | 0.50 | [ 10.24, 12.20] | 22.47 + Male | high level of education | | | 11.67 | 1.50 | [ 8.72, 14.61] | 7.79 + Female | | | | 12.44 | 0.86 | [ 10.74, 14.14] | 14.39 + Male | low level of education | male | Care Level 2 | 11.00 | 2.59 | [ 5.90, 16.10] | 4.24 + Female | | | | 12.23 | 1.02 | [ 10.23, 14.23] | 12.02 + Male | intermediate level of education | | | 13.25 | 1.30 | [ 10.70, 15.80] | 10.21 + Female | | | | 13.00 | 0.68 | [ 11.66, 14.34] | 19.08 + Male | high level of education | | | 10.00 | 3.67 | [ 2.79, 17.21] | 2.73 + Female | | | | 12.78 | 1.22 | [ 10.37, 15.18] | 10.45 + Male | low level of education | female | | 13.75 | 1.83 | [ 10.14, 17.36] | 7.49 + Female | | | | 11.17 | 1.06 | [ 9.08, 13.25] | 10.54 + Male | intermediate level of education | | | 11.17 | 0.86 | [ 9.47, 12.87] | 12.91 + Female | | | | 11.60 | 0.50 | [ 10.61, 12.59] | 23.02 + Male | high level of education | | | 11.20 | 1.16 | [ 8.92, 13.48] | 9.65 + Female | | | | 14.56 | 0.92 | [ 12.76, 16.37] | 15.87 + Male | low level of education | male | Care Level 3/3+ | -13.53 | 7.92 | [-29.10, 2.04] | -1.71 + Female | | | | 12.09 | 1.11 | [ 9.92, 14.27] | 10.93 + Male | intermediate level of education | | | 13.57 | 1.39 | [ 10.85, 16.30] | 9.79 + Female | | | | 16.50 | 0.78 | [ 14.96, 18.04] | 21.09 + Male | high level of education | | | 8.00 | 3.67 | [ 0.79, 15.21] | 2.18 + Female | | | | 16.33 | 2.12 | [ 12.17, 20.50] | 7.71 + Male | low level of education | female | | 12.00 | 2.12 | [ 7.84, 16.16] | 5.66 + Female | | | | 15.00 | 1.39 | [ 12.27, 17.73] | 10.82 + Male | intermediate level of education | | | 11.54 | 1.02 | [ 9.54, 13.54] | 11.34 + Female | | | | 13.35 | 0.77 | [ 11.84, 14.85] | 17.45 + Male | high level of education | | | 13.00 | 1.83 | [ 9.39, 16.61] | 7.09 + Female | | | | 11.43 | 1.39 | [ 8.70, 14.15] | 8.24 + + Variable predicted: neg_c_7 + Predictors modulated: c161sex, c172code, e16sex, nur_pst + +--- + + Code + print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst", + "negc7d"), backend = "marginaleffects"), table_width = Inf) + Output + Conditional Predictions + + c161sex | c172code | e16sex | nur_pst | negc7d | Mean | SE | 95% CI | t(370) + ----------------------------------------------------------------------------------------------------------------------- + Male | low level of education | male | Care Level 1 | 0 | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 + Female | low level of education | male | Care Level 1 | 0 | 10.00 | 1.02 | [ 7.99, 12.01] | 9.80 + Male | intermediate level of education | male | Care Level 1 | 0 | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 + Female | intermediate level of education | male | Care Level 1 | 0 | 9.13 | 0.59 | [ 7.97, 10.29] | 15.50 + Male | high level of education | male | Care Level 1 | 0 | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 + Female | high level of education | male | Care Level 1 | 0 | 10.00 | 2.28 | [ 5.51, 14.49] | 4.38 + Male | low level of education | female | Care Level 1 | 0 | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 + Female | low level of education | female | Care Level 1 | 0 | 8.89 | 0.76 | [ 7.39, 10.38] | 11.69 + Male | intermediate level of education | female | Care Level 1 | 0 | 9.21 | 0.61 | [ 8.02, 10.41] | 15.11 + Female | intermediate level of education | female | Care Level 1 | 0 | 9.47 | 0.40 | [ 8.68, 10.26] | 23.48 + Male | high level of education | female | Care Level 1 | 0 | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 + Female | high level of education | female | Care Level 1 | 0 | 8.71 | 0.86 | [ 7.02, 10.41] | 10.11 + Male | low level of education | male | Care Level 2 | 0 | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 + Female | low level of education | male | Care Level 2 | 0 | 9.50 | 0.93 | [ 7.67, 11.33] | 10.20 + Male | intermediate level of education | male | Care Level 2 | 0 | 8.75 | 1.14 | [ 6.51, 10.99] | 7.67 + Female | intermediate level of education | male | Care Level 2 | 0 | 9.30 | 0.72 | [ 7.88, 10.72] | 12.89 + Male | high level of education | male | Care Level 2 | 0 | 10.00 | 2.28 | [ 5.51, 14.49] | 4.38 + Female | high level of education | male | Care Level 2 | 0 | 9.00 | 1.14 | [ 6.76, 11.24] | 7.89 + Male | low level of education | female | Care Level 2 | 0 | 10.50 | 1.61 | [ 7.33, 13.67] | 6.51 + Female | low level of education | female | Care Level 2 | 0 | 9.17 | 0.93 | [ 7.34, 11.00] | 9.84 + Male | intermediate level of education | female | Care Level 2 | 0 | 8.50 | 0.66 | [ 7.20, 9.80] | 12.91 + Female | intermediate level of education | female | Care Level 2 | 0 | 9.30 | 0.42 | [ 8.48, 10.12] | 22.33 + Male | high level of education | female | Care Level 2 | 0 | 9.43 | 0.86 | [ 7.73, 11.12] | 10.93 + Female | high level of education | female | Care Level 2 | 0 | 8.00 | 1.61 | [ 4.83, 11.17] | 4.96 + Male | low level of education | male | Care Level 3/3+ | 0 | 3.67 | 6.95 | [-10.00, 17.35] | 0.53 + Female | low level of education | male | Care Level 3/3+ | 0 | 9.67 | 1.32 | [ 7.08, 12.26] | 7.34 + Male | intermediate level of education | male | Care Level 3/3+ | 0 | 9.75 | 1.14 | [ 7.51, 11.99] | 8.55 + Female | intermediate level of education | male | Care Level 3/3+ | 0 | 9.50 | 1.14 | [ 7.26, 11.74] | 8.33 + Male | high level of education | male | Care Level 3/3+ | 0 | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 + Female | high level of education | male | Care Level 3/3+ | 0 | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 + Male | low level of education | female | Care Level 3/3+ | 0 | 8.50 | 1.61 | [ 5.33, 11.67] | 5.27 + Female | low level of education | female | Care Level 3/3+ | 0 | 8.67 | 1.32 | [ 6.08, 11.26] | 6.58 + Male | intermediate level of education | female | Care Level 3/3+ | 0 | 9.13 | 0.81 | [ 7.54, 10.71] | 11.31 + Female | intermediate level of education | female | Care Level 3/3+ | 0 | 9.78 | 0.76 | [ 8.28, 11.27] | 12.86 + Male | high level of education | female | Care Level 3/3+ | 0 | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 + Female | high level of education | female | Care Level 3/3+ | 0 | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 + Male | low level of education | male | Care Level 1 | 1 | 12.00 | 2.28 | [ 7.51, 16.49] | 5.26 + Female | low level of education | male | Care Level 1 | 1 | 16.43 | 0.86 | [ 14.73, 18.12] | 19.05 + Male | intermediate level of education | male | Care Level 1 | 1 | 14.00 | 1.61 | [ 10.83, 17.17] | 8.68 + Female | intermediate level of education | male | Care Level 1 | 1 | 13.57 | 0.86 | [ 11.88, 15.27] | 15.74 + Male | high level of education | male | Care Level 1 | 1 | 16.00 | 1.32 | [ 13.41, 18.59] | 12.15 + Female | high level of education | male | Care Level 1 | 1 | 27.92 | 5.08 | [ 17.93, 37.91] | 5.50 + Male | low level of education | female | Care Level 1 | 1 | 17.00 | 1.32 | [ 14.41, 19.59] | 12.91 + Female | low level of education | female | Care Level 1 | 1 | 15.00 | 0.86 | [ 13.30, 16.70] | 17.40 + Male | intermediate level of education | female | Care Level 1 | 1 | 12.80 | 1.02 | [ 10.79, 14.81] | 12.55 + Female | intermediate level of education | female | Care Level 1 | 1 | 13.77 | 0.49 | [ 12.82, 14.73] | 28.32 + Male | high level of education | female | Care Level 1 | 1 | 14.33 | 1.32 | [ 11.74, 16.92] | 10.88 + Female | high level of education | female | Care Level 1 | 1 | 14.82 | 0.69 | [ 13.47, 16.17] | 21.54 + Male | low level of education | male | Care Level 2 | 1 | 13.00 | 2.28 | [ 8.51, 17.49] | 5.70 + Female | low level of education | male | Care Level 2 | 1 | 14.57 | 0.86 | [ 12.88, 16.27] | 16.90 + Male | intermediate level of education | male | Care Level 2 | 1 | 17.75 | 1.14 | [ 15.51, 19.99] | 15.56 + Female | intermediate level of education | male | Care Level 2 | 1 | 14.95 | 0.52 | [ 13.92, 15.98] | 28.56 + Male | high level of education | male | Care Level 2 | 1 | 3.80 | 8.72 | [-13.34, 20.94] | 0.44 + Female | high level of education | male | Care Level 2 | 1 | 15.80 | 1.02 | [ 13.79, 17.81] | 15.49 + Male | low level of education | female | Care Level 2 | 1 | 17.00 | 1.61 | [ 13.83, 20.17] | 10.54 + Female | low level of education | female | Care Level 2 | 1 | 13.17 | 0.93 | [ 11.34, 15.00] | 14.14 + Male | intermediate level of education | female | Care Level 2 | 1 | 16.50 | 0.93 | [ 14.67, 18.33] | 17.72 + Female | intermediate level of education | female | Care Level 2 | 1 | 14.61 | 0.48 | [ 13.67, 15.54] | 30.71 + Male | high level of education | female | Care Level 2 | 1 | 15.33 | 1.32 | [ 12.74, 17.92] | 11.64 + Female | high level of education | female | Care Level 2 | 1 | 15.50 | 0.61 | [ 14.30, 16.70] | 25.42 + Male | low level of education | male | Care Level 3/3+ | 1 | 1.78 | 7.99 | [-13.93, 17.48] | 0.22 + Female | low level of education | male | Care Level 3/3+ | 1 | 13.00 | 0.81 | [ 11.41, 14.59] | 16.12 + Male | intermediate level of education | male | Care Level 3/3+ | 1 | 18.67 | 1.32 | [ 16.08, 21.26] | 14.17 + Female | intermediate level of education | male | Care Level 3/3+ | 1 | 18.06 | 0.54 | [ 17.00, 19.11] | 33.58 + Male | high level of education | male | Care Level 3/3+ | 1 | 4.60 | 7.00 | [ -9.17, 18.38] | 0.66 + Female | high level of education | male | Care Level 3/3+ | 1 | 19.00 | 1.61 | [ 15.83, 22.17] | 11.78 + Male | low level of education | female | Care Level 3/3+ | 1 | 19.00 | 2.28 | [ 14.51, 23.49] | 8.33 + Female | low level of education | female | Care Level 3/3+ | 1 | 19.75 | 1.14 | [ 17.51, 21.99] | 17.31 + Male | intermediate level of education | female | Care Level 3/3+ | 1 | 15.40 | 1.02 | [ 13.39, 17.41] | 15.09 + Female | intermediate level of education | female | Care Level 3/3+ | 1 | 15.64 | 0.61 | [ 14.44, 16.84] | 25.65 + Male | high level of education | female | Care Level 3/3+ | 1 | 14.33 | 1.32 | [ 11.74, 16.92] | 10.88 + Female | high level of education | female | Care Level 3/3+ | 1 | 13.25 | 1.14 | [ 11.01, 15.49] | 11.62 + + Variable predicted: neg_c_7 + Predictors modulated: c161sex, c172code, e16sex, nur_pst, negc7d + +--- + + Code + print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst", + "negc7d"), backend = "marginaleffects"), full_labels = FALSE, table_width = Inf) + Output + Conditional Predictions + + c161sex | c172code | e16sex | nur_pst | negc7d | Mean | SE | 95% CI | t(370) + ----------------------------------------------------------------------------------------------------------------------- + Male | low level of education | male | Care Level 1 | 0 | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 + Female | | | | | 10.00 | 1.02 | [ 7.99, 12.01] | 9.80 + Male | intermediate level of education | | | | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 + Female | | | | | 9.13 | 0.59 | [ 7.97, 10.29] | 15.50 + Male | high level of education | | | | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 + Female | | | | | 10.00 | 2.28 | [ 5.51, 14.49] | 4.38 + Male | low level of education | female | | | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 + Female | | | | | 8.89 | 0.76 | [ 7.39, 10.38] | 11.69 + Male | intermediate level of education | | | | 9.21 | 0.61 | [ 8.02, 10.41] | 15.11 + Female | | | | | 9.47 | 0.40 | [ 8.68, 10.26] | 23.48 + Male | high level of education | | | | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 + Female | | | | | 8.71 | 0.86 | [ 7.02, 10.41] | 10.11 + Male | low level of education | male | Care Level 2 | | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 + Female | | | | | 9.50 | 0.93 | [ 7.67, 11.33] | 10.20 + Male | intermediate level of education | | | | 8.75 | 1.14 | [ 6.51, 10.99] | 7.67 + Female | | | | | 9.30 | 0.72 | [ 7.88, 10.72] | 12.89 + Male | high level of education | | | | 10.00 | 2.28 | [ 5.51, 14.49] | 4.38 + Female | | | | | 9.00 | 1.14 | [ 6.76, 11.24] | 7.89 + Male | low level of education | female | | | 10.50 | 1.61 | [ 7.33, 13.67] | 6.51 + Female | | | | | 9.17 | 0.93 | [ 7.34, 11.00] | 9.84 + Male | intermediate level of education | | | | 8.50 | 0.66 | [ 7.20, 9.80] | 12.91 + Female | | | | | 9.30 | 0.42 | [ 8.48, 10.12] | 22.33 + Male | high level of education | | | | 9.43 | 0.86 | [ 7.73, 11.12] | 10.93 + Female | | | | | 8.00 | 1.61 | [ 4.83, 11.17] | 4.96 + Male | low level of education | male | Care Level 3/3+ | | 3.67 | 6.95 | [-10.00, 17.35] | 0.53 + Female | | | | | 9.67 | 1.32 | [ 7.08, 12.26] | 7.34 + Male | intermediate level of education | | | | 9.75 | 1.14 | [ 7.51, 11.99] | 8.55 + Female | | | | | 9.50 | 1.14 | [ 7.26, 11.74] | 8.33 + Male | high level of education | | | | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 + Female | | | | | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 + Male | low level of education | female | | | 8.50 | 1.61 | [ 5.33, 11.67] | 5.27 + Female | | | | | 8.67 | 1.32 | [ 6.08, 11.26] | 6.58 + Male | intermediate level of education | | | | 9.13 | 0.81 | [ 7.54, 10.71] | 11.31 + Female | | | | | 9.78 | 0.76 | [ 8.28, 11.27] | 12.86 + Male | high level of education | | | | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 + Female | | | | | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 + Male | low level of education | male | Care Level 1 | 1 | 12.00 | 2.28 | [ 7.51, 16.49] | 5.26 + Female | | | | | 16.43 | 0.86 | [ 14.73, 18.12] | 19.05 + Male | intermediate level of education | | | | 14.00 | 1.61 | [ 10.83, 17.17] | 8.68 + Female | | | | | 13.57 | 0.86 | [ 11.88, 15.27] | 15.74 + Male | high level of education | | | | 16.00 | 1.32 | [ 13.41, 18.59] | 12.15 + Female | | | | | 27.92 | 5.08 | [ 17.93, 37.91] | 5.50 + Male | low level of education | female | | | 17.00 | 1.32 | [ 14.41, 19.59] | 12.91 + Female | | | | | 15.00 | 0.86 | [ 13.30, 16.70] | 17.40 + Male | intermediate level of education | | | | 12.80 | 1.02 | [ 10.79, 14.81] | 12.55 + Female | | | | | 13.77 | 0.49 | [ 12.82, 14.73] | 28.32 + Male | high level of education | | | | 14.33 | 1.32 | [ 11.74, 16.92] | 10.88 + Female | | | | | 14.82 | 0.69 | [ 13.47, 16.17] | 21.54 + Male | low level of education | male | Care Level 2 | | 13.00 | 2.28 | [ 8.51, 17.49] | 5.70 + Female | | | | | 14.57 | 0.86 | [ 12.88, 16.27] | 16.90 + Male | intermediate level of education | | | | 17.75 | 1.14 | [ 15.51, 19.99] | 15.56 + Female | | | | | 14.95 | 0.52 | [ 13.92, 15.98] | 28.56 + Male | high level of education | | | | 3.80 | 8.72 | [-13.34, 20.94] | 0.44 + Female | | | | | 15.80 | 1.02 | [ 13.79, 17.81] | 15.49 + Male | low level of education | female | | | 17.00 | 1.61 | [ 13.83, 20.17] | 10.54 + Female | | | | | 13.17 | 0.93 | [ 11.34, 15.00] | 14.14 + Male | intermediate level of education | | | | 16.50 | 0.93 | [ 14.67, 18.33] | 17.72 + Female | | | | | 14.61 | 0.48 | [ 13.67, 15.54] | 30.71 + Male | high level of education | | | | 15.33 | 1.32 | [ 12.74, 17.92] | 11.64 + Female | | | | | 15.50 | 0.61 | [ 14.30, 16.70] | 25.42 + Male | low level of education | male | Care Level 3/3+ | | 1.78 | 7.99 | [-13.93, 17.48] | 0.22 + Female | | | | | 13.00 | 0.81 | [ 11.41, 14.59] | 16.12 + Male | intermediate level of education | | | | 18.67 | 1.32 | [ 16.08, 21.26] | 14.17 + Female | | | | | 18.06 | 0.54 | [ 17.00, 19.11] | 33.58 + Male | high level of education | | | | 4.60 | 7.00 | [ -9.17, 18.38] | 0.66 + Female | | | | | 19.00 | 1.61 | [ 15.83, 22.17] | 11.78 + Male | low level of education | female | | | 19.00 | 2.28 | [ 14.51, 23.49] | 8.33 + Female | | | | | 19.75 | 1.14 | [ 17.51, 21.99] | 17.31 + Male | intermediate level of education | | | | 15.40 | 1.02 | [ 13.39, 17.41] | 15.09 + Female | | | | | 15.64 | 0.61 | [ 14.44, 16.84] | 25.65 + Male | high level of education | | | | 14.33 | 1.32 | [ 11.74, 16.92] | 10.88 + Female | | | | | 13.25 | 1.14 | [ 11.01, 15.49] | 11.62 + + Variable predicted: neg_c_7 + Predictors modulated: c161sex, c172code, e16sex, nur_pst, negc7d + +# estimate_means - protect integers + + Code + estimate_expectation(model, by = c("c160age=[fivenum]", "c161sex")) + Output + Conditional Predictions + + c160age | c161sex | Predicted | SE | 95% CI + ----------------------------------------------------- + 44 | Male | 11.80 | 0.33 | [11.15, 12.45] + 54 | Male | 11.65 | 0.31 | [11.04, 12.26] + 63 | Male | 11.51 | 0.36 | [10.81, 12.21] + 89 | Male | 11.11 | 0.66 | [ 9.81, 12.41] + 18 | Female | 11.42 | 0.50 | [10.44, 12.40] + 44 | Female | 11.92 | 0.26 | [11.41, 12.44] + 54 | Female | 12.12 | 0.22 | [11.69, 12.55] + 63 | Female | 12.29 | 0.23 | [11.84, 12.74] + + Variable predicted: neg_c_7 + Predictors modulated: c160age=[fivenum], c161sex + Predictors controlled: barthtot (65), e16sex (male) + +--- + + Code + estimate_means(model, by = c("c160age=[fivenum]", "c161sex"), backend = "marginaleffects") + Output + Conditional Predictions + + c160age | c161sex | Mean | SE | 95% CI | t(865) + ---------------------------------------------------------- + 18 | Male | 12.08 | 0.60 | [10.91, 13.26] | 20.22 + 44 | Male | 11.68 | 0.29 | [11.12, 12.24] | 40.98 + 54 | Male | 11.53 | 0.25 | [11.03, 12.02] | 45.75 + 63 | Male | 11.39 | 0.30 | [10.80, 11.97] | 38.07 + 89 | Male | 10.99 | 0.62 | [ 9.76, 12.21] | 17.64 + 18 | Female | 11.30 | 0.44 | [10.44, 12.17] | 25.63 + 44 | Female | 11.80 | 0.18 | [11.44, 12.17] | 63.99 + 54 | Female | 12.00 | 0.14 | [11.72, 12.28] | 84.30 + 63 | Female | 12.17 | 0.18 | [11.83, 12.52] | 69.56 + 89 | Female | 12.68 | 0.43 | [11.84, 13.51] | 29.74 + + Variable predicted: neg_c_7 + Predictors modulated: c160age=[fivenum], c161sex + Predictors averaged: barthtot (65), e16sex + From 4cdf6685c0b991950e265a857ab774f88bec980e Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:17:45 +0100 Subject: [PATCH 13/56] remove new --- .../plot-ordinal/plot-ordinal-bracl.new.svg | 85 --- .../estimate_contrasts_counterfactual.new.md | 20 - .../estimate_means_counterfactuals.new.md | 139 ----- tests/testthat/_snaps/windows/ordinal.new.md | 224 ------- tests/testthat/_snaps/windows/print.new.md | 584 ------------------ 5 files changed, 1052 deletions(-) delete mode 100644 tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.new.svg delete mode 100644 tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.new.md delete mode 100644 tests/testthat/_snaps/windows/estimate_means_counterfactuals.new.md delete mode 100644 tests/testthat/_snaps/windows/ordinal.new.md delete mode 100644 tests/testthat/_snaps/windows/print.new.md diff --git a/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.new.svg b/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.new.svg deleted file mode 100644 index 48b824030..000000000 --- a/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.new.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10% -20% -30% -40% -50% - - - - - - - -male -female -gender -Probability of research - -Response - - - - - - - - - - - - -definitely -probably -probably not -definitely not -plot-ordinal-bracl - - diff --git a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.new.md b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.new.md deleted file mode 100644 index 73c64943d..000000000 --- a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.new.md +++ /dev/null @@ -1,20 +0,0 @@ -# estimate_contrast, counterfactual, snapshots, Level-columns - - Code - print(out, table_width = Inf) - Output - Marginal Contrasts (G-computation) - - Level1 | Level2 | treatment | Difference | SE | 95% CI | z | p - --------------------------------------------------------------------------------- - post | pre | control | 1.85 | 1.22 | [-0.53, 4.23] | 1.52 | 0.128 - end | pre | control | 0.86 | 1.21 | [-1.51, 3.24] | 0.71 | 0.477 - end | post | control | -0.99 | 1.22 | [-3.37, 1.39] | -0.81 | 0.417 - post | pre | tx | 6.57 | 1.57 | [ 3.50, 9.65] | 4.19 | < .001 - end | pre | tx | 17.26 | 1.57 | [14.18, 20.34] | 10.99 | < .001 - end | post | tx | 10.69 | 1.57 | [ 7.62, 13.76] | 6.82 | < .001 - - Variable predicted: QoL - Predictors contrasted: time - p-values are uncorrected. - diff --git a/tests/testthat/_snaps/windows/estimate_means_counterfactuals.new.md b/tests/testthat/_snaps/windows/estimate_means_counterfactuals.new.md deleted file mode 100644 index 14e1ca9bf..000000000 --- a/tests/testthat/_snaps/windows/estimate_means_counterfactuals.new.md +++ /dev/null @@ -1,139 +0,0 @@ -# estimate_means() - counterfactuals - - Code - print(estimate_means(m, "spp", backend = "marginaleffects"), zap_small = TRUE, - table_width = Inf) - Output - Conditional Predictions - - spp | Mean | SE | 95% CI | z - ----------------------------------------- - GP | 1.24 | 0.22 | [0.80, 1.67] | 5.55 - PR | 0.31 | 0.08 | [0.16, 0.46] | 4.08 - DM | 1.56 | 0.27 | [1.02, 2.09] | 5.72 - EC-A | 0.57 | 0.12 | [0.34, 0.81] | 4.81 - EC-L | 2.30 | 0.39 | [1.54, 3.06] | 5.96 - DES-L | 2.44 | 0.41 | [1.64, 3.24] | 5.99 - DF | 1.34 | 0.24 | [0.87, 1.81] | 5.62 - - Variable predicted: count - Predictors modulated: spp - Predictors averaged: mined, site - Predictions are on the response-scale. - ---- - - Code - print(estimate_means(m, "spp", backend = "marginaleffects", estimate = "population"), - zap_small = TRUE, table_width = Inf) - Output - Marginal Predictions (G-computation) - - spp | Mean | SE | 95% CI | z - ----------------------------------------- - GP | 1.17 | 0.21 | [0.76, 1.58] | 5.60 - PR | 0.29 | 0.07 | [0.15, 0.43] | 4.09 - DM | 1.48 | 0.26 | [0.97, 1.98] | 5.77 - EC-A | 0.54 | 0.11 | [0.32, 0.76] | 4.84 - EC-L | 2.18 | 0.36 | [1.47, 2.89] | 6.01 - DES-L | 2.31 | 0.38 | [1.56, 3.06] | 6.04 - DF | 1.27 | 0.22 | [0.83, 1.71] | 5.66 - - Variable predicted: count - Predictors modulated: spp - Predictions are on the response-scale. - ---- - - Code - print(estimate_means(m, "spp", backend = "marginaleffects", predict = "inverse_link"), - zap_small = TRUE, table_width = Inf) - Output - Conditional Predictions - - spp | Mean | SE | 95% CI | z - ------------------------------------------ - GP | 0.62 | 0.10 | [0.45, 0.87] | -2.83 - PR | 0.16 | 0.04 | [0.10, 0.25] | -7.88 - DM | 0.79 | 0.13 | [0.57, 1.08] | -1.50 - EC-A | 0.29 | 0.06 | [0.20, 0.42] | -6.32 - EC-L | 1.16 | 0.18 | [0.86, 1.57] | 0.97 - DES-L | 1.23 | 0.19 | [0.91, 1.66] | 1.36 - DF | 0.68 | 0.11 | [0.49, 0.93] | -2.38 - - Variable predicted: count - Predictors modulated: spp - Predictors averaged: mined, site - Predictions are on the response-scale. - ---- - - Code - print(estimate_means(m, "spp", backend = "marginaleffects", estimate = "population", - predict = "inverse_link"), zap_small = TRUE, table_width = Inf) - Output - Marginal Predictions (G-computation) - - spp | Mean | SE | 95% CI | z - ------------------------------------------ - GP | 0.66 | 0.11 | [0.47, 0.91] | -2.55 - PR | 0.16 | 0.04 | [0.10, 0.26] | -7.70 - DM | 0.82 | 0.13 | [0.60, 1.13] | -1.20 - EC-A | 0.30 | 0.06 | [0.21, 0.44] | -6.10 - EC-L | 1.22 | 0.19 | [0.90, 1.64] | 1.30 - DES-L | 1.29 | 0.20 | [0.96, 1.74] | 1.69 - DF | 0.71 | 0.12 | [0.52, 0.98] | -2.10 - - Variable predicted: count - Predictors modulated: spp - Predictions are on the response-scale. - ---- - - Code - print(estimate_means(m, "Days", backend = "marginaleffects"), zap_small = TRUE, - table_width = Inf) - Output - Conditional Predictions - - Days | Mean | SE | 95% CI | t(174) - ------------------------------------------------- - 0 | 251.32 | 7.59 | [236.34, 266.31] | 33.11 - 1 | 261.49 | 7.55 | [246.57, 276.40] | 34.61 - 2 | 271.65 | 7.89 | [256.08, 287.21] | 34.45 - 3 | 281.81 | 8.54 | [264.95, 298.67] | 33.00 - 4 | 291.97 | 9.45 | [273.31, 310.63] | 30.89 - 5 | 302.13 | 10.56 | [281.30, 322.97] | 28.62 - 6 | 312.29 | 11.80 | [289.01, 335.58] | 26.47 - 7 | 322.46 | 13.13 | [296.53, 348.38] | 24.55 - 8 | 332.62 | 14.54 | [303.91, 361.33] | 22.87 - 9 | 342.78 | 16.01 | [311.19, 374.37] | 21.41 - - Variable predicted: Reaction - Predictors modulated: Days - Predictors averaged: Subject - ---- - - Code - print(estimate_means(m, "Days", backend = "marginaleffects", estimate = "population"), - zap_small = TRUE, table_width = Inf) - Output - Marginal Predictions (G-computation) - - Days | Mean | SE | 95% CI | t(174) - ------------------------------------------------- - 0 | 248.80 | 7.59 | [233.82, 263.79] | 32.78 - 1 | 259.04 | 7.55 | [244.13, 273.95] | 34.29 - 2 | 269.28 | 7.89 | [253.72, 284.85] | 34.15 - 3 | 279.52 | 8.54 | [262.67, 296.38] | 32.73 - 4 | 289.76 | 9.45 | [271.11, 308.42] | 30.65 - 5 | 300.01 | 10.56 | [279.17, 320.84] | 28.42 - 6 | 310.25 | 11.80 | [286.96, 333.53] | 26.30 - 7 | 320.49 | 13.13 | [294.56, 346.41] | 24.40 - 8 | 330.73 | 14.54 | [302.02, 359.43] | 22.74 - 9 | 340.97 | 16.01 | [309.37, 372.56] | 21.30 - - Variable predicted: Reaction - Predictors modulated: Days - diff --git a/tests/testthat/_snaps/windows/ordinal.new.md b/tests/testthat/_snaps/windows/ordinal.new.md deleted file mode 100644 index 52a6b203e..000000000 --- a/tests/testthat/_snaps/windows/ordinal.new.md +++ /dev/null @@ -1,224 +0,0 @@ -# estimate_relation prints ordinal models correctly - - Code - print(out, zap_small = TRUE) - Output - Conditional Predictions - - Row | Response | Sepal.Width | Predicted | SE | 95% CI - ---------------------------------------------------------------- - 1 | setosa | 2.00 | 0.00 | 0.00 | [0.00, 0.01] - 1 | versicolor | 2.00 | 0.85 | 0.08 | [0.65, 0.95] - 1 | virginica | 2.00 | 0.15 | 0.08 | [0.05, 0.34] - 2 | setosa | 2.27 | 0.01 | 0.01 | [0.00, 0.02] - 2 | versicolor | 2.27 | 0.77 | 0.08 | [0.60, 0.90] - 2 | virginica | 2.27 | 0.22 | 0.08 | [0.10, 0.40] - 3 | setosa | 2.53 | 0.02 | 0.01 | [0.01, 0.06] - 3 | versicolor | 2.53 | 0.65 | 0.07 | [0.52, 0.78] - 3 | virginica | 2.53 | 0.32 | 0.07 | [0.20, 0.45] - 4 | setosa | 2.80 | 0.09 | 0.03 | [0.04, 0.16] - 4 | versicolor | 2.80 | 0.49 | 0.05 | [0.39, 0.59] - 4 | virginica | 2.80 | 0.42 | 0.05 | [0.32, 0.52] - 5 | setosa | 3.07 | 0.27 | 0.05 | [0.19, 0.36] - 5 | versicolor | 3.07 | 0.29 | 0.05 | [0.21, 0.39] - 5 | virginica | 3.07 | 0.43 | 0.05 | [0.33, 0.53] - 6 | setosa | 3.33 | 0.58 | 0.06 | [0.47, 0.68] - 6 | versicolor | 3.33 | 0.12 | 0.04 | [0.06, 0.21] - 6 | virginica | 3.33 | 0.30 | 0.05 | [0.20, 0.40] - 7 | setosa | 3.60 | 0.82 | 0.06 | [0.68, 0.91] - 7 | versicolor | 3.60 | 0.04 | 0.02 | [0.01, 0.08] - 7 | virginica | 3.60 | 0.15 | 0.05 | [0.07, 0.26] - 8 | setosa | 3.87 | 0.93 | 0.04 | [0.83, 0.98] - 8 | versicolor | 3.87 | 0.01 | 0.01 | [0.00, 0.03] - 8 | virginica | 3.87 | 0.06 | 0.04 | [0.02, 0.15] - 9 | setosa | 4.13 | 0.97 | 0.02 | [0.91, 1.00] - 9 | versicolor | 4.13 | 0.00 | 0.00 | [0.00, 0.01] - 9 | virginica | 4.13 | 0.02 | 0.02 | [0.00, 0.08] - 10 | setosa | 4.40 | 0.99 | 0.01 | [0.95, 1.00] - 10 | versicolor | 4.40 | 0.00 | 0.00 | [0.00, 0.00] - 10 | virginica | 4.40 | 0.01 | 0.01 | [0.00, 0.04] - - Variable predicted: Species - Predictors modulated: Sepal.Width - Predictions are on the response-scale. - ---- - - Code - print(out, zap_small = TRUE) - Output - Conditional Predictions - - Sepal.Width | Response | Median | 95% CI | pd | ROPE | % in ROPE - ----------------------------------------------------------------------------------- - 2.00 | setosa | 0.00 | [0.00, 0.01] | 100% | [-0.10, 0.10] | 100% - 2.00 | versicolor | 0.86 | [0.65, 0.95] | 100% | [-0.10, 0.10] | 0% - 2.00 | virginica | 0.14 | [0.05, 0.34] | 100% | [-0.10, 0.10] | 28.00% - 2.27 | setosa | 0.00 | [0.00, 0.02] | 100% | [-0.10, 0.10] | 100% - 2.27 | versicolor | 0.78 | [0.60, 0.90] | 100% | [-0.10, 0.10] | 0% - 2.27 | virginica | 0.21 | [0.10, 0.40] | 100% | [-0.10, 0.10] | 0% - 2.53 | setosa | 0.02 | [0.01, 0.06] | 100% | [-0.10, 0.10] | 100% - 2.53 | versicolor | 0.66 | [0.52, 0.78] | 100% | [-0.10, 0.10] | 0% - 2.53 | virginica | 0.32 | [0.20, 0.45] | 100% | [-0.10, 0.10] | 0% - 2.80 | setosa | 0.09 | [0.04, 0.16] | 100% | [-0.10, 0.10] | 65.72% - 2.80 | versicolor | 0.49 | [0.39, 0.59] | 100% | [-0.10, 0.10] | 0% - 2.80 | virginica | 0.41 | [0.32, 0.52] | 100% | [-0.10, 0.10] | 0% - 3.07 | setosa | 0.27 | [0.19, 0.36] | 100% | [-0.10, 0.10] | 0% - 3.07 | versicolor | 0.30 | [0.21, 0.39] | 100% | [-0.10, 0.10] | 0% - 3.07 | virginica | 0.43 | [0.33, 0.53] | 100% | [-0.10, 0.10] | 0% - 3.33 | setosa | 0.57 | [0.47, 0.68] | 100% | [-0.10, 0.10] | 0% - 3.33 | versicolor | 0.12 | [0.06, 0.21] | 100% | [-0.10, 0.10] | 29.76% - 3.33 | virginica | 0.30 | [0.20, 0.40] | 100% | [-0.10, 0.10] | 0% - 3.60 | setosa | 0.82 | [0.68, 0.91] | 100% | [-0.10, 0.10] | 0% - 3.60 | versicolor | 0.03 | [0.01, 0.08] | 100% | [-0.10, 0.10] | 100% - 3.60 | virginica | 0.14 | [0.07, 0.26] | 100% | [-0.10, 0.10] | 17.37% - 3.87 | setosa | 0.94 | [0.83, 0.98] | 100% | [-0.10, 0.10] | 0% - 3.87 | versicolor | 0.01 | [0.00, 0.03] | 100% | [-0.10, 0.10] | 100% - 3.87 | virginica | 0.05 | [0.02, 0.15] | 100% | [-0.10, 0.10] | 89.59% - 4.13 | setosa | 0.98 | [0.91, 1.00] | 100% | [-0.10, 0.10] | 0% - 4.13 | versicolor | 0.00 | [0.00, 0.01] | 100% | [-0.10, 0.10] | 100% - 4.13 | virginica | 0.02 | [0.00, 0.08] | 100% | [-0.10, 0.10] | 100% - 4.40 | setosa | 0.99 | [0.95, 1.00] | 100% | [-0.10, 0.10] | 0% - 4.40 | versicolor | 0.00 | [0.00, 0.00] | 100% | [-0.10, 0.10] | 100% - 4.40 | virginica | 0.01 | [0.00, 0.04] | 100% | [-0.10, 0.10] | 100% - - Variable predicted: Species - Predictors modulated: Sepal.Width - Predictions are on the response-scale. - ---- - - Code - print(out, zap_small = TRUE) - Output - Conditional Predictions - - Row | Response | Sepal.Width | Predicted | 95% CI - --------------------------------------------------------- - 1 | setosa | 2.00 | 0.05 | [0.01, 0.22] - 1 | versicolor | 2.00 | 0.17 | [0.04, 0.51] - 1 | virginica | 2.00 | 0.78 | [0.41, 0.95] - 2 | setosa | 2.27 | 0.09 | [0.02, 0.38] - 2 | versicolor | 2.27 | 0.24 | [0.05, 0.67] - 2 | virginica | 2.27 | 0.67 | [0.24, 0.93] - 3 | setosa | 2.53 | 0.15 | [0.02, 0.57] - 3 | versicolor | 2.53 | 0.32 | [0.06, 0.78] - 3 | virginica | 2.53 | 0.54 | [0.13, 0.90] - 4 | setosa | 2.80 | 0.23 | [0.03, 0.74] - 4 | versicolor | 2.80 | 0.37 | [0.06, 0.85] - 4 | virginica | 2.80 | 0.40 | [0.06, 0.86] - 5 | setosa | 3.07 | 0.34 | [0.04, 0.86] - 5 | versicolor | 3.07 | 0.38 | [0.05, 0.88] - 5 | virginica | 3.07 | 0.28 | [0.03, 0.82] - 6 | setosa | 3.33 | 0.47 | [0.06, 0.93] - 6 | versicolor | 3.33 | 0.35 | [0.03, 0.89] - 6 | virginica | 3.33 | 0.18 | [0.01, 0.77] - 7 | setosa | 3.60 | 0.61 | [0.08, 0.97] - 7 | versicolor | 3.60 | 0.28 | [0.02, 0.88] - 7 | virginica | 3.60 | 0.11 | [0.01, 0.70] - 8 | setosa | 3.87 | 0.73 | [0.11, 0.98] - 8 | versicolor | 3.87 | 0.20 | [0.01, 0.85] - 8 | virginica | 3.87 | 0.07 | [0.00, 0.63] - 9 | setosa | 4.13 | 0.82 | [0.14, 0.99] - 9 | versicolor | 4.13 | 0.14 | [0.01, 0.82] - 9 | virginica | 4.13 | 0.04 | [0.00, 0.55] - 10 | setosa | 4.40 | 0.89 | [0.19, 1.00] - 10 | versicolor | 4.40 | 0.09 | [0.00, 0.77] - 10 | virginica | 4.40 | 0.02 | [0.00, 0.46] - - Variable predicted: Species - Predictors modulated: Sepal.Width - Predictions are on the response-scale. - ---- - - Code - print(out, zap_small = TRUE) - Output - Conditional Predictions - - Sepal.Width | Response | Probability | SE | 95% CI | t(147) - ---------------------------------------------------------------------- - 2.00 | setosa | 0.05 | 0.02 | [ 0.01, 0.10] | 2.21 - 2.00 | versicolor | 0.17 | 0.05 | [ 0.07, 0.27] | 3.22 - 2.00 | virginica | 0.78 | 0.07 | [ 0.63, 0.92] | 10.56 - 2.27 | setosa | 0.09 | 0.03 | [ 0.03, 0.15] | 2.89 - 2.27 | versicolor | 0.24 | 0.05 | [ 0.14, 0.34] | 4.89 - 2.27 | virginica | 0.67 | 0.07 | [ 0.52, 0.81] | 9.15 - 2.53 | setosa | 0.15 | 0.04 | [ 0.07, 0.22] | 4.05 - 2.53 | versicolor | 0.32 | 0.04 | [ 0.23, 0.40] | 7.35 - 2.53 | virginica | 0.54 | 0.06 | [ 0.42, 0.66] | 8.81 - 2.80 | setosa | 0.23 | 0.04 | [ 0.15, 0.30] | 5.96 - 2.80 | versicolor | 0.37 | 0.04 | [ 0.29, 0.46] | 8.71 - 2.80 | virginica | 0.40 | 0.05 | [ 0.31, 0.49] | 8.76 - 3.07 | setosa | 0.34 | 0.04 | [ 0.26, 0.42] | 8.09 - 3.07 | versicolor | 0.38 | 0.04 | [ 0.30, 0.47] | 8.73 - 3.07 | virginica | 0.28 | 0.04 | [ 0.20, 0.35] | 7.23 - 3.33 | setosa | 0.47 | 0.05 | [ 0.36, 0.58] | 8.72 - 3.33 | versicolor | 0.35 | 0.04 | [ 0.26, 0.43] | 8.10 - 3.33 | virginica | 0.18 | 0.04 | [ 0.11, 0.25] | 4.94 - 3.60 | setosa | 0.61 | 0.07 | [ 0.47, 0.74] | 8.83 - 3.60 | versicolor | 0.28 | 0.05 | [ 0.19, 0.37] | 5.91 - 3.60 | virginica | 0.11 | 0.03 | [ 0.05, 0.18] | 3.40 - 3.87 | setosa | 0.73 | 0.07 | [ 0.58, 0.88] | 9.72 - 3.87 | versicolor | 0.20 | 0.05 | [ 0.10, 0.31] | 3.85 - 3.87 | virginica | 0.07 | 0.03 | [ 0.01, 0.12] | 2.51 - 4.13 | setosa | 0.82 | 0.07 | [ 0.69, 0.96] | 11.84 - 4.13 | versicolor | 0.14 | 0.05 | [ 0.04, 0.24] | 2.66 - 4.13 | virginica | 0.04 | 0.02 | [ 0.00, 0.08] | 1.97 - 4.40 | setosa | 0.89 | 0.06 | [ 0.78, 1.00] | 15.64 - 4.40 | versicolor | 0.09 | 0.04 | [ 0.00, 0.17] | 2.00 - 4.40 | virginica | 0.02 | 0.01 | [-0.01, 0.05] | 1.62 - - Variable predicted: Species - Predictors modulated: Sepal.Width - Predictions are on the probs-scale. - -# estimate_means, print bracl - - Code - print(out, zap_small = TRUE) - Output - Conditional Predictions - - island | Response | Probability | SE | 95% CI | z - ------------------------------------------------------------------ - Biscoe | Adelie | 0.27 | 0.02 | [ 0.24, 0.30] | 17.09 - Biscoe | Chinstrap | 0.00 | 0.00 | [ 0.00, 0.00] | 22.91 - Biscoe | Gentoo | 0.72 | 0.02 | [ 0.69, 0.76] | 45.96 - Dream | Adelie | 0.45 | 0.01 | [ 0.43, 0.46] | 52.85 - Dream | Chinstrap | 0.55 | 0.02 | [ 0.51, 0.59] | 29.50 - Dream | Gentoo | 0.00 | 0.01 | [-0.02, 0.02] | 0.40 - Torgersen | Adelie | 0.98 | 0.05 | [ 0.89, 1.07] | 21.13 - Torgersen | Chinstrap | 0.01 | 0.03 | [-0.05, 0.08] | 0.32 - Torgersen | Gentoo | 0.01 | 0.01 | [-0.02, 0.04] | 0.72 - - Variable predicted: species - Predictors modulated: island - Predictors averaged: sex - Predictions are on the probs-scale. - ---- - - Code - print(out, zap_small = TRUE) - Output - Conditional Predictions - - island | Response | Probability | SE | 95% CI | t(325) - -------------------------------------------------------------------- - Biscoe | Adelie | 0.27 | 0.03 | [ 0.20, 0.34] | 7.76 - Biscoe | Chinstrap | 0.00 | 0.00 | [ 0.00, 0.00] | 0.00 - Biscoe | Gentoo | 0.73 | 0.03 | [ 0.66, 0.80] | 20.99 - Dream | Adelie | 0.45 | 0.04 | [ 0.36, 0.54] | 9.97 - Dream | Chinstrap | 0.55 | 0.04 | [ 0.46, 0.64] | 12.33 - Dream | Gentoo | 0.00 | 0.00 | [ 0.00, 0.00] | 0.00 - Torgersen | Adelie | 1.00 | 0.00 | [ 1.00, 1.00] | 4448.49 - Torgersen | Chinstrap | 0.00 | 0.00 | [ 0.00, 0.00] | 0.00 - Torgersen | Gentoo | 0.00 | 0.00 | [ 0.00, 0.00] | 0.01 - - Variable predicted: species - Predictors modulated: island - Predictors averaged: sex - Predictions are on the probs-scale. - diff --git a/tests/testthat/_snaps/windows/print.new.md b/tests/testthat/_snaps/windows/print.new.md deleted file mode 100644 index 9c7990db5..000000000 --- a/tests/testthat/_snaps/windows/print.new.md +++ /dev/null @@ -1,584 +0,0 @@ -# estimate_slopes - print summary - - Code - estimate_slopes(model_lm, trend = "x", by = "x", backend = "emmeans") - Output - Estimated Marginal Effects - - x | Slope | SE | 95% CI | t(998) | p - ------------------------------------------------------- - -3.38 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - -2.64 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - -1.90 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - -1.16 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - -0.42 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 0.32 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 1.06 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 1.80 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 2.54 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 3.28 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - - Marginal effects estimated for x - ---- - - Code - summary(deriv) - Message - There might be too few data to accurately determine intervals. Consider - setting `length = 100` (or larger) in your call to `estimate_slopes()`. - Output - Johnson-Neymann Intervals - - Start | End | Direction | Confidence - -------------------------------------- - -3.38 | 3.28 | positive | Significant - - Marginal effects estimated for x - ---- - - Code - estimate_slopes(model_lm, trend = "x", by = "x", backend = "marginaleffects") - Output - Estimated Marginal Effects - - x | Slope | SE | 95% CI | t(998) | p - ------------------------------------------------------- - -3.38 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - -2.64 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - -1.90 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - -1.16 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - -0.42 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 0.32 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 1.06 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 1.80 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 2.54 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - 3.28 | 12.75 | 0.25 | [12.26, 13.24] | 50.97 | < .001 - - Marginal effects estimated for x - Type of slope was dY/dX - ---- - - Code - summary(deriv2) - Message - There might be too few data to accurately determine intervals. Consider - setting `length = 100` (or larger) in your call to `estimate_slopes()`. - Output - Johnson-Neymann Intervals - - Start | End | Direction | Confidence - -------------------------------------- - -3.38 | 3.28 | positive | Significant - - Marginal effects estimated for x - Type of slope was dY/dX - -# estimate_slopes - print regular - - Code - print(estimate_slopes(model, trend = "Petal.Length", backend = "emmeans")) - Output - Estimated Marginal Effects - - Slope | SE | 95% CI | t(144) | p - --------------------------------------------- - 0.79 | 0.10 | [0.59, 0.99] | 7.69 | < .001 - - Marginal effects estimated for Petal.Length - ---- - - Code - print(estimate_slopes(model, trend = "Petal.Length", backend = "marginaleffects")) - Output - Estimated Marginal Effects - - Slope | SE | 95% CI | t(144) | p - --------------------------------------------- - 0.79 | 0.10 | [0.59, 0.99] | 7.69 | < .001 - - Marginal effects estimated for Petal.Length - Type of slope was dY/dX - -# estimate_means - print multiple by's - - Code - print(estimate_means(fit, c("c12hour", "c172code", "c161sex"), length = 4, - backend = "marginaleffects"), table_width = Inf) - Output - Conditional Predictions - - c12hour | c172code | c161sex | Mean | SE | 95% CI | t(791) - -------------------------------------------------------------------------------------------- - 4.00 | low level of education | Male | 11.66 | 0.90 | [ 9.90, 13.42] | 12.99 - 58.67 | low level of education | Male | 10.93 | 1.01 | [ 8.95, 12.91] | 10.86 - 113.33 | low level of education | Male | 10.20 | 2.31 | [ 5.66, 14.74] | 4.41 - 168.00 | low level of education | Male | 9.47 | 3.72 | [ 2.17, 16.77] | 2.55 - 4.00 | intermediate level of education | Male | 11.47 | 0.48 | [10.54, 12.41] | 24.12 - 58.67 | intermediate level of education | Male | 12.52 | 0.69 | [11.16, 13.87] | 18.12 - 113.33 | intermediate level of education | Male | 13.56 | 1.46 | [10.70, 16.42] | 9.31 - 168.00 | intermediate level of education | Male | 14.61 | 2.27 | [10.15, 19.07] | 6.43 - 4.00 | high level of education | Male | 11.03 | 0.63 | [ 9.79, 12.27] | 17.41 - 58.67 | high level of education | Male | 11.83 | 0.75 | [10.36, 13.30] | 15.78 - 113.33 | high level of education | Male | 12.63 | 1.42 | [ 9.84, 15.42] | 8.90 - 168.00 | high level of education | Male | 13.43 | 2.18 | [ 9.14, 17.71] | 6.15 - 4.00 | low level of education | Female | 12.24 | 0.41 | [11.43, 13.05] | 29.60 - 58.67 | low level of education | Female | 11.94 | 0.34 | [11.28, 12.60] | 35.50 - 113.33 | low level of education | Female | 11.65 | 0.54 | [10.59, 12.71] | 21.54 - 168.00 | low level of education | Female | 11.36 | 0.84 | [ 9.70, 13.01] | 13.49 - 4.00 | intermediate level of education | Female | 11.34 | 0.24 | [10.87, 11.81] | 47.06 - 58.67 | intermediate level of education | Female | 12.24 | 0.22 | [11.80, 12.67] | 54.82 - 113.33 | intermediate level of education | Female | 13.13 | 0.40 | [12.35, 13.91] | 33.09 - 168.00 | intermediate level of education | Female | 14.03 | 0.62 | [12.82, 15.24] | 22.72 - 4.00 | high level of education | Female | 12.49 | 0.45 | [11.61, 13.38] | 27.68 - 58.67 | high level of education | Female | 12.90 | 0.48 | [11.96, 13.84] | 26.99 - 113.33 | high level of education | Female | 13.31 | 0.97 | [11.40, 15.21] | 13.72 - 168.00 | high level of education | Female | 13.71 | 1.53 | [10.71, 16.71] | 8.97 - - Variable predicted: neg_c_7 - Predictors modulated: c12hour, c172code, c161sex - Predictors averaged: barthtot (65) - ---- - - Code - print(estimate_means(fit, c("c12hour", "barthtot = [sd]", "c161sex", "c172code", - "e16sex"), backend = "marginaleffects", length = 3), table_width = Inf) - Output - Conditional Predictions - - c12hour | barthtot | c161sex | c172code | e16sex | Mean | SE | 95% CI | t(766) - ------------------------------------------------------------------------------------------------------------------- - 4 | 35.12 | Male | low level of education | male | 9.74 | 4.63 | [ 0.66, 18.83] | 2.10 - 86 | 35.12 | Male | low level of education | male | 21.80 | 21.63 | [-20.65, 64.25] | 1.01 - 168 | 35.12 | Male | low level of education | male | 33.86 | 47.25 | [-58.90, 126.61] | 0.72 - 4 | 64.73 | Male | low level of education | male | 9.39 | 1.90 | [ 5.67, 13.11] | 4.95 - 86 | 64.73 | Male | low level of education | male | 11.99 | 5.40 | [ 1.39, 22.59] | 2.22 - 168 | 64.73 | Male | low level of education | male | 14.59 | 12.26 | [ -9.47, 38.66] | 1.19 - 4 | 94.34 | Male | low level of education | male | 9.03 | 2.38 | [ 4.36, 13.71] | 3.79 - 86 | 94.34 | Male | low level of education | male | 2.18 | 16.20 | [-29.62, 33.98] | 0.13 - 168 | 94.34 | Male | low level of education | male | -4.67 | 34.35 | [-72.09, 62.75] | -0.14 - 4 | 35.12 | Female | low level of education | male | 14.36 | 0.86 | [ 12.67, 16.05] | 16.71 - 86 | 35.12 | Female | low level of education | male | 13.13 | 0.54 | [ 12.07, 14.18] | 24.50 - 168 | 35.12 | Female | low level of education | male | 11.89 | 1.03 | [ 9.87, 13.91] | 11.58 - 4 | 64.73 | Female | low level of education | male | 11.84 | 0.62 | [ 10.62, 13.07] | 18.99 - 86 | 64.73 | Female | low level of education | male | 11.56 | 0.55 | [ 10.47, 12.64] | 20.92 - 168 | 64.73 | Female | low level of education | male | 11.27 | 1.06 | [ 9.19, 13.35] | 10.62 - 4 | 94.34 | Female | low level of education | male | 9.32 | 0.93 | [ 7.50, 11.15] | 10.05 - 86 | 94.34 | Female | low level of education | male | 9.99 | 0.87 | [ 8.29, 11.69] | 11.52 - 168 | 94.34 | Female | low level of education | male | 10.65 | 1.62 | [ 7.47, 13.82] | 6.58 - 4 | 35.12 | Male | intermediate level of education | male | 22.45 | 3.74 | [ 15.10, 29.80] | 6.00 - 86 | 35.12 | Male | intermediate level of education | male | 7.37 | 6.96 | [ -6.30, 21.03] | 1.06 - 168 | 35.12 | Male | intermediate level of education | male | -7.72 | 17.20 | [-41.47, 26.04] | -0.45 - 4 | 64.73 | Male | intermediate level of education | male | 15.45 | 1.82 | [ 11.87, 19.03] | 8.47 - 86 | 64.73 | Male | intermediate level of education | male | 14.82 | 5.47 | [ 4.08, 25.56] | 2.71 - 168 | 64.73 | Male | intermediate level of education | male | 14.19 | 12.22 | [ -9.81, 38.18] | 1.16 - 4 | 94.34 | Male | intermediate level of education | male | 8.45 | 1.17 | [ 6.16, 10.74] | 7.23 - 86 | 94.34 | Male | intermediate level of education | male | 22.27 | 7.76 | [ 7.05, 37.50] | 2.87 - 168 | 94.34 | Male | intermediate level of education | male | 36.09 | 16.29 | [ 4.11, 68.07] | 2.22 - 4 | 35.12 | Female | intermediate level of education | male | 12.96 | 0.79 | [ 11.40, 14.52] | 16.34 - 86 | 35.12 | Female | intermediate level of education | male | 14.46 | 0.47 | [ 13.55, 15.38] | 31.06 - 168 | 35.12 | Female | intermediate level of education | male | 15.97 | 0.67 | [ 14.66, 17.27] | 24.00 - 4 | 64.73 | Female | intermediate level of education | male | 11.48 | 0.45 | [ 10.59, 12.38] | 25.25 - 86 | 64.73 | Female | intermediate level of education | male | 13.22 | 0.44 | [ 12.37, 14.08] | 30.36 - 168 | 64.73 | Female | intermediate level of education | male | 14.96 | 0.85 | [ 13.28, 16.64] | 17.53 - 4 | 94.34 | Female | intermediate level of education | male | 10.01 | 0.54 | [ 8.95, 11.07] | 18.59 - 86 | 94.34 | Female | intermediate level of education | male | 11.98 | 0.66 | [ 10.69, 13.27] | 18.22 - 168 | 94.34 | Female | intermediate level of education | male | 13.95 | 1.32 | [ 11.37, 16.54] | 10.60 - 4 | 35.12 | Male | high level of education | male | 11.88 | 2.02 | [ 7.91, 15.85] | 5.88 - 86 | 35.12 | Male | high level of education | male | 13.93 | 1.48 | [ 11.03, 16.83] | 9.44 - 168 | 35.12 | Male | high level of education | male | 15.97 | 2.48 | [ 11.10, 20.84] | 6.44 - 4 | 64.73 | Male | high level of education | male | 11.45 | 1.19 | [ 9.11, 13.79] | 9.62 - 86 | 64.73 | Male | high level of education | male | 12.48 | 2.02 | [ 8.53, 16.44] | 6.19 - 168 | 64.73 | Male | high level of education | male | 13.52 | 4.09 | [ 5.49, 21.55] | 3.30 - 4 | 94.34 | Male | high level of education | male | 11.02 | 1.56 | [ 7.95, 14.09] | 7.05 - 86 | 94.34 | Male | high level of education | male | 11.04 | 3.23 | [ 4.70, 17.38] | 3.42 - 168 | 94.34 | Male | high level of education | male | 11.06 | 6.59 | [ -1.88, 24.00] | 1.68 - 4 | 35.12 | Female | high level of education | male | 15.92 | 1.51 | [ 12.96, 18.88] | 10.55 - 86 | 35.12 | Female | high level of education | male | 14.36 | 1.08 | [ 12.23, 16.49] | 13.26 - 168 | 35.12 | Female | high level of education | male | 12.80 | 2.20 | [ 8.48, 17.12] | 5.82 - 4 | 64.73 | Female | high level of education | male | 13.02 | 0.88 | [ 11.29, 14.75] | 14.78 - 86 | 64.73 | Female | high level of education | male | 12.35 | 1.20 | [ 9.98, 14.71] | 10.25 - 168 | 64.73 | Female | high level of education | male | 11.67 | 2.63 | [ 6.50, 16.84] | 4.43 - 4 | 94.34 | Female | high level of education | male | 10.13 | 1.09 | [ 7.99, 12.27] | 9.29 - 86 | 94.34 | Female | high level of education | male | 10.33 | 1.88 | [ 6.65, 14.01] | 5.51 - 168 | 94.34 | Female | high level of education | male | 10.53 | 3.97 | [ 2.73, 18.33] | 2.65 - 4 | 35.12 | Male | low level of education | female | 16.94 | 2.25 | [ 12.52, 21.35] | 7.53 - 86 | 35.12 | Male | low level of education | female | 13.60 | 1.19 | [ 11.26, 15.95] | 11.39 - 168 | 35.12 | Male | low level of education | female | 10.27 | 2.16 | [ 6.03, 14.50] | 4.76 - 4 | 64.73 | Male | low level of education | female | 13.01 | 1.16 | [ 10.73, 15.29] | 11.20 - 86 | 64.73 | Male | low level of education | female | 10.57 | 1.77 | [ 7.10, 14.04] | 5.98 - 168 | 64.73 | Male | low level of education | female | 8.13 | 4.09 | [ 0.10, 16.17] | 1.99 - 4 | 94.34 | Male | low level of education | female | 9.08 | 1.81 | [ 5.52, 12.65] | 5.01 - 86 | 94.34 | Male | low level of education | female | 7.54 | 2.93 | [ 1.80, 13.29] | 2.58 - 168 | 94.34 | Male | low level of education | female | 6.00 | 6.44 | [ -6.64, 18.64] | 0.93 - 4 | 35.12 | Female | low level of education | female | 15.68 | 0.97 | [ 13.78, 17.58] | 16.19 - 86 | 35.12 | Female | low level of education | female | 14.22 | 0.59 | [ 13.06, 15.39] | 23.91 - 168 | 35.12 | Female | low level of education | female | 12.77 | 1.09 | [ 10.63, 14.90] | 11.74 - 4 | 64.73 | Female | low level of education | female | 12.73 | 0.58 | [ 11.60, 13.87] | 21.99 - 86 | 64.73 | Female | low level of education | female | 11.97 | 0.66 | [ 10.67, 13.26] | 18.09 - 168 | 64.73 | Female | low level of education | female | 11.20 | 1.39 | [ 8.48, 13.92] | 8.07 - 4 | 94.34 | Female | low level of education | female | 9.79 | 0.70 | [ 8.40, 11.17] | 13.90 - 86 | 94.34 | Female | low level of education | female | 9.71 | 1.07 | [ 7.60, 11.81] | 9.05 - 168 | 94.34 | Female | low level of education | female | 9.63 | 2.25 | [ 5.21, 14.05] | 4.28 - 4 | 35.12 | Male | intermediate level of education | female | 12.23 | 0.91 | [ 10.45, 14.01] | 13.48 - 86 | 35.12 | Male | intermediate level of education | female | 12.65 | 0.66 | [ 11.35, 13.95] | 19.13 - 168 | 35.12 | Male | intermediate level of education | female | 13.08 | 1.23 | [ 10.67, 15.49] | 10.66 - 4 | 64.73 | Male | intermediate level of education | female | 10.72 | 0.55 | [ 9.64, 11.79] | 19.58 - 86 | 64.73 | Male | intermediate level of education | female | 12.65 | 1.08 | [ 10.53, 14.77] | 11.70 - 168 | 64.73 | Male | intermediate level of education | female | 14.59 | 2.32 | [ 10.03, 19.15] | 6.28 - 4 | 94.34 | Male | intermediate level of education | female | 9.21 | 0.62 | [ 7.99, 10.42] | 14.89 - 86 | 94.34 | Male | intermediate level of education | female | 12.65 | 1.77 | [ 9.18, 16.12] | 7.16 - 168 | 94.34 | Male | intermediate level of education | female | 16.10 | 3.71 | [ 8.81, 23.39] | 4.34 - 4 | 35.12 | Female | intermediate level of education | female | 12.91 | 0.47 | [ 11.99, 13.84] | 27.33 - 86 | 35.12 | Female | intermediate level of education | female | 13.14 | 0.33 | [ 12.49, 13.79] | 39.53 - 168 | 35.12 | Female | intermediate level of education | female | 13.37 | 0.64 | [ 12.12, 14.62] | 20.93 - 4 | 64.73 | Female | intermediate level of education | female | 11.38 | 0.29 | [ 10.83, 11.94] | 39.94 - 86 | 64.73 | Female | intermediate level of education | female | 12.28 | 0.42 | [ 11.45, 13.10] | 29.25 - 168 | 64.73 | Female | intermediate level of education | female | 13.17 | 0.88 | [ 11.43, 14.91] | 14.88 - 4 | 94.34 | Female | intermediate level of education | female | 9.86 | 0.34 | [ 9.18, 10.53] | 28.57 - 86 | 94.34 | Female | intermediate level of education | female | 11.41 | 0.67 | [ 10.10, 12.72] | 17.11 - 168 | 94.34 | Female | intermediate level of education | female | 12.97 | 1.40 | [ 10.22, 15.72] | 9.26 - 4 | 35.12 | Male | high level of education | female | 10.93 | 1.13 | [ 8.72, 13.14] | 9.71 - 86 | 35.12 | Male | high level of education | female | 12.15 | 0.88 | [ 10.42, 13.87] | 13.84 - 168 | 35.12 | Male | high level of education | female | 13.36 | 1.55 | [ 10.32, 16.41] | 8.62 - 4 | 64.73 | Male | high level of education | female | 10.86 | 0.75 | [ 9.40, 12.33] | 14.57 - 86 | 64.73 | Male | high level of education | female | 12.26 | 1.24 | [ 9.82, 14.70] | 9.88 - 168 | 64.73 | Male | high level of education | female | 13.66 | 2.57 | [ 8.62, 18.70] | 5.32 - 4 | 94.34 | Male | high level of education | female | 10.79 | 1.01 | [ 8.80, 12.78] | 10.65 - 86 | 94.34 | Male | high level of education | female | 12.38 | 2.09 | [ 8.28, 16.47] | 5.93 - 168 | 94.34 | Male | high level of education | female | 13.96 | 4.30 | [ 5.51, 22.41] | 3.24 - 4 | 35.12 | Female | high level of education | female | 13.86 | 0.91 | [ 12.06, 15.65] | 15.18 - 86 | 35.12 | Female | high level of education | female | 15.00 | 0.75 | [ 13.52, 16.48] | 19.90 - 168 | 35.12 | Female | high level of education | female | 16.15 | 1.55 | [ 13.11, 19.19] | 10.43 - 4 | 64.73 | Female | high level of education | female | 12.31 | 0.52 | [ 11.29, 13.34] | 23.59 - 86 | 64.73 | Female | high level of education | female | 13.54 | 0.86 | [ 11.84, 15.24] | 15.67 - 168 | 64.73 | Female | high level of education | female | 14.76 | 1.86 | [ 11.10, 18.42] | 7.92 - 4 | 94.34 | Female | high level of education | female | 10.77 | 0.73 | [ 9.34, 12.20] | 14.77 - 86 | 94.34 | Female | high level of education | female | 12.07 | 1.35 | [ 9.42, 14.73] | 8.91 - 168 | 94.34 | Female | high level of education | female | 13.38 | 2.80 | [ 7.87, 18.88] | 4.77 - - Variable predicted: neg_c_7 - Predictors modulated: c12hour, barthtot = [sd], c161sex, c172code, e16sex - -# estimate_means - full labels - - Code - print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst"), - backend = "marginaleffects"), table_width = Inf) - Output - Conditional Predictions - - c161sex | c172code | e16sex | nur_pst | Mean | SE | 95% CI | t(402) - --------------------------------------------------------------------------------------------------------------- - Male | low level of education | male | Care Level 1 | 10.00 | 2.59 | [ 4.90, 15.10] | 3.85 - Female | low level of education | male | Care Level 1 | 13.75 | 1.06 | [ 11.67, 15.83] | 12.98 - Male | intermediate level of education | male | Care Level 1 | 12.00 | 2.12 | [ 7.84, 16.16] | 5.66 - Female | intermediate level of education | male | Care Level 1 | 10.55 | 0.78 | [ 9.01, 12.08] | 13.48 - Male | high level of education | male | Care Level 1 | 14.25 | 1.83 | [ 10.64, 17.86] | 7.77 - Female | high level of education | male | Care Level 1 | 10.00 | 3.67 | [ 2.79, 17.21] | 2.73 - Male | low level of education | female | Care Level 1 | 15.50 | 1.83 | [ 11.89, 19.11] | 8.45 - Female | low level of education | female | Care Level 1 | 11.56 | 0.92 | [ 9.76, 13.37] | 12.60 - Male | intermediate level of education | female | Care Level 1 | 10.16 | 0.84 | [ 8.50, 11.81] | 12.07 - Female | intermediate level of education | female | Care Level 1 | 11.22 | 0.50 | [ 10.24, 12.20] | 22.47 - Male | high level of education | female | Care Level 1 | 11.67 | 1.50 | [ 8.72, 14.61] | 7.79 - Female | high level of education | female | Care Level 1 | 12.44 | 0.86 | [ 10.74, 14.14] | 14.39 - Male | low level of education | male | Care Level 2 | 11.00 | 2.59 | [ 5.90, 16.10] | 4.24 - Female | low level of education | male | Care Level 2 | 12.23 | 1.02 | [ 10.23, 14.23] | 12.02 - Male | intermediate level of education | male | Care Level 2 | 13.25 | 1.30 | [ 10.70, 15.80] | 10.21 - Female | intermediate level of education | male | Care Level 2 | 13.00 | 0.68 | [ 11.66, 14.34] | 19.08 - Male | high level of education | male | Care Level 2 | 10.00 | 3.67 | [ 2.79, 17.21] | 2.73 - Female | high level of education | male | Care Level 2 | 12.78 | 1.22 | [ 10.37, 15.18] | 10.45 - Male | low level of education | female | Care Level 2 | 13.75 | 1.83 | [ 10.14, 17.36] | 7.49 - Female | low level of education | female | Care Level 2 | 11.17 | 1.06 | [ 9.08, 13.25] | 10.54 - Male | intermediate level of education | female | Care Level 2 | 11.17 | 0.86 | [ 9.47, 12.87] | 12.91 - Female | intermediate level of education | female | Care Level 2 | 11.60 | 0.50 | [ 10.61, 12.59] | 23.02 - Male | high level of education | female | Care Level 2 | 11.20 | 1.16 | [ 8.92, 13.48] | 9.65 - Female | high level of education | female | Care Level 2 | 14.56 | 0.92 | [ 12.76, 16.37] | 15.87 - Male | low level of education | male | Care Level 3/3+ | -13.53 | 7.92 | [-29.10, 2.04] | -1.71 - Female | low level of education | male | Care Level 3/3+ | 12.09 | 1.11 | [ 9.92, 14.27] | 10.93 - Male | intermediate level of education | male | Care Level 3/3+ | 13.57 | 1.39 | [ 10.85, 16.30] | 9.79 - Female | intermediate level of education | male | Care Level 3/3+ | 16.50 | 0.78 | [ 14.96, 18.04] | 21.09 - Male | high level of education | male | Care Level 3/3+ | 8.00 | 3.67 | [ 0.79, 15.21] | 2.18 - Female | high level of education | male | Care Level 3/3+ | 16.33 | 2.12 | [ 12.17, 20.50] | 7.71 - Male | low level of education | female | Care Level 3/3+ | 12.00 | 2.12 | [ 7.84, 16.16] | 5.66 - Female | low level of education | female | Care Level 3/3+ | 15.00 | 1.39 | [ 12.27, 17.73] | 10.82 - Male | intermediate level of education | female | Care Level 3/3+ | 11.54 | 1.02 | [ 9.54, 13.54] | 11.34 - Female | intermediate level of education | female | Care Level 3/3+ | 13.35 | 0.77 | [ 11.84, 14.85] | 17.45 - Male | high level of education | female | Care Level 3/3+ | 13.00 | 1.83 | [ 9.39, 16.61] | 7.09 - Female | high level of education | female | Care Level 3/3+ | 11.43 | 1.39 | [ 8.70, 14.15] | 8.24 - - Variable predicted: neg_c_7 - Predictors modulated: c161sex, c172code, e16sex, nur_pst - ---- - - Code - print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst"), - backend = "marginaleffects"), full_labels = FALSE, table_width = Inf) - Output - Conditional Predictions - - c161sex | c172code | e16sex | nur_pst | Mean | SE | 95% CI | t(402) - --------------------------------------------------------------------------------------------------------------- - Male | low level of education | male | Care Level 1 | 10.00 | 2.59 | [ 4.90, 15.10] | 3.85 - Female | | | | 13.75 | 1.06 | [ 11.67, 15.83] | 12.98 - Male | intermediate level of education | | | 12.00 | 2.12 | [ 7.84, 16.16] | 5.66 - Female | | | | 10.55 | 0.78 | [ 9.01, 12.08] | 13.48 - Male | high level of education | | | 14.25 | 1.83 | [ 10.64, 17.86] | 7.77 - Female | | | | 10.00 | 3.67 | [ 2.79, 17.21] | 2.73 - Male | low level of education | female | | 15.50 | 1.83 | [ 11.89, 19.11] | 8.45 - Female | | | | 11.56 | 0.92 | [ 9.76, 13.37] | 12.60 - Male | intermediate level of education | | | 10.16 | 0.84 | [ 8.50, 11.81] | 12.07 - Female | | | | 11.22 | 0.50 | [ 10.24, 12.20] | 22.47 - Male | high level of education | | | 11.67 | 1.50 | [ 8.72, 14.61] | 7.79 - Female | | | | 12.44 | 0.86 | [ 10.74, 14.14] | 14.39 - Male | low level of education | male | Care Level 2 | 11.00 | 2.59 | [ 5.90, 16.10] | 4.24 - Female | | | | 12.23 | 1.02 | [ 10.23, 14.23] | 12.02 - Male | intermediate level of education | | | 13.25 | 1.30 | [ 10.70, 15.80] | 10.21 - Female | | | | 13.00 | 0.68 | [ 11.66, 14.34] | 19.08 - Male | high level of education | | | 10.00 | 3.67 | [ 2.79, 17.21] | 2.73 - Female | | | | 12.78 | 1.22 | [ 10.37, 15.18] | 10.45 - Male | low level of education | female | | 13.75 | 1.83 | [ 10.14, 17.36] | 7.49 - Female | | | | 11.17 | 1.06 | [ 9.08, 13.25] | 10.54 - Male | intermediate level of education | | | 11.17 | 0.86 | [ 9.47, 12.87] | 12.91 - Female | | | | 11.60 | 0.50 | [ 10.61, 12.59] | 23.02 - Male | high level of education | | | 11.20 | 1.16 | [ 8.92, 13.48] | 9.65 - Female | | | | 14.56 | 0.92 | [ 12.76, 16.37] | 15.87 - Male | low level of education | male | Care Level 3/3+ | -13.53 | 7.92 | [-29.10, 2.04] | -1.71 - Female | | | | 12.09 | 1.11 | [ 9.92, 14.27] | 10.93 - Male | intermediate level of education | | | 13.57 | 1.39 | [ 10.85, 16.30] | 9.79 - Female | | | | 16.50 | 0.78 | [ 14.96, 18.04] | 21.09 - Male | high level of education | | | 8.00 | 3.67 | [ 0.79, 15.21] | 2.18 - Female | | | | 16.33 | 2.12 | [ 12.17, 20.50] | 7.71 - Male | low level of education | female | | 12.00 | 2.12 | [ 7.84, 16.16] | 5.66 - Female | | | | 15.00 | 1.39 | [ 12.27, 17.73] | 10.82 - Male | intermediate level of education | | | 11.54 | 1.02 | [ 9.54, 13.54] | 11.34 - Female | | | | 13.35 | 0.77 | [ 11.84, 14.85] | 17.45 - Male | high level of education | | | 13.00 | 1.83 | [ 9.39, 16.61] | 7.09 - Female | | | | 11.43 | 1.39 | [ 8.70, 14.15] | 8.24 - - Variable predicted: neg_c_7 - Predictors modulated: c161sex, c172code, e16sex, nur_pst - ---- - - Code - print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst", - "negc7d"), backend = "marginaleffects"), table_width = Inf) - Output - Conditional Predictions - - c161sex | c172code | e16sex | nur_pst | negc7d | Mean | SE | 95% CI | t(370) - ----------------------------------------------------------------------------------------------------------------------- - Male | low level of education | male | Care Level 1 | 0 | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 - Female | low level of education | male | Care Level 1 | 0 | 10.00 | 1.02 | [ 7.99, 12.01] | 9.80 - Male | intermediate level of education | male | Care Level 1 | 0 | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 - Female | intermediate level of education | male | Care Level 1 | 0 | 9.13 | 0.59 | [ 7.97, 10.29] | 15.50 - Male | high level of education | male | Care Level 1 | 0 | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 - Female | high level of education | male | Care Level 1 | 0 | 10.00 | 2.28 | [ 5.51, 14.49] | 4.38 - Male | low level of education | female | Care Level 1 | 0 | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 - Female | low level of education | female | Care Level 1 | 0 | 8.89 | 0.76 | [ 7.39, 10.38] | 11.69 - Male | intermediate level of education | female | Care Level 1 | 0 | 9.21 | 0.61 | [ 8.02, 10.41] | 15.11 - Female | intermediate level of education | female | Care Level 1 | 0 | 9.47 | 0.40 | [ 8.68, 10.26] | 23.48 - Male | high level of education | female | Care Level 1 | 0 | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 - Female | high level of education | female | Care Level 1 | 0 | 8.71 | 0.86 | [ 7.02, 10.41] | 10.11 - Male | low level of education | male | Care Level 2 | 0 | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 - Female | low level of education | male | Care Level 2 | 0 | 9.50 | 0.93 | [ 7.67, 11.33] | 10.20 - Male | intermediate level of education | male | Care Level 2 | 0 | 8.75 | 1.14 | [ 6.51, 10.99] | 7.67 - Female | intermediate level of education | male | Care Level 2 | 0 | 9.30 | 0.72 | [ 7.88, 10.72] | 12.89 - Male | high level of education | male | Care Level 2 | 0 | 10.00 | 2.28 | [ 5.51, 14.49] | 4.38 - Female | high level of education | male | Care Level 2 | 0 | 9.00 | 1.14 | [ 6.76, 11.24] | 7.89 - Male | low level of education | female | Care Level 2 | 0 | 10.50 | 1.61 | [ 7.33, 13.67] | 6.51 - Female | low level of education | female | Care Level 2 | 0 | 9.17 | 0.93 | [ 7.34, 11.00] | 9.84 - Male | intermediate level of education | female | Care Level 2 | 0 | 8.50 | 0.66 | [ 7.20, 9.80] | 12.91 - Female | intermediate level of education | female | Care Level 2 | 0 | 9.30 | 0.42 | [ 8.48, 10.12] | 22.33 - Male | high level of education | female | Care Level 2 | 0 | 9.43 | 0.86 | [ 7.73, 11.12] | 10.93 - Female | high level of education | female | Care Level 2 | 0 | 8.00 | 1.61 | [ 4.83, 11.17] | 4.96 - Male | low level of education | male | Care Level 3/3+ | 0 | 3.67 | 6.95 | [-10.00, 17.35] | 0.53 - Female | low level of education | male | Care Level 3/3+ | 0 | 9.67 | 1.32 | [ 7.08, 12.26] | 7.34 - Male | intermediate level of education | male | Care Level 3/3+ | 0 | 9.75 | 1.14 | [ 7.51, 11.99] | 8.55 - Female | intermediate level of education | male | Care Level 3/3+ | 0 | 9.50 | 1.14 | [ 7.26, 11.74] | 8.33 - Male | high level of education | male | Care Level 3/3+ | 0 | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 - Female | high level of education | male | Care Level 3/3+ | 0 | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 - Male | low level of education | female | Care Level 3/3+ | 0 | 8.50 | 1.61 | [ 5.33, 11.67] | 5.27 - Female | low level of education | female | Care Level 3/3+ | 0 | 8.67 | 1.32 | [ 6.08, 11.26] | 6.58 - Male | intermediate level of education | female | Care Level 3/3+ | 0 | 9.13 | 0.81 | [ 7.54, 10.71] | 11.31 - Female | intermediate level of education | female | Care Level 3/3+ | 0 | 9.78 | 0.76 | [ 8.28, 11.27] | 12.86 - Male | high level of education | female | Care Level 3/3+ | 0 | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 - Female | high level of education | female | Care Level 3/3+ | 0 | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 - Male | low level of education | male | Care Level 1 | 1 | 12.00 | 2.28 | [ 7.51, 16.49] | 5.26 - Female | low level of education | male | Care Level 1 | 1 | 16.43 | 0.86 | [ 14.73, 18.12] | 19.05 - Male | intermediate level of education | male | Care Level 1 | 1 | 14.00 | 1.61 | [ 10.83, 17.17] | 8.68 - Female | intermediate level of education | male | Care Level 1 | 1 | 13.57 | 0.86 | [ 11.88, 15.27] | 15.74 - Male | high level of education | male | Care Level 1 | 1 | 16.00 | 1.32 | [ 13.41, 18.59] | 12.15 - Female | high level of education | male | Care Level 1 | 1 | 27.92 | 5.08 | [ 17.93, 37.91] | 5.50 - Male | low level of education | female | Care Level 1 | 1 | 17.00 | 1.32 | [ 14.41, 19.59] | 12.91 - Female | low level of education | female | Care Level 1 | 1 | 15.00 | 0.86 | [ 13.30, 16.70] | 17.40 - Male | intermediate level of education | female | Care Level 1 | 1 | 12.80 | 1.02 | [ 10.79, 14.81] | 12.55 - Female | intermediate level of education | female | Care Level 1 | 1 | 13.77 | 0.49 | [ 12.82, 14.73] | 28.32 - Male | high level of education | female | Care Level 1 | 1 | 14.33 | 1.32 | [ 11.74, 16.92] | 10.88 - Female | high level of education | female | Care Level 1 | 1 | 14.82 | 0.69 | [ 13.47, 16.17] | 21.54 - Male | low level of education | male | Care Level 2 | 1 | 13.00 | 2.28 | [ 8.51, 17.49] | 5.70 - Female | low level of education | male | Care Level 2 | 1 | 14.57 | 0.86 | [ 12.88, 16.27] | 16.90 - Male | intermediate level of education | male | Care Level 2 | 1 | 17.75 | 1.14 | [ 15.51, 19.99] | 15.56 - Female | intermediate level of education | male | Care Level 2 | 1 | 14.95 | 0.52 | [ 13.92, 15.98] | 28.56 - Male | high level of education | male | Care Level 2 | 1 | 3.80 | 8.72 | [-13.34, 20.94] | 0.44 - Female | high level of education | male | Care Level 2 | 1 | 15.80 | 1.02 | [ 13.79, 17.81] | 15.49 - Male | low level of education | female | Care Level 2 | 1 | 17.00 | 1.61 | [ 13.83, 20.17] | 10.54 - Female | low level of education | female | Care Level 2 | 1 | 13.17 | 0.93 | [ 11.34, 15.00] | 14.14 - Male | intermediate level of education | female | Care Level 2 | 1 | 16.50 | 0.93 | [ 14.67, 18.33] | 17.72 - Female | intermediate level of education | female | Care Level 2 | 1 | 14.61 | 0.48 | [ 13.67, 15.54] | 30.71 - Male | high level of education | female | Care Level 2 | 1 | 15.33 | 1.32 | [ 12.74, 17.92] | 11.64 - Female | high level of education | female | Care Level 2 | 1 | 15.50 | 0.61 | [ 14.30, 16.70] | 25.42 - Male | low level of education | male | Care Level 3/3+ | 1 | 1.78 | 7.99 | [-13.93, 17.48] | 0.22 - Female | low level of education | male | Care Level 3/3+ | 1 | 13.00 | 0.81 | [ 11.41, 14.59] | 16.12 - Male | intermediate level of education | male | Care Level 3/3+ | 1 | 18.67 | 1.32 | [ 16.08, 21.26] | 14.17 - Female | intermediate level of education | male | Care Level 3/3+ | 1 | 18.06 | 0.54 | [ 17.00, 19.11] | 33.58 - Male | high level of education | male | Care Level 3/3+ | 1 | 4.60 | 7.00 | [ -9.17, 18.38] | 0.66 - Female | high level of education | male | Care Level 3/3+ | 1 | 19.00 | 1.61 | [ 15.83, 22.17] | 11.78 - Male | low level of education | female | Care Level 3/3+ | 1 | 19.00 | 2.28 | [ 14.51, 23.49] | 8.33 - Female | low level of education | female | Care Level 3/3+ | 1 | 19.75 | 1.14 | [ 17.51, 21.99] | 17.31 - Male | intermediate level of education | female | Care Level 3/3+ | 1 | 15.40 | 1.02 | [ 13.39, 17.41] | 15.09 - Female | intermediate level of education | female | Care Level 3/3+ | 1 | 15.64 | 0.61 | [ 14.44, 16.84] | 25.65 - Male | high level of education | female | Care Level 3/3+ | 1 | 14.33 | 1.32 | [ 11.74, 16.92] | 10.88 - Female | high level of education | female | Care Level 3/3+ | 1 | 13.25 | 1.14 | [ 11.01, 15.49] | 11.62 - - Variable predicted: neg_c_7 - Predictors modulated: c161sex, c172code, e16sex, nur_pst, negc7d - ---- - - Code - print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst", - "negc7d"), backend = "marginaleffects"), full_labels = FALSE, table_width = Inf) - Output - Conditional Predictions - - c161sex | c172code | e16sex | nur_pst | negc7d | Mean | SE | 95% CI | t(370) - ----------------------------------------------------------------------------------------------------------------------- - Male | low level of education | male | Care Level 1 | 0 | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 - Female | | | | | 10.00 | 1.02 | [ 7.99, 12.01] | 9.80 - Male | intermediate level of education | | | | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 - Female | | | | | 9.13 | 0.59 | [ 7.97, 10.29] | 15.50 - Male | high level of education | | | | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 - Female | | | | | 10.00 | 2.28 | [ 5.51, 14.49] | 4.38 - Male | low level of education | female | | | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 - Female | | | | | 8.89 | 0.76 | [ 7.39, 10.38] | 11.69 - Male | intermediate level of education | | | | 9.21 | 0.61 | [ 8.02, 10.41] | 15.11 - Female | | | | | 9.47 | 0.40 | [ 8.68, 10.26] | 23.48 - Male | high level of education | | | | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 - Female | | | | | 8.71 | 0.86 | [ 7.02, 10.41] | 10.11 - Male | low level of education | male | Care Level 2 | | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 - Female | | | | | 9.50 | 0.93 | [ 7.67, 11.33] | 10.20 - Male | intermediate level of education | | | | 8.75 | 1.14 | [ 6.51, 10.99] | 7.67 - Female | | | | | 9.30 | 0.72 | [ 7.88, 10.72] | 12.89 - Male | high level of education | | | | 10.00 | 2.28 | [ 5.51, 14.49] | 4.38 - Female | | | | | 9.00 | 1.14 | [ 6.76, 11.24] | 7.89 - Male | low level of education | female | | | 10.50 | 1.61 | [ 7.33, 13.67] | 6.51 - Female | | | | | 9.17 | 0.93 | [ 7.34, 11.00] | 9.84 - Male | intermediate level of education | | | | 8.50 | 0.66 | [ 7.20, 9.80] | 12.91 - Female | | | | | 9.30 | 0.42 | [ 8.48, 10.12] | 22.33 - Male | high level of education | | | | 9.43 | 0.86 | [ 7.73, 11.12] | 10.93 - Female | | | | | 8.00 | 1.61 | [ 4.83, 11.17] | 4.96 - Male | low level of education | male | Care Level 3/3+ | | 3.67 | 6.95 | [-10.00, 17.35] | 0.53 - Female | | | | | 9.67 | 1.32 | [ 7.08, 12.26] | 7.34 - Male | intermediate level of education | | | | 9.75 | 1.14 | [ 7.51, 11.99] | 8.55 - Female | | | | | 9.50 | 1.14 | [ 7.26, 11.74] | 8.33 - Male | high level of education | | | | 8.00 | 2.28 | [ 3.51, 12.49] | 3.51 - Female | | | | | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 - Male | low level of education | female | | | 8.50 | 1.61 | [ 5.33, 11.67] | 5.27 - Female | | | | | 8.67 | 1.32 | [ 6.08, 11.26] | 6.58 - Male | intermediate level of education | | | | 9.13 | 0.81 | [ 7.54, 10.71] | 11.31 - Female | | | | | 9.78 | 0.76 | [ 8.28, 11.27] | 12.86 - Male | high level of education | | | | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 - Female | | | | | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 - Male | low level of education | male | Care Level 1 | 1 | 12.00 | 2.28 | [ 7.51, 16.49] | 5.26 - Female | | | | | 16.43 | 0.86 | [ 14.73, 18.12] | 19.05 - Male | intermediate level of education | | | | 14.00 | 1.61 | [ 10.83, 17.17] | 8.68 - Female | | | | | 13.57 | 0.86 | [ 11.88, 15.27] | 15.74 - Male | high level of education | | | | 16.00 | 1.32 | [ 13.41, 18.59] | 12.15 - Female | | | | | 27.92 | 5.08 | [ 17.93, 37.91] | 5.50 - Male | low level of education | female | | | 17.00 | 1.32 | [ 14.41, 19.59] | 12.91 - Female | | | | | 15.00 | 0.86 | [ 13.30, 16.70] | 17.40 - Male | intermediate level of education | | | | 12.80 | 1.02 | [ 10.79, 14.81] | 12.55 - Female | | | | | 13.77 | 0.49 | [ 12.82, 14.73] | 28.32 - Male | high level of education | | | | 14.33 | 1.32 | [ 11.74, 16.92] | 10.88 - Female | | | | | 14.82 | 0.69 | [ 13.47, 16.17] | 21.54 - Male | low level of education | male | Care Level 2 | | 13.00 | 2.28 | [ 8.51, 17.49] | 5.70 - Female | | | | | 14.57 | 0.86 | [ 12.88, 16.27] | 16.90 - Male | intermediate level of education | | | | 17.75 | 1.14 | [ 15.51, 19.99] | 15.56 - Female | | | | | 14.95 | 0.52 | [ 13.92, 15.98] | 28.56 - Male | high level of education | | | | 3.80 | 8.72 | [-13.34, 20.94] | 0.44 - Female | | | | | 15.80 | 1.02 | [ 13.79, 17.81] | 15.49 - Male | low level of education | female | | | 17.00 | 1.61 | [ 13.83, 20.17] | 10.54 - Female | | | | | 13.17 | 0.93 | [ 11.34, 15.00] | 14.14 - Male | intermediate level of education | | | | 16.50 | 0.93 | [ 14.67, 18.33] | 17.72 - Female | | | | | 14.61 | 0.48 | [ 13.67, 15.54] | 30.71 - Male | high level of education | | | | 15.33 | 1.32 | [ 12.74, 17.92] | 11.64 - Female | | | | | 15.50 | 0.61 | [ 14.30, 16.70] | 25.42 - Male | low level of education | male | Care Level 3/3+ | | 1.78 | 7.99 | [-13.93, 17.48] | 0.22 - Female | | | | | 13.00 | 0.81 | [ 11.41, 14.59] | 16.12 - Male | intermediate level of education | | | | 18.67 | 1.32 | [ 16.08, 21.26] | 14.17 - Female | | | | | 18.06 | 0.54 | [ 17.00, 19.11] | 33.58 - Male | high level of education | | | | 4.60 | 7.00 | [ -9.17, 18.38] | 0.66 - Female | | | | | 19.00 | 1.61 | [ 15.83, 22.17] | 11.78 - Male | low level of education | female | | | 19.00 | 2.28 | [ 14.51, 23.49] | 8.33 - Female | | | | | 19.75 | 1.14 | [ 17.51, 21.99] | 17.31 - Male | intermediate level of education | | | | 15.40 | 1.02 | [ 13.39, 17.41] | 15.09 - Female | | | | | 15.64 | 0.61 | [ 14.44, 16.84] | 25.65 - Male | high level of education | | | | 14.33 | 1.32 | [ 11.74, 16.92] | 10.88 - Female | | | | | 13.25 | 1.14 | [ 11.01, 15.49] | 11.62 - - Variable predicted: neg_c_7 - Predictors modulated: c161sex, c172code, e16sex, nur_pst, negc7d - -# estimate_means - protect integers - - Code - estimate_expectation(model, by = c("c160age=[fivenum]", "c161sex")) - Output - Conditional Predictions - - c160age | c161sex | Predicted | SE | 95% CI - ----------------------------------------------------- - 44 | Male | 11.80 | 0.33 | [11.15, 12.45] - 54 | Male | 11.65 | 0.31 | [11.04, 12.26] - 63 | Male | 11.51 | 0.36 | [10.81, 12.21] - 89 | Male | 11.11 | 0.66 | [ 9.81, 12.41] - 18 | Female | 11.42 | 0.50 | [10.44, 12.40] - 44 | Female | 11.92 | 0.26 | [11.41, 12.44] - 54 | Female | 12.12 | 0.22 | [11.69, 12.55] - 63 | Female | 12.29 | 0.23 | [11.84, 12.74] - - Variable predicted: neg_c_7 - Predictors modulated: c160age=[fivenum], c161sex - Predictors controlled: barthtot (65), e16sex (male) - ---- - - Code - estimate_means(model, by = c("c160age=[fivenum]", "c161sex"), backend = "marginaleffects") - Output - Conditional Predictions - - c160age | c161sex | Mean | SE | 95% CI | t(865) - ---------------------------------------------------------- - 18 | Male | 12.08 | 0.60 | [10.91, 13.26] | 20.22 - 44 | Male | 11.68 | 0.29 | [11.12, 12.24] | 40.98 - 54 | Male | 11.53 | 0.25 | [11.03, 12.02] | 45.75 - 63 | Male | 11.39 | 0.30 | [10.80, 11.97] | 38.07 - 89 | Male | 10.99 | 0.62 | [ 9.76, 12.21] | 17.64 - 18 | Female | 11.30 | 0.44 | [10.44, 12.17] | 25.63 - 44 | Female | 11.80 | 0.18 | [11.44, 12.17] | 63.99 - 54 | Female | 12.00 | 0.14 | [11.72, 12.28] | 84.30 - 63 | Female | 12.17 | 0.18 | [11.83, 12.52] | 69.56 - 89 | Female | 12.68 | 0.43 | [11.84, 13.51] | 29.74 - - Variable predicted: neg_c_7 - Predictors modulated: c160age=[fivenum], c161sex - Predictors averaged: barthtot (65), e16sex - From 3795c8e8afa8bc37a761f5b86c4f8e4d6a5242db Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:29:18 +0100 Subject: [PATCH 14/56] snaps --- .../windows/estimate_contrasts_counterfactual.md | 3 +-- .../windows/estimate_means_counterfactuals.md | 15 ++++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md index e8c7718b7..73c64943d 100644 --- a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md +++ b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md @@ -3,7 +3,7 @@ Code print(out, table_width = Inf) Output - Counterfactual Contrasts Analysis (G-computation) + Marginal Contrasts (G-computation) Level1 | Level2 | treatment | Difference | SE | 95% CI | z | p --------------------------------------------------------------------------------- @@ -16,6 +16,5 @@ Variable predicted: QoL Predictors contrasted: time - Predictors averaged: education, hospital (0.95), age (0.22), phq4 (-0.076), ID p-values are uncorrected. diff --git a/tests/testthat/_snaps/windows/estimate_means_counterfactuals.md b/tests/testthat/_snaps/windows/estimate_means_counterfactuals.md index aad797d26..14e1ca9bf 100644 --- a/tests/testthat/_snaps/windows/estimate_means_counterfactuals.md +++ b/tests/testthat/_snaps/windows/estimate_means_counterfactuals.md @@ -4,7 +4,7 @@ print(estimate_means(m, "spp", backend = "marginaleffects"), zap_small = TRUE, table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions spp | Mean | SE | 95% CI | z ----------------------------------------- @@ -27,7 +27,7 @@ print(estimate_means(m, "spp", backend = "marginaleffects", estimate = "population"), zap_small = TRUE, table_width = Inf) Output - Average Counterfactual Predictions + Marginal Predictions (G-computation) spp | Mean | SE | 95% CI | z ----------------------------------------- @@ -41,7 +41,6 @@ Variable predicted: count Predictors modulated: spp - Predictors averaged: mined, site Predictions are on the response-scale. --- @@ -50,7 +49,7 @@ print(estimate_means(m, "spp", backend = "marginaleffects", predict = "inverse_link"), zap_small = TRUE, table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions spp | Mean | SE | 95% CI | z ------------------------------------------ @@ -73,7 +72,7 @@ print(estimate_means(m, "spp", backend = "marginaleffects", estimate = "population", predict = "inverse_link"), zap_small = TRUE, table_width = Inf) Output - Average Counterfactual Predictions + Marginal Predictions (G-computation) spp | Mean | SE | 95% CI | z ------------------------------------------ @@ -87,7 +86,6 @@ Variable predicted: count Predictors modulated: spp - Predictors averaged: mined, site Predictions are on the response-scale. --- @@ -96,7 +94,7 @@ print(estimate_means(m, "Days", backend = "marginaleffects"), zap_small = TRUE, table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions Days | Mean | SE | 95% CI | t(174) ------------------------------------------------- @@ -121,7 +119,7 @@ print(estimate_means(m, "Days", backend = "marginaleffects", estimate = "population"), zap_small = TRUE, table_width = Inf) Output - Average Counterfactual Predictions + Marginal Predictions (G-computation) Days | Mean | SE | 95% CI | t(174) ------------------------------------------------- @@ -138,5 +136,4 @@ Variable predicted: Reaction Predictors modulated: Days - Predictors averaged: Subject From 0f79c115d69cd0fb521535b26a05000b52100b36 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:34:02 +0100 Subject: [PATCH 15/56] update test --- tests/testthat/_snaps/windows/ordinal.md | 12 ++++++------ tests/testthat/_snaps/windows/print.md | 16 ++++++++-------- .../test-estimate_contrasts_inequality.R | 2 +- tests/testthat/test-estimate_means_mixed.R | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/testthat/_snaps/windows/ordinal.md b/tests/testthat/_snaps/windows/ordinal.md index 2a48efebd..52a6b203e 100644 --- a/tests/testthat/_snaps/windows/ordinal.md +++ b/tests/testthat/_snaps/windows/ordinal.md @@ -3,7 +3,7 @@ Code print(out, zap_small = TRUE) Output - Model-based Predictions + Conditional Predictions Row | Response | Sepal.Width | Predicted | SE | 95% CI ---------------------------------------------------------------- @@ -47,7 +47,7 @@ Code print(out, zap_small = TRUE) Output - Estimated Marginal Means + Conditional Predictions Sepal.Width | Response | Median | 95% CI | pd | ROPE | % in ROPE ----------------------------------------------------------------------------------- @@ -91,7 +91,7 @@ Code print(out, zap_small = TRUE) Output - Model-based Predictions + Conditional Predictions Row | Response | Sepal.Width | Predicted | 95% CI --------------------------------------------------------- @@ -135,7 +135,7 @@ Code print(out, zap_small = TRUE) Output - Estimated Marginal Means + Conditional Predictions Sepal.Width | Response | Probability | SE | 95% CI | t(147) ---------------------------------------------------------------------- @@ -179,7 +179,7 @@ Code print(out, zap_small = TRUE) Output - Estimated Marginal Means + Conditional Predictions island | Response | Probability | SE | 95% CI | z ------------------------------------------------------------------ @@ -203,7 +203,7 @@ Code print(out, zap_small = TRUE) Output - Estimated Marginal Means + Conditional Predictions island | Response | Probability | SE | 95% CI | t(325) -------------------------------------------------------------------- diff --git a/tests/testthat/_snaps/windows/print.md b/tests/testthat/_snaps/windows/print.md index 3a9ca085f..9c7990db5 100644 --- a/tests/testthat/_snaps/windows/print.md +++ b/tests/testthat/_snaps/windows/print.md @@ -109,7 +109,7 @@ print(estimate_means(fit, c("c12hour", "c172code", "c161sex"), length = 4, backend = "marginaleffects"), table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions c12hour | c172code | c161sex | Mean | SE | 95% CI | t(791) -------------------------------------------------------------------------------------------- @@ -148,7 +148,7 @@ print(estimate_means(fit, c("c12hour", "barthtot = [sd]", "c161sex", "c172code", "e16sex"), backend = "marginaleffects", length = 3), table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions c12hour | barthtot | c161sex | c172code | e16sex | Mean | SE | 95% CI | t(766) ------------------------------------------------------------------------------------------------------------------- @@ -270,7 +270,7 @@ print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst"), backend = "marginaleffects"), table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions c161sex | c172code | e16sex | nur_pst | Mean | SE | 95% CI | t(402) --------------------------------------------------------------------------------------------------------------- @@ -320,7 +320,7 @@ print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst"), backend = "marginaleffects"), full_labels = FALSE, table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions c161sex | c172code | e16sex | nur_pst | Mean | SE | 95% CI | t(402) --------------------------------------------------------------------------------------------------------------- @@ -370,7 +370,7 @@ print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst", "negc7d"), backend = "marginaleffects"), table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions c161sex | c172code | e16sex | nur_pst | negc7d | Mean | SE | 95% CI | t(370) ----------------------------------------------------------------------------------------------------------------------- @@ -456,7 +456,7 @@ print(estimate_means(fit, c("c161sex", "c172code", "e16sex", "nur_pst", "negc7d"), backend = "marginaleffects"), full_labels = FALSE, table_width = Inf) Output - Estimated Marginal Means + Conditional Predictions c161sex | c172code | e16sex | nur_pst | negc7d | Mean | SE | 95% CI | t(370) ----------------------------------------------------------------------------------------------------------------------- @@ -541,7 +541,7 @@ Code estimate_expectation(model, by = c("c160age=[fivenum]", "c161sex")) Output - Model-based Predictions + Conditional Predictions c160age | c161sex | Predicted | SE | 95% CI ----------------------------------------------------- @@ -563,7 +563,7 @@ Code estimate_means(model, by = c("c160age=[fivenum]", "c161sex"), backend = "marginaleffects") Output - Estimated Marginal Means + Conditional Predictions c160age | c161sex | Mean | SE | 95% CI | t(865) ---------------------------------------------------------- diff --git a/tests/testthat/test-estimate_contrasts_inequality.R b/tests/testthat/test-estimate_contrasts_inequality.R index c7e51df78..a82b55036 100644 --- a/tests/testthat/test-estimate_contrasts_inequality.R +++ b/tests/testthat/test-estimate_contrasts_inequality.R @@ -18,7 +18,7 @@ test_that("estimate_contrast, marginal effects inequalities", { # inequality works with "average" estimate out <- estimate_contrasts(m, "species", comparison = "inequality", estimate = "average") expect_equal(out$Mean_Difference, 0.6380998, tolerance = 1e-4) - expect_identical(attributes(out)$table_title, c("Averaged Inequality Analysis", "blue")) + expect_identical(attributes(out)$table_title, c("Marginal Inequality Analysis", "blue")) # inequality works without default estimate out <- estimate_contrasts(m, "species", comparison = "inequality") diff --git a/tests/testthat/test-estimate_means_mixed.R b/tests/testthat/test-estimate_means_mixed.R index c97b85c68..a57995ee9 100644 --- a/tests/testthat/test-estimate_means_mixed.R +++ b/tests/testthat/test-estimate_means_mixed.R @@ -105,7 +105,7 @@ test_that("estimate_means() - mixed models", { estim3 <- estimate_means(gm1, backend = "marginaleffects", verbose = FALSE) expect_identical(dim(estim3), c(4L, 6L)) expect_equal(estim3$Probability, c(0.21521, 0.0954, 0.08453, 0.05599), tolerance = 1e-3) - expect_equal(estim3$CI_low, c(0.14233, 0.04475, 0.03608, 0.01266), tolerance = 1e-3) + expect_equal(estim3$CI_low, c(0.14194, 0.04428, 0.03559, 0.01215), tolerance = 1e-3) }) From 0d366f9e0ef5d7536a584b759e9540ee2815b418 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:36:24 +0100 Subject: [PATCH 16/56] snap --- .../plot-ordinal/plot-ordinal-bracl.svg | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.svg b/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.svg index 6553f8ae2..48b824030 100644 --- a/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.svg +++ b/tests/testthat/_snaps/plot-ordinal/plot-ordinal-bracl.svg @@ -27,17 +27,17 @@ - - - - - - - + + + + + + + - - + + @@ -48,13 +48,13 @@ 10% 20% -30% +30% 40% 50% - + - + From 5ad9ce44c499df16f09c14cf7769480be2f1158c Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:38:00 +0100 Subject: [PATCH 17/56] fix test --- tests/testthat/test-estimate_contrasts_counterfactual.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-estimate_contrasts_counterfactual.R b/tests/testthat/test-estimate_contrasts_counterfactual.R index bc4794fbe..0837624fd 100644 --- a/tests/testthat/test-estimate_contrasts_counterfactual.R +++ b/tests/testthat/test-estimate_contrasts_counterfactual.R @@ -167,7 +167,7 @@ test_that("estimate_contrast, counterfactual, custom hypothesis", { expect_equal(out$Difference, -4.591834, tolerance = 1e-3) expect_identical( attributes(out)$table_footer[1], - "\nVariable predicted: QoL\nPredictors contrasted: treatment\nPredictors averaged: education, hospital (0.95), age (0.22), phq4 (-0.076), ID\np-values are uncorrected.\nParameters:\nb3 = treatment [0], time [2]\nb1 = treatment [0], time [1]\nb4 = treatment [1], time [2]\nb2 = treatment [1], time [1]\n" + "\nVariable predicted: QoL\nPredictors contrasted: treatment\np-values are uncorrected.\nParameters:\nb3 = treatment [0], time [2]\nb1 = treatment [0], time [1]\nb4 = treatment [1], time [2]\nb2 = treatment [1], time [1]\n" ) }) From fd67cc898cf7a9782e31e038d73940c6662d3e09 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:42:09 +0100 Subject: [PATCH 18/56] fix test --- tests/testthat/test-estimate_contrasts_inequality.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-estimate_contrasts_inequality.R b/tests/testthat/test-estimate_contrasts_inequality.R index a82b55036..4befb983f 100644 --- a/tests/testthat/test-estimate_contrasts_inequality.R +++ b/tests/testthat/test-estimate_contrasts_inequality.R @@ -23,7 +23,10 @@ test_that("estimate_contrast, marginal effects inequalities", { # inequality works without default estimate out <- estimate_contrasts(m, "species", comparison = "inequality") expect_equal(out$Mean_Difference, 0.5580707, tolerance = 1e-4) - expect_identical(attributes(out)$table_title, c("Marginal Inequality Analysis", "blue")) + expect_identical( + attributes(out)$table_title, + c("Conditional Inequality Analysis", "blue") + ) # pairwise inequality requires `by` expect_error( From 5bd487c49b9b5e673ee1f8c15eb71ea337e22be2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 10:47:55 +0100 Subject: [PATCH 19/56] add test --- tests/testthat/test-joint_test.R | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-joint_test.R b/tests/testthat/test-joint_test.R index 21f4f3b1f..71effce36 100644 --- a/tests/testthat/test-joint_test.R +++ b/tests/testthat/test-joint_test.R @@ -42,7 +42,7 @@ test_that("estimate_contrasts - joint test, 2-way", { expect_identical( capture.output(out), c( - "Marginal Omnibus Test", + "Conditional Omnibus Test", "", "df1 | df2 | F | p", "------------------------", @@ -54,6 +54,30 @@ test_that("estimate_contrasts - joint test, 2-way", { ) ) + # omnibus test, marginal + out <- estimate_contrasts( + m, + contrast = "time", + comparison = "omnibus", + estimate = "average" + ) + expect_equal(out$`F`, 2.352941, tolerance = 1e-3) + expect_equal(out$p, 0.07586666, tolerance = 1e-3) + expect_equal(attributes(out)$null, mean(predict(m)), tolerance = 1e-3) + expect_identical( + capture.output(out), + c( + "Marginal Omnibus Test", + "", + "df1 | df2 | F | p", + "------------------------", + "3 | 114 | 2.35 | 0.076", + "", + "p-values are uncorrected.", + "Null-hypothesis: Group means equal 16.20" + ) + ) + out <- estimate_contrasts(m, contrast = "time", comparison = "omnibus", null = 15) expect_equal(out$`F`, 3.71661, tolerance = 1e-3) expect_equal(out$p, 0.01356, tolerance = 1e-3) From 97c31cb56bbf75f2c61ec27c077963a0aec439ff Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 11:02:10 +0100 Subject: [PATCH 20/56] news --- NEWS.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NEWS.md b/NEWS.md index 498c23269..3cc1831f7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,18 @@ # modelbased (devel) +## BreakingChanges + +* Table headers and footers are now harmonized to conceptually align with the + package documentation (see the `estimate` argument in `?estimate_means`, as + well as the vignettes on the modelisation-approach + (https://easystats.github.io/modelbased/articles/post_estimation_framework.html) + and technical details on marginalization + (https://easystats.github.io/modelbased/articles/technical_marginalization.html)). + Specifically, `estimate` defines the *unit of interest* for your *estimand*, + distinguishing between predictions *conditioned* on specific, theoretical + individual levels and *marginal* predictions averaged over empirical observations + at the sample or population level. + ## Changes * `effectsize = "emmeans"` in `estimate_contrasts()` now also works for `polr` From 04a1dbda2609a2850f37737c821e36a313853130 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 11:02:28 +0100 Subject: [PATCH 21/56] news --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 3cc1831f7..6d6b063cc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # modelbased (devel) -## BreakingChanges +## Breaking Changes * Table headers and footers are now harmonized to conceptually align with the package documentation (see the `estimate` argument in `?estimate_means`, as From 50898747f4dd0cc70bc0f974fa92bab4ad51408c Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 11:22:15 +0100 Subject: [PATCH 22/56] check eval value --- vignettes/post_estimation_framework.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vignettes/post_estimation_framework.Rmd b/vignettes/post_estimation_framework.Rmd index 603874c00..dbcc500f4 100644 --- a/vignettes/post_estimation_framework.Rmd +++ b/vignettes/post_estimation_framework.Rmd @@ -223,9 +223,9 @@ display( The "interpretation trap" occurs when researchers forget that regression coefficients must be interpreted conditionally - meaning they only compare individuals who share the exact same characteristics across all other variables. -- **Categorical Predictors:** Estimates are interpreted relative to a baseline reference category. For instance, the coefficient for `symptoms_unreal ((strongly) disagree)` is `r round(result$Coefficient[result$Parameter == "symptoms_unreal(strongly) disagree"], 2)`. This indicates that, holding `time`, `sex`, `age`, and all other covariates constant, patients who disagree that their symptoms are "unreal" score `r abs(round(result$Coefficient[result$Parameter == "symptoms_unreal(strongly) disagree"], 2))` points lower on the PHQ-15 than those in the implicit reference category (who agree). +- **Categorical Predictors:** Estimates are interpreted relative to a baseline reference category. For instance, the coefficient for `symptoms_unreal ((strongly) disagree)` is `r if (isTRUE(knitr::opts_chunk$get("eval"))) round(result$Coefficient[result$Parameter == "symptoms_unreal(strongly) disagree"], 2) else -1.36`. This indicates that, holding `time`, `sex`, `age`, and all other covariates constant, patients who disagree that their symptoms are "unreal" score `r if (isTRUE(knitr::opts_chunk$get("eval"))) abs(round(result$Coefficient[result$Parameter == "symptoms_unreal(strongly) disagree"], 2)) else 1.36` points lower on the PHQ-15 than those in the implicit reference category (who agree). -- **Continuous Predictors:** Estimates reflect the expected change associated with a one-unit increase in the predictor. The `time` coefficient of `r round(result$Coefficient[result$Parameter == "time"], 2)` suggests a `r abs(round(result$Coefficient[result$Parameter == "time"], 2))`-point decrease in PHQ-15 scores for every single unit of time passed, again, assuming *all other variables are held constant*. +- **Continuous Predictors:** Estimates reflect the expected change associated with a one-unit increase in the predictor. The `time` coefficient of `r if (isTRUE(knitr::opts_chunk$get("eval"))) round(result$Coefficient[result$Parameter == "time"], 2) else -0.69` suggests a `r if (isTRUE(knitr::opts_chunk$get("eval"))) abs(round(result$Coefficient[result$Parameter == "time"], 2)) else 0.69`-point decrease in PHQ-15 scores for every single unit of time passed, again, assuming *all other variables are held constant*. --- From 043e1082758c62d87160e884ce9bb3034456d8fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Nov 2026 10:23:07 +0000 Subject: [PATCH 23/56] Fix spelling check failures Co-authored-by: strengejacke <26301769+strengejacke@users.noreply.github.com> --- R/data.R | 2 +- inst/WORDLIST | 28 +++++++++++++++++++++++ man/stigma.Rd | 2 +- vignettes/mixed_models.Rmd | 2 +- vignettes/practical_intersectionality.Rmd | 6 ++--- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/R/data.R b/R/data.R index 180f09305..f56abb8df 100644 --- a/R/data.R +++ b/R/data.R @@ -68,7 +68,7 @@ NULL #' @docType data -#' @title Sample dataset from patients with somatic symptons +#' @title Sample dataset from patients with somatic symptoms #' @name stigma #' @keywords data #' diff --git a/inst/WORDLIST b/inst/WORDLIST index 4c62a1973..1d8f4cdee 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -161,3 +161,31 @@ visualise walkthrough ’ ’s +Adelie +anonymized +CASMIN +CKD +colours +counterfactuals +customizations +DAGs +estimand +estimands +Estimands +Excursus +facto +IBS +L'Approche +MCMCglmm +metacognition +modélisation +Modélisation +MOR +overadjustment +PHQ +positivity +Positivity +Sidak +Ulcerative +Vive +VPC diff --git a/man/stigma.Rd b/man/stigma.Rd index 4d6d296af..c41aa196c 100644 --- a/man/stigma.Rd +++ b/man/stigma.Rd @@ -3,7 +3,7 @@ \docType{data} \name{stigma} \alias{stigma} -\title{Sample dataset from patients with somatic symptons} +\title{Sample dataset from patients with somatic symptoms} \description{ An artificial, anonymized data set based on a project related to the development and persistence of somatic symptoms. diff --git a/vignettes/mixed_models.Rmd b/vignettes/mixed_models.Rmd index 3230ee7ad..a29d32496 100644 --- a/vignettes/mixed_models.Rmd +++ b/vignettes/mixed_models.Rmd @@ -126,7 +126,7 @@ estimate_means(model, "sex", estimate = "average") estimate_means(model, "sex", estimate = "average", re.form = NA) ``` -### Excourse: Technical Details +### Excursus: Technical Details ::: custom_note To better understand how these predictions are computed under the hood, let's break down the underlying workflow. The code below illustrates the manual step-by-step procedures for grid-based versus sample-averaged predictions. diff --git a/vignettes/practical_intersectionality.Rmd b/vignettes/practical_intersectionality.Rmd index d6ecd8174..c21a80eff 100644 --- a/vignettes/practical_intersectionality.Rmd +++ b/vignettes/practical_intersectionality.Rmd @@ -68,7 +68,7 @@ The steps we are showing here are: 1. Defining the intersectional strata. -2. Fitting a *simple intersectional* model to see whether intersectional strata contribute to between-stratum variance (which can be considered as "inequalities", whether social or health related - also known as _discriminatory accucarcy_). +2. Fitting a *simple intersectional* model to see whether intersectional strata contribute to between-stratum variance (which can be considered as "inequalities", whether social or health related - also known as _discriminatory accuracy_). 3. Fitting *partially-adjusted intersectional* models and calculating proportional change in the between-stratum variance (PCVs) to quantify to what degree the different intersectional dimensions contribute to the between-stratum variance (inequalities) @@ -138,7 +138,7 @@ m_null <- glmmTMB(qol ~ 1 + (1 | gender:employed:age), data = efc) # m_null <- glmmTMB(qol ~ 1 + (1 | strata), data = efc) ``` -The purpose of this model - which is sometimes also called *null model* or *base model* - is to quantify the "discriminatory accuracy", which is achieved by calculating the ICC (see [`performance::icc()`](https://easystats.github.io/performance/reference/icc.html)) of this model (sometimes also calles the _VPC_, the variance partition coefficient). The higher the ICC, the greater the degree of similarity _within the strata_ (regarding quality of life) and the greater the difference in quality of life _between the intersectional strata_. I.e., the higher the ICC, the better the model is at discriminating individuals with higher or lower quality of life score, as opposed to models with lower ICC. +The purpose of this model - which is sometimes also called *null model* or *base model* - is to quantify the "discriminatory accuracy", which is achieved by calculating the ICC (see [`performance::icc()`](https://easystats.github.io/performance/reference/icc.html)) of this model (sometimes also called the _VPC_, the variance partition coefficient). The higher the ICC, the greater the degree of similarity _within the strata_ (regarding quality of life) and the greater the difference in quality of life _between the intersectional strata_. I.e., the higher the ICC, the better the model is at discriminating individuals with higher or lower quality of life score, as opposed to models with lower ICC. We now look at the model parameters and the ICC of our simple intersectional model. @@ -319,7 +319,7 @@ As expected (because the PCV is 1, indicating we found no multiplicative effects Compared to a MAIHDA analysis using *linear* regression models, there are two important aspects to consider when using *binary logistic* regression models. -### 7.1 Additive and multiplicatice effects +### 7.1 Additive and multiplicative effects When applying this framework to dichotomous outcomes using logistic multilevel models, two important distinctions must be considered. First, the within-strata (level 1) variance is not estimated, as the variance of the binomial distribution is already known (and fixed, see [`?insight::get_variance`](https://easystats.github.io/insight/reference/get_variance.html) for Bernoulli models). Second, logistic models operate on a multiplicative scale rather than an additive one. According to Evans et al. (2018), it is inappropriate to use logistic models to examine strata-level residuals for additive interaction effects, since the inclusion of main effects may already account for some of these interactions. However, logistic models remain fully appropriate if the primary goal is to estimate strata-level effects to explore the overall patterning of inequalities across strata-groups [@evans_multilevel_2018]. From 828e51ba324c7ad692023fdacce8ce18775365be Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 11:31:23 +0100 Subject: [PATCH 24/56] missing space --- vignettes/post_estimation_framework.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/post_estimation_framework.Rmd b/vignettes/post_estimation_framework.Rmd index dbcc500f4..4215c9249 100644 --- a/vignettes/post_estimation_framework.Rmd +++ b/vignettes/post_estimation_framework.Rmd @@ -81,7 +81,7 @@ knitr::include_graphics("../man/figures/from-model-to-meaning-final.png") ## Defining the Estimands: Five Questions, One Model -Before setting up any statistical model, researchers must explicitly spell out their theoretical estimands in precise terms. An estimand is the specific target quantity (and unit) that directly answers the research question [@lundberg_what_2021]. Instead of passively interpreting whatever coefficients the software returns, we must actively decide whether our question requires us to estimate *predictions*, *slopes*, or *comparisons* (*quantity*),and determine to which target population we want to generalize our results (*unit*) [@rohrer_models_2026; @rohrer_these_2023]. +Before setting up any statistical model, researchers must explicitly spell out their theoretical estimands in precise terms. An estimand is the specific target quantity (and unit) that directly answers the research question [@lundberg_what_2021]. Instead of passively interpreting whatever coefficients the software returns, we must actively decide whether our question requires us to estimate *predictions*, *slopes*, or *comparisons* (*quantity*), and determine to which target population we want to generalize our results (*unit*) [@rohrer_models_2026; @rohrer_these_2023]. --- From a939dfe2f35e72fe2856c52d3ed1072305c3cd31 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 11:45:31 +0100 Subject: [PATCH 25/56] add callout --- vignettes/post_estimation_framework.Rmd | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vignettes/post_estimation_framework.Rmd b/vignettes/post_estimation_framework.Rmd index 4215c9249..cfccabb35 100644 --- a/vignettes/post_estimation_framework.Rmd +++ b/vignettes/post_estimation_framework.Rmd @@ -102,7 +102,7 @@ In this vignette, we will use a single model to target five distinct estimands: Once these target quantities are clearly defined, we can proceed to construct the mathematical model that will allow us to estimate them. ::: custom_note -**The estimand - quantity and unit of interests** +**The estimand - quantity and unit of interest** Defining your *estimand* requires specifying both the *quantity* and the *unit* of interest. Thus, determining your target population (*unit*) - whether that is a specific individual, an average across individuals, or a broader population - is just as crucial as choosing between predictions, contrasts or slopes (*quantity*) [@lundberg_what_2021; @rohrer_models_2026]. @@ -209,7 +209,7 @@ model <- glmmTMB( ## Interpreting the output -When looking at the standard regression table, it is crucial to interpret these coefficients as *descriptive comparisons*. Specifically, coefficients generally represent *conditional effects*, meaning they describe an association while *strictly holding all other covariates constant* (@gelman_regression_2020; Chapter 6.3), i.e., comparing individuals who are identical regarding these characteristics. +When looking at the standard regression table, it is crucial to interpret these coefficients as *descriptive comparisons*. Specifically, coefficients generally represent *conditional effects*, meaning they describe an association while *strictly holding all other covariates constant* (@gelman_regression_2020; Chapter 6.3), i.e., comparing individuals who are **identical** regarding these characteristics. ```{r, } result <- model_parameters(model, effects = "fixed") @@ -221,12 +221,16 @@ display( ### The Interpretation Trap -The "interpretation trap" occurs when researchers forget that regression coefficients must be interpreted conditionally - meaning they only compare individuals who share the exact same characteristics across all other variables. +The "interpretation trap" occurs when researchers forget that regression coefficients must be interpreted conditionally - meaning they only compare individuals who share **the exact same** characteristics across all other variables. - **Categorical Predictors:** Estimates are interpreted relative to a baseline reference category. For instance, the coefficient for `symptoms_unreal ((strongly) disagree)` is `r if (isTRUE(knitr::opts_chunk$get("eval"))) round(result$Coefficient[result$Parameter == "symptoms_unreal(strongly) disagree"], 2) else -1.36`. This indicates that, holding `time`, `sex`, `age`, and all other covariates constant, patients who disagree that their symptoms are "unreal" score `r if (isTRUE(knitr::opts_chunk$get("eval"))) abs(round(result$Coefficient[result$Parameter == "symptoms_unreal(strongly) disagree"], 2)) else 1.36` points lower on the PHQ-15 than those in the implicit reference category (who agree). - **Continuous Predictors:** Estimates reflect the expected change associated with a one-unit increase in the predictor. The `time` coefficient of `r if (isTRUE(knitr::opts_chunk$get("eval"))) round(result$Coefficient[result$Parameter == "time"], 2) else -0.69` suggests a `r if (isTRUE(knitr::opts_chunk$get("eval"))) abs(round(result$Coefficient[result$Parameter == "time"], 2)) else 0.69`-point decrease in PHQ-15 scores for every single unit of time passed, again, assuming *all other variables are held constant*. +::: custom_note +Conditioning on covariates means we *might* end up comparing individuals who do not exist in our sample - such as an unmarried, highly educated 67-year-old man and woman. While this *can* be a meaningful comparison, it often is not, which is why regression coefficients rarely answer our research questions directly. After all, do we want to compare 67-year-old, highly educated, unmarried women and men - or women and men in general? See the callout-box above, "The estimand - quantity and unit of interest". +::: + --- ```{r, echo=FALSE, out.width = "650px", fig.align="center", fig.cap = "The Cognitive Overload of Conditional Effects"} From 27d086ab224a8052f288124829719a2577a9eccb Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 13:03:22 +0100 Subject: [PATCH 26/56] plots only on win --- tests/testthat/test-plot.R | 225 ++++++++++++++++++++++++++++--------- 1 file changed, 170 insertions(+), 55 deletions(-) diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index a3403fdad..585f86a65 100644 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -13,30 +13,36 @@ test_that("plots emmeans", { x <- estimate_means(model, by = "Species", backend = "emmeans") vdiffr::expect_doppelganger( "plot-means-1", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) vdiffr::expect_doppelganger( "plot-means-1-lines", - plot(modelbased::visualisation_recipe(x, show_data = FALSE, join_dots = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE, join_dots = TRUE)), + variant = "windows" ) x <- estimate_means(model, by = "Sepal.Width", backend = "emmeans") vdiffr::expect_doppelganger( "plot-means-2", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) x <- estimate_means(model, by = c("Sepal.Width", "Species"), backend = "emmeans") vdiffr::expect_doppelganger( "plot-means-3", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) x <- estimate_means(model, by = c("Species", "Sepal.Width"), backend = "emmeans") vdiffr::expect_doppelganger( "plot-means-4", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) vdiffr::expect_doppelganger( "plot-means-4-lines", - plot(modelbased::visualisation_recipe(x, show_data = FALSE, join_dots = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE, join_dots = TRUE)), + variant = "windows" ) }) @@ -49,25 +55,29 @@ test_that("plots, show_data", { set.seed(123) vdiffr::expect_doppelganger( "plot-means-showdata-1", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_means(model, by = "Sepal.Width") set.seed(123) vdiffr::expect_doppelganger( "plot-means-showdata-2", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_means(model, by = c("Sepal.Width", "Species")) set.seed(123) vdiffr::expect_doppelganger( "plot-means-showdata-3", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_means(model, by = c("Species", "Sepal.Width")) set.seed(123) vdiffr::expect_doppelganger( "plot-means-showdata-4", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) }) @@ -79,12 +89,14 @@ test_that("plots marginalmeans", { x <- estimate_means(model, by = "Species", backend = "marginaleffects") vdiffr::expect_doppelganger( "plot-me-means-1", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) x <- estimate_means(model, by = "Sepal.Width", backend = "marginaleffects") vdiffr::expect_doppelganger( "plot-me-means-2", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) x <- estimate_means( model, @@ -93,7 +105,8 @@ test_that("plots marginalmeans", { ) vdiffr::expect_doppelganger( "plot-me-means-3", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) x <- estimate_means( model, @@ -102,7 +115,8 @@ test_that("plots marginalmeans", { ) vdiffr::expect_doppelganger( "plot-me-means-4", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) }) @@ -115,13 +129,15 @@ test_that("plots marginalmeans, show_data", { set.seed(123) vdiffr::expect_doppelganger( "plot-me-means-showdata-1", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_means(model, by = "Sepal.Width", backend = "marginaleffects") set.seed(123) vdiffr::expect_doppelganger( "plot-me-means-showdata-2", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_means( model, @@ -131,7 +147,8 @@ test_that("plots marginalmeans, show_data", { set.seed(123) vdiffr::expect_doppelganger( "plot-me-means-showdata-3", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_means( model, @@ -141,7 +158,8 @@ test_that("plots marginalmeans, show_data", { set.seed(123) vdiffr::expect_doppelganger( "plot-me-means-showdata-4", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) }) @@ -153,22 +171,26 @@ test_that("plots relation", { x <- estimate_relation(model, by = "Species") vdiffr::expect_doppelganger( "plot-relation-1", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) x <- estimate_relation(model, by = "Sepal.Width") vdiffr::expect_doppelganger( "plot-relation-2", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) x <- estimate_relation(model, by = c("Sepal.Width", "Species")) vdiffr::expect_doppelganger( "plot-relation-3", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) x <- estimate_relation(model, by = c("Species", "Sepal.Width")) vdiffr::expect_doppelganger( "plot-relation-4", - plot(modelbased::visualisation_recipe(x, show_data = FALSE)) + plot(modelbased::visualisation_recipe(x, show_data = FALSE)), + variant = "windows" ) }) @@ -181,25 +203,29 @@ test_that("plots, relation show_data", { set.seed(123) vdiffr::expect_doppelganger( "plot-relation-showdata-1", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_relation(model, by = "Sepal.Width") set.seed(123) vdiffr::expect_doppelganger( "plot-relation-showdata-2", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_relation(model, by = c("Sepal.Width", "Species")) set.seed(123) vdiffr::expect_doppelganger( "plot-relation-showdata-3", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) x <- estimate_relation(model, by = c("Species", "Sepal.Width")) set.seed(123) vdiffr::expect_doppelganger( "plot-relation-showdata-4", - plot(modelbased::visualisation_recipe(x, show_data = TRUE)) + plot(modelbased::visualisation_recipe(x, show_data = TRUE)), + variant = "windows" ) }) @@ -218,7 +244,8 @@ test_that("plots, relation, percentage for logistic", { set.seed(123) vdiffr::expect_doppelganger( "plot-relation-logistic-percentage-1", - plot(modelbased::visualisation_recipe(out)) + plot(modelbased::visualisation_recipe(out)), + variant = "windows" ) }) @@ -229,11 +256,15 @@ test_that("plots, grouplevel lme4", { d$Newfactor <- rep(c("A", "B", "C", "D")) model <- lme4::lmer(Reaction ~ Days + (1 + Days | Subject) + (1 | Newfactor), data = d) set.seed(123) - vdiffr::expect_doppelganger("plot-grouplevel-lme4-1", plot(estimate_grouplevel(model))) + vdiffr::expect_doppelganger( + "plot-grouplevel-lme4-1", + plot(estimate_grouplevel(model)), + variant = "windows" + ) out <- estimate_grouplevel(model) vr <- visualisation_recipe(out, pointrange = list(color = "black")) set.seed(123) - vdiffr::expect_doppelganger("plot-grouplevel-lme4-2", plot(vr)) + vdiffr::expect_doppelganger("plot-grouplevel-lme4-2", plot(vr), variant = "windows") }) @@ -242,7 +273,11 @@ test_that("plots, relation, multiple CI", { m <- lm(mpg ~ qsec, data = mtcars) em <- estimate_relation(m, ci = c(0.5, 0.8, 0.9)) set.seed(123) - vdiffr::expect_doppelganger("plot-relation-multiple-ci-1", plot(em, show_data = TRUE)) + vdiffr::expect_doppelganger( + "plot-relation-multiple-ci-1", + plot(em, show_data = TRUE), + variant = "windows" + ) }) @@ -252,7 +287,11 @@ test_that("plots, estimate_means works with Poisson", { dat_glm <- glm(y ~ fa, data = dat, family = poisson(link = "log")) x <- estimate_means(dat_glm, "fa", backend = "emmeans") set.seed(123) - vdiffr::expect_doppelganger("plot-means-poisson-1", plot(x, show_data = TRUE)) + vdiffr::expect_doppelganger( + "plot-means-poisson-1", + plot(x, show_data = TRUE), + variant = "windows" + ) set.seed(123) vdiffr::expect_doppelganger( "plot-means-poisson-1-lines", @@ -260,7 +299,11 @@ test_that("plots, estimate_means works with Poisson", { ) x <- estimate_means(dat_glm, "fa", backend = "marginaleffects") set.seed(123) - vdiffr::expect_doppelganger("plot-means-poisson-2", plot(x, show_data = TRUE)) + vdiffr::expect_doppelganger( + "plot-means-poisson-2", + plot(x, show_data = TRUE), + variant = "windows" + ) }) @@ -269,24 +312,40 @@ test_that("plots, estimate_means, order of predictors", { model <- lm(Petal.Length ~ Sepal.Width * Species, data = iris) pr <- estimate_means(model, by = c("Species", "Sepal.Width"), backend = "emmeans") set.seed(123) - vdiffr::expect_doppelganger("plot-means-predictor-order-1", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-means-predictor-order-1", + plot(pr, show_data = FALSE), + variant = "windows" + ) pr <- estimate_means(model, by = c("Sepal.Width", "Species"), backend = "emmeans") set.seed(123) - vdiffr::expect_doppelganger("plot-means-predictor-order-2", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-means-predictor-order-2", + plot(pr, show_data = FALSE), + variant = "windows" + ) pr <- estimate_means( model, by = c("Species", "Sepal.Width"), backend = "marginaleffects" ) set.seed(123) - vdiffr::expect_doppelganger("plot-means-predictor-order-3", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-means-predictor-order-3", + plot(pr, show_data = FALSE), + variant = "windows" + ) pr <- estimate_means( model, by = c("Sepal.Width", "Species"), backend = "marginaleffects" ) set.seed(123) - vdiffr::expect_doppelganger("plot-means-predictor-order-4", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-means-predictor-order-4", + plot(pr, show_data = FALSE), + variant = "windows" + ) }) @@ -297,29 +356,57 @@ test_that("plots, numeric or categorical predictors are detected", { m_cat <- lm(mpg ~ cyl, data = dat) pr <- estimate_expectation(m_cat, by = "cyl") set.seed(123) - vdiffr::expect_doppelganger("plot-cat-num-predictor-1", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-cat-num-predictor-1", + plot(pr, show_data = FALSE), + variant = "windows" + ) pr <- estimate_means(m_cat, by = "cyl", backend = "marginaleffects") set.seed(123) - vdiffr::expect_doppelganger("plot-cat-num-predictor-2", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-cat-num-predictor-2", + plot(pr, show_data = FALSE), + variant = "windows" + ) m_cat <- lm(mpg ~ cyl, data = mtcars) pr <- estimate_expectation(m_cat, by = "cyl") set.seed(123) - vdiffr::expect_doppelganger("plot-cat-num-predictor-3", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-cat-num-predictor-3", + plot(pr, show_data = FALSE), + variant = "windows" + ) pr <- estimate_means(m_cat, by = "cyl", backend = "marginaleffects") set.seed(123) - vdiffr::expect_doppelganger("plot-cat-num-predictor-4", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-cat-num-predictor-4", + plot(pr, show_data = FALSE), + variant = "windows" + ) pr <- estimate_expectation(m_cat, by = "cyl", range = "grid") set.seed(123) - vdiffr::expect_doppelganger("plot-cat-num-predictor-5", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-cat-num-predictor-5", + plot(pr, show_data = FALSE), + variant = "windows" + ) data(efc, package = "modelbased") m <- lm(neg_c_7 ~ barthtot, data = efc) pr <- estimate_means(m, by = "barthtot", backend = "marginaleffects") set.seed(123) - vdiffr::expect_doppelganger("plot-cat-num-predictor-6", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-cat-num-predictor-6", + plot(pr, show_data = FALSE), + variant = "windows" + ) pr <- estimate_means(m, by = "barthtot", range = "grid", backend = "marginaleffects") set.seed(123) - vdiffr::expect_doppelganger("plot-cat-num-predictor-7", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-cat-num-predictor-7", + plot(pr, show_data = FALSE), + variant = "windows" + ) }) @@ -332,7 +419,11 @@ test_that("plots, at special values", { preserve_range = FALSE ) set.seed(123) - vdiffr::expect_doppelganger("plot-expectation-fivenum", plot(pr, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-expectation-fivenum", + plot(pr, show_data = FALSE), + variant = "windows" + ) set.seed(123) vdiffr::expect_doppelganger( "plot-expectation-fivenum.2", @@ -353,7 +444,7 @@ test_that("plots, estimate_slope", { backend = "emmeans" ) set.seed(123) - vdiffr::expect_doppelganger("plot-slopes-1", plot(slopes)) + vdiffr::expect_doppelganger("plot-slopes-1", plot(slopes), variant = "windows") model <- lm(Sepal.Width ~ Petal.Width * Petal.Length, data = iris) slopes <- estimate_slopes( @@ -363,7 +454,7 @@ test_that("plots, estimate_slope", { backend = "emmeans" ) set.seed(123) - vdiffr::expect_doppelganger("plot-slopes-2", plot(slopes)) + vdiffr::expect_doppelganger("plot-slopes-2", plot(slopes), variant = "windows") model <- lm(Sepal.Width ~ Species * Petal.Length, data = iris) slopes <- estimate_slopes( @@ -373,7 +464,7 @@ test_that("plots, estimate_slope", { backend = "marginaleffects" ) set.seed(123) - vdiffr::expect_doppelganger("plot-slopes-3", plot(slopes)) + vdiffr::expect_doppelganger("plot-slopes-3", plot(slopes), variant = "windows") model <- lm(Sepal.Width ~ Petal.Width * Petal.Length, data = iris) slopes <- estimate_slopes( @@ -384,7 +475,7 @@ test_that("plots, estimate_slope", { backend = "marginaleffects" ) set.seed(123) - vdiffr::expect_doppelganger("plot-slopes-4", plot(slopes)) + vdiffr::expect_doppelganger("plot-slopes-4", plot(slopes), variant = "windows") data(iris) x <- iris @@ -398,7 +489,7 @@ test_that("plots, estimate_slope", { backend = "marginaleffects" ) set.seed(123) - vdiffr::expect_doppelganger("plot-slopes-5", plot(slopes)) + vdiffr::expect_doppelganger("plot-slopes-5", plot(slopes), variant = "windows") }) @@ -407,10 +498,18 @@ test_that("plots, automatically join dots", { m <- lm(Sepal.Width ~ Petal.Length + Species * Petal.Width, data = iris) out <- estimate_expectation(m, by = c("Species", "Petal.Width")) set.seed(123) - vdiffr::expect_doppelganger("plot-join-dots-1", plot(out, show_data = TRUE)) + vdiffr::expect_doppelganger( + "plot-join-dots-1", + plot(out, show_data = TRUE), + variant = "windows" + ) out <- estimate_expectation(m, by = c("Species", "Petal.Width"), preserve_range = FALSE) set.seed(123) - vdiffr::expect_doppelganger("plot-join-dots-2", plot(out, show_data = TRUE)) + vdiffr::expect_doppelganger( + "plot-join-dots-2", + plot(out, show_data = TRUE), + variant = "windows" + ) }) @@ -419,7 +518,11 @@ test_that("plots, logistic regression", { model <- glm(vs ~ wt, data = mtcars, family = "binomial") out <- estimate_means(model, "wt", length = 100, backend = "marginaleffects") set.seed(123) - vdiffr::expect_doppelganger("plot-glm-logistic-1", plot(out, show_data = TRUE)) + vdiffr::expect_doppelganger( + "plot-glm-logistic-1", + plot(out, show_data = TRUE), + variant = "windows" + ) out <- estimate_means( model, "wt", @@ -428,7 +531,11 @@ test_that("plots, logistic regression", { backend = "marginaleffects" ) set.seed(123) - vdiffr::expect_doppelganger("plot-glm-logistic-2", plot(out, show_data = TRUE)) + vdiffr::expect_doppelganger( + "plot-glm-logistic-2", + plot(out, show_data = TRUE), + variant = "windows" + ) }) @@ -441,7 +548,11 @@ test_that("plots, 4-way with numeric", { by <- c("c12hour", "c161sex", "c172code", "barthtot = [fivenum]") estim <- estimate_means(m, by = by, backend = "marginaleffects") set.seed(123) - vdiffr::expect_doppelganger("plot-4way-numeric-1", plot(estim, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-4way-numeric-1", + plot(estim, show_data = FALSE), + variant = "windows" + ) }) @@ -455,7 +566,11 @@ test_that("plots, glm logistic inside bound", { m <- glm(outcome ~ var1 * var2, data = data, family = binomial(link = "logit")) out1 <- estimate_means(m, c("var2 = [sd]", "var1"), backend = "marginaleffects") set.seed(123) - vdiffr::expect_doppelganger("plot-logistic-bounds-1", plot(out1, show_data = FALSE)) + vdiffr::expect_doppelganger( + "plot-logistic-bounds-1", + plot(out1, show_data = FALSE), + variant = "windows" + ) set.seed(123) vdiffr::expect_doppelganger( "plot-logistic-bounds-2", From 3981084282d1ac5eec3d8492e90c2cfed9a92bff Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 14:51:00 +0100 Subject: [PATCH 27/56] Add win variants --- .../windows/plot/plot-4way-numeric-1.svg | 483 ++++++++++++++++++ .../windows/plot/plot-cat-num-predictor-1.svg | 55 ++ .../windows/plot/plot-cat-num-predictor-2.svg | 55 ++ .../windows/plot/plot-cat-num-predictor-3.svg | 57 +++ .../windows/plot/plot-cat-num-predictor-4.svg | 57 +++ .../windows/plot/plot-cat-num-predictor-5.svg | 57 +++ .../windows/plot/plot-cat-num-predictor-6.svg | 59 +++ .../windows/plot/plot-cat-num-predictor-7.svg | 59 +++ .../windows/plot/plot-expectation-fivenum.svg | 101 ++++ .../windows/plot/plot-glm-logistic-1.svg | 93 ++++ .../windows/plot/plot-glm-logistic-2.svg | 55 ++ .../windows/plot/plot-grouplevel-lme4-1.svg | 274 ++++++++++ .../windows/plot/plot-grouplevel-lme4-2.svg | 274 ++++++++++ .../_snaps/windows/plot/plot-join-dots-1.svg | 243 +++++++++ .../_snaps/windows/plot/plot-join-dots-2.svg | 277 ++++++++++ .../windows/plot/plot-logistic-bounds-1.svg | 75 +++ .../_snaps/windows/plot/plot-me-means-1.svg | 59 +++ .../_snaps/windows/plot/plot-me-means-2.svg | 63 +++ .../_snaps/windows/plot/plot-me-means-3.svg | 85 +++ .../_snaps/windows/plot/plot-me-means-4.svg | 131 +++++ .../windows/plot/plot-me-means-showdata-1.svg | 207 ++++++++ .../windows/plot/plot-me-means-showdata-2.svg | 211 ++++++++ .../windows/plot/plot-me-means-showdata-3.svg | 238 +++++++++ .../windows/plot/plot-me-means-showdata-4.svg | 281 ++++++++++ .../windows/plot/plot-means-1-lines.svg | 60 +++ .../_snaps/windows/plot/plot-means-1.svg | 59 +++ .../_snaps/windows/plot/plot-means-2.svg | 63 +++ .../_snaps/windows/plot/plot-means-3.svg | 85 +++ .../windows/plot/plot-means-4-lines.svg | 141 +++++ .../_snaps/windows/plot/plot-means-4.svg | 131 +++++ .../windows/plot/plot-means-poisson-1.svg | 163 ++++++ .../windows/plot/plot-means-poisson-2.svg | 163 ++++++ .../plot/plot-means-predictor-order-1.svg | 127 +++++ .../plot/plot-means-predictor-order-2.svg | 81 +++ .../plot/plot-means-predictor-order-3.svg | 127 +++++ .../plot/plot-means-predictor-order-4.svg | 81 +++ .../windows/plot/plot-means-showdata-1.svg | 207 ++++++++ .../windows/plot/plot-means-showdata-2.svg | 211 ++++++++ .../windows/plot/plot-means-showdata-3.svg | 238 +++++++++ .../windows/plot/plot-means-showdata-4.svg | 281 ++++++++++ .../_snaps/windows/plot/plot-relation-1.svg | 59 +++ .../_snaps/windows/plot/plot-relation-2.svg | 65 +++ .../_snaps/windows/plot/plot-relation-3.svg | 83 +++ .../_snaps/windows/plot/plot-relation-4.svg | 109 ++++ .../plot-relation-logistic-percentage-1.svg | 59 +++ .../plot/plot-relation-multiple-ci-1.svg | 99 ++++ .../windows/plot/plot-relation-showdata-1.svg | 207 ++++++++ .../windows/plot/plot-relation-showdata-2.svg | 213 ++++++++ .../windows/plot/plot-relation-showdata-3.svg | 238 +++++++++ .../windows/plot/plot-relation-showdata-4.svg | 261 ++++++++++ .../_snaps/windows/plot/plot-slopes-1.svg | 58 +++ .../_snaps/windows/plot/plot-slopes-2.svg | 62 +++ .../_snaps/windows/plot/plot-slopes-3.svg | 58 +++ .../_snaps/windows/plot/plot-slopes-4.svg | 82 +++ .../_snaps/windows/plot/plot-slopes-5.svg | 75 +++ 55 files changed, 7495 insertions(+) create mode 100644 tests/testthat/_snaps/windows/plot/plot-4way-numeric-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-5.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-6.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-7.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-expectation-fivenum.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-glm-logistic-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-glm-logistic-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-grouplevel-lme4-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-grouplevel-lme4-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-join-dots-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-join-dots-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-logistic-bounds-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-me-means-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-me-means-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-me-means-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-me-means-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-me-means-showdata-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-me-means-showdata-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-me-means-showdata-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-me-means-showdata-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-1-lines.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-4-lines.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-poisson-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-poisson-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-predictor-order-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-predictor-order-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-predictor-order-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-predictor-order-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-showdata-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-showdata-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-showdata-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-means-showdata-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-logistic-percentage-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-multiple-ci-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-showdata-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-showdata-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-showdata-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-relation-showdata-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-slopes-1.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-slopes-2.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-slopes-3.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-slopes-4.svg create mode 100644 tests/testthat/_snaps/windows/plot/plot-slopes-5.svg diff --git a/tests/testthat/_snaps/windows/plot/plot-4way-numeric-1.svg b/tests/testthat/_snaps/windows/plot/plot-4way-numeric-1.svg new file mode 100644 index 000000000..0afc50619 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-4way-numeric-1.svg @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +low + + + + + + + + + + +mid + + + + + + + + + + +high + + + + + + + + + + +0 + + + + + + + + + + +45 + + + + + + + + + + +70 + + + + + + + + + + +90 + + + + + + + + + + +100 + + + + + + +0 +50 +100 +150 + + + + +0 +50 +100 +150 + + + + +0 +50 +100 +150 +7.5 +10.0 +12.5 +15.0 +17.5 + + + + + +7.5 +10.0 +12.5 +15.0 +17.5 + + + + + +7.5 +10.0 +12.5 +15.0 +17.5 + + + + + +7.5 +10.0 +12.5 +15.0 +17.5 + + + + + +7.5 +10.0 +12.5 +15.0 +17.5 + + + + + +average number of hours of care per week +Mean of Negative impact with 7 items + +carer's gender + + + + + + +Male +Female +plot-4way-numeric-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-1.svg b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-1.svg new file mode 100644 index 000000000..df26d80d0 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-1.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +15 +20 +25 + + + + + + +4 +6 +8 +cyl +Predicted value of mpg +plot-cat-num-predictor-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-2.svg b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-2.svg new file mode 100644 index 000000000..d001ba61c --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-2.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +15 +20 +25 + + + + + + +4 +6 +8 +cyl +Mean of mpg +plot-cat-num-predictor-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-3.svg b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-3.svg new file mode 100644 index 000000000..65afbf233 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-3.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +16 +20 +24 +28 + + + + + + + +4 +6 +8 +cyl +Predicted value of mpg +plot-cat-num-predictor-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-4.svg b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-4.svg new file mode 100644 index 000000000..085ae2b4a --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-4.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +16 +20 +24 +28 + + + + + + + +4 +6 +8 +cyl +Mean of mpg +plot-cat-num-predictor-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-5.svg b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-5.svg new file mode 100644 index 000000000..0886f7f9f --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-5.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +16 +20 +24 +28 + + + + + + + +4 +6 +8 +cyl +Predicted value of mpg +plot-cat-num-predictor-5 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-6.svg b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-6.svg new file mode 100644 index 000000000..50426e3bb --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-6.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +10 +12 +14 +16 + + + + + + + + + +0 +25 +50 +75 +100 +Total score BARTHEL INDEX +Mean of Negative impact with 7 items +plot-cat-num-predictor-6 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-7.svg b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-7.svg new file mode 100644 index 000000000..76758da06 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-cat-num-predictor-7.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +10 +12 +14 +16 + + + + + + + + + +0 +25 +50 +75 +100 +Total score BARTHEL INDEX +Mean of Negative impact with 7 items +plot-cat-num-predictor-7 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-expectation-fivenum.svg b/tests/testthat/_snaps/windows/plot/plot-expectation-fivenum.svg new file mode 100644 index 000000000..9b8592cb4 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-expectation-fivenum.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2 +4 +6 + + + + + + +setosa +versicolor +virginica +Species +Predicted value of Sepal.Width + +Petal.Width + + + + + + + + + + + + + + + +0.10 +0.30 +1.30 +1.80 +2.50 +plot-expectation-fivenum + + diff --git a/tests/testthat/_snaps/windows/plot/plot-glm-logistic-1.svg b/tests/testthat/_snaps/windows/plot/plot-glm-logistic-1.svg new file mode 100644 index 000000000..00a55d5a4 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-glm-logistic-1.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| + + + + + + + +0% +20% +40% +60% +80% +100% + + + + + + + + + + +2 +3 +4 +5 +wt +Probability of vs +plot-glm-logistic-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-glm-logistic-2.svg b/tests/testthat/_snaps/windows/plot/plot-glm-logistic-2.svg new file mode 100644 index 000000000..c0c1b4c7c --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-glm-logistic-2.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-5 +0 +5 + + + + + + + +2 +3 +4 +5 +wt +Mean of vs +plot-glm-logistic-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-grouplevel-lme4-1.svg b/tests/testthat/_snaps/windows/plot/plot-grouplevel-lme4-1.svg new file mode 100644 index 000000000..4d292c915 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-grouplevel-lme4-1.svg @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Newfactor: (Intercept) + + + + + + + + + + +Subject: (Intercept) + + + + + + + + + + +Subject: Days + + + + + +-4 +0 +4 + + + + + +-60 +-30 +0 +30 +60 + + + +-10 +0 +10 +308 +309 +310 +330 +331 +332 +333 +334 +335 +337 +349 +350 +351 +352 +369 +370 +371 +372 + + + + + + + + + + + + + + + + + + +308 +309 +310 +330 +331 +332 +333 +334 +335 +337 +349 +350 +351 +352 +369 +370 +371 +372 + + + + + + + + + + + + + + + + + + +A +B +C +D + + + + +Coefficient +Level +plot-grouplevel-lme4-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-grouplevel-lme4-2.svg b/tests/testthat/_snaps/windows/plot/plot-grouplevel-lme4-2.svg new file mode 100644 index 000000000..ceb4983a9 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-grouplevel-lme4-2.svg @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Newfactor: (Intercept) + + + + + + + + + + +Subject: (Intercept) + + + + + + + + + + +Subject: Days + + + + + +-4 +0 +4 + + + + + +-60 +-30 +0 +30 +60 + + + +-10 +0 +10 +308 +309 +310 +330 +331 +332 +333 +334 +335 +337 +349 +350 +351 +352 +369 +370 +371 +372 + + + + + + + + + + + + + + + + + + +308 +309 +310 +330 +331 +332 +333 +334 +335 +337 +349 +350 +351 +352 +369 +370 +371 +372 + + + + + + + + + + + + + + + + + + +A +B +C +D + + + + +Coefficient +Level +plot-grouplevel-lme4-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-join-dots-1.svg b/tests/testthat/_snaps/windows/plot/plot-join-dots-1.svg new file mode 100644 index 000000000..2566089d4 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-join-dots-1.svg @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 + + + + + + + + + +setosa +versicolor +virginica +Species +Predicted value of Sepal.Width + +Petal.Width + + + + + + + + + + + +0.5 +1.0 +1.5 +2.0 +2.5 +plot-join-dots-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-join-dots-2.svg b/tests/testthat/_snaps/windows/plot/plot-join-dots-2.svg new file mode 100644 index 000000000..93e57a716 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-join-dots-2.svg @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2 +4 +6 + + + + + + +setosa +versicolor +virginica +Species +Predicted value of Sepal.Width + +Petal.Width + + + + + + + + + + + +0.5 +1.0 +1.5 +2.0 +2.5 +plot-join-dots-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-logistic-bounds-1.svg b/tests/testthat/_snaps/windows/plot/plot-logistic-bounds-1.svg new file mode 100644 index 000000000..4772d6074 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-logistic-bounds-1.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +20% +40% +60% +80% +100% + + + + + + + + +2.79 +10.12 +17.44 +var2 +Probability of outcome + +var1 + + + + + + +0 +1 +plot-logistic-bounds-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-me-means-1.svg b/tests/testthat/_snaps/windows/plot/plot-me-means-1.svg new file mode 100644 index 000000000..d15e6d182 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-me-means-1.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4.5 +5.0 +5.5 +6.0 +6.5 + + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length +plot-me-means-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-me-means-2.svg b/tests/testthat/_snaps/windows/plot/plot-me-means-2.svg new file mode 100644 index 000000000..d0377c1f4 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-me-means-2.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +5.0 +5.5 +6.0 +6.5 +7.0 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Sepal.Length +plot-me-means-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-me-means-3.svg b/tests/testthat/_snaps/windows/plot/plot-me-means-3.svg new file mode 100644 index 000000000..401be0d6a --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-me-means-3.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Sepal.Length + +Species + + + + + + + + + +setosa +versicolor +virginica +plot-me-means-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-me-means-4.svg b/tests/testthat/_snaps/windows/plot/plot-me-means-4.svg new file mode 100644 index 000000000..deaf059f3 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-me-means-4.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-me-means-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-1.svg b/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-1.svg new file mode 100644 index 000000000..bd0227848 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-1.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +5 +6 +7 +8 + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length +plot-me-means-showdata-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-2.svg b/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-2.svg new file mode 100644 index 000000000..0ac4d565a --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-2.svg @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +5 +6 +7 +8 + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Sepal.Length +plot-me-means-showdata-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-3.svg b/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-3.svg new file mode 100644 index 000000000..a7b768c2b --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-3.svg @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Sepal.Length + +Species + + + + + + + + + + + + +setosa +versicolor +virginica +plot-me-means-showdata-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-4.svg b/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-4.svg new file mode 100644 index 000000000..a3d8e1efe --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-me-means-showdata-4.svg @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-me-means-showdata-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-1-lines.svg b/tests/testthat/_snaps/windows/plot/plot-means-1-lines.svg new file mode 100644 index 000000000..1556beb65 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-1-lines.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4.5 +5.0 +5.5 +6.0 +6.5 + + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length +plot-means-1-lines + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-1.svg b/tests/testthat/_snaps/windows/plot/plot-means-1.svg new file mode 100644 index 000000000..eb7838441 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-1.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4.5 +5.0 +5.5 +6.0 +6.5 + + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length +plot-means-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-2.svg b/tests/testthat/_snaps/windows/plot/plot-means-2.svg new file mode 100644 index 000000000..a22b8b6cf --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-2.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +5.0 +5.5 +6.0 +6.5 +7.0 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Sepal.Length +plot-means-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-3.svg b/tests/testthat/_snaps/windows/plot/plot-means-3.svg new file mode 100644 index 000000000..bf53ce774 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-3.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Sepal.Length + +Species + + + + + + + + + +setosa +versicolor +virginica +plot-means-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-4-lines.svg b/tests/testthat/_snaps/windows/plot/plot-means-4-lines.svg new file mode 100644 index 000000000..826a1aba6 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-4-lines.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-means-4-lines + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-4.svg b/tests/testthat/_snaps/windows/plot/plot-means-4.svg new file mode 100644 index 000000000..dbcd4fd75 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-4.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-means-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-poisson-1.svg b/tests/testthat/_snaps/windows/plot/plot-means-poisson-1.svg new file mode 100644 index 000000000..2cf82fd4b --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-poisson-1.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +2 +4 +6 +8 + + + + + + + + + +1 +2 +3 +4 +fa +Rate of y +plot-means-poisson-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-poisson-2.svg b/tests/testthat/_snaps/windows/plot/plot-means-poisson-2.svg new file mode 100644 index 000000000..e46a6e1fb --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-poisson-2.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +2 +4 +6 +8 + + + + + + + + + +1 +2 +3 +4 +fa +Mean of y +plot-means-poisson-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-1.svg b/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-1.svg new file mode 100644 index 000000000..9725d47ca --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-1.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2 +4 +6 + + + + + + +setosa +versicolor +virginica +Species +Mean of Petal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-means-predictor-order-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-2.svg b/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-2.svg new file mode 100644 index 000000000..73c39b7c5 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-2.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2 +4 +6 + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Petal.Length + +Species + + + + + + + + + +setosa +versicolor +virginica +plot-means-predictor-order-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-3.svg b/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-3.svg new file mode 100644 index 000000000..5069addfa --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-3.svg @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2 +4 +6 + + + + + + +setosa +versicolor +virginica +Species +Mean of Petal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-means-predictor-order-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-4.svg b/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-4.svg new file mode 100644 index 000000000..893710794 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-predictor-order-4.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2 +4 +6 + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Petal.Length + +Species + + + + + + + + + +setosa +versicolor +virginica +plot-means-predictor-order-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-showdata-1.svg b/tests/testthat/_snaps/windows/plot/plot-means-showdata-1.svg new file mode 100644 index 000000000..c8e42401d --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-showdata-1.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +5 +6 +7 +8 + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length +plot-means-showdata-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-showdata-2.svg b/tests/testthat/_snaps/windows/plot/plot-means-showdata-2.svg new file mode 100644 index 000000000..d74db5ea0 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-showdata-2.svg @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +5 +6 +7 +8 + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Sepal.Length +plot-means-showdata-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-showdata-3.svg b/tests/testthat/_snaps/windows/plot/plot-means-showdata-3.svg new file mode 100644 index 000000000..2f5a5d224 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-showdata-3.svg @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Mean of Sepal.Length + +Species + + + + + + + + + + + + +setosa +versicolor +virginica +plot-means-showdata-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-means-showdata-4.svg b/tests/testthat/_snaps/windows/plot/plot-means-showdata-4.svg new file mode 100644 index 000000000..12eccca75 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-means-showdata-4.svg @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + +setosa +versicolor +virginica +Species +Mean of Sepal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-means-showdata-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-1.svg b/tests/testthat/_snaps/windows/plot/plot-relation-1.svg new file mode 100644 index 000000000..0b106b4bd --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-1.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4.5 +5.0 +5.5 +6.0 +6.5 + + + + + + + + +setosa +versicolor +virginica +Species +Predicted value of Sepal.Length +plot-relation-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-2.svg b/tests/testthat/_snaps/windows/plot/plot-relation-2.svg new file mode 100644 index 000000000..769d82b04 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-2.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +3.5 +4.0 +4.5 +5.0 +5.5 +6.0 + + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Predicted value of Sepal.Length +plot-relation-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-3.svg b/tests/testthat/_snaps/windows/plot/plot-relation-3.svg new file mode 100644 index 000000000..660315dfd --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-3.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Predicted value of Sepal.Length + +Species + + + + + + + + + +setosa +versicolor +virginica +plot-relation-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-4.svg b/tests/testthat/_snaps/windows/plot/plot-relation-4.svg new file mode 100644 index 000000000..3a2910071 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-4.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 + + + + + + + +setosa +versicolor +virginica +Species +Predicted value of Sepal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-relation-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-logistic-percentage-1.svg b/tests/testthat/_snaps/windows/plot/plot-relation-logistic-percentage-1.svg new file mode 100644 index 000000000..89b3bcdd7 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-logistic-percentage-1.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +20% +40% +60% +80% +100% + + + + + + + + + +3000 +4000 +5000 +6000 +body_mass +Predicted value of sex +plot-relation-logistic-percentage-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-multiple-ci-1.svg b/tests/testthat/_snaps/windows/plot/plot-relation-multiple-ci-1.svg new file mode 100644 index 000000000..6e37260ee --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-multiple-ci-1.svg @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +10 +15 +20 +25 +30 +35 + + + + + + + + + + +16 +18 +20 +22 +qsec +Predicted value of mpg +plot-relation-multiple-ci-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-showdata-1.svg b/tests/testthat/_snaps/windows/plot/plot-relation-showdata-1.svg new file mode 100644 index 000000000..5404ec65b --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-showdata-1.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +5 +6 +7 +8 + + + + + + + +setosa +versicolor +virginica +Species +Predicted value of Sepal.Length +plot-relation-showdata-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-showdata-2.svg b/tests/testthat/_snaps/windows/plot/plot-relation-showdata-2.svg new file mode 100644 index 000000000..33c324fad --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-showdata-2.svg @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Predicted value of Sepal.Length +plot-relation-showdata-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-showdata-3.svg b/tests/testthat/_snaps/windows/plot/plot-relation-showdata-3.svg new file mode 100644 index 000000000..c0e6a2773 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-showdata-3.svg @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Predicted value of Sepal.Length + +Species + + + + + + + + + + + + +setosa +versicolor +virginica +plot-relation-showdata-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-relation-showdata-4.svg b/tests/testthat/_snaps/windows/plot/plot-relation-showdata-4.svg new file mode 100644 index 000000000..636c9d51c --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-relation-showdata-4.svg @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +4 +5 +6 +7 +8 + + + + + + + + +setosa +versicolor +virginica +Species +Predicted value of Sepal.Length + +Sepal.Width + + + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +plot-relation-showdata-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-slopes-1.svg b/tests/testthat/_snaps/windows/plot/plot-slopes-1.svg new file mode 100644 index 000000000..9c6614621 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-slopes-1.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 + + + + + + + +setosa +versicolor +virginica +Species +Slope of Petal.Length +plot-slopes-1 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-slopes-2.svg b/tests/testthat/_snaps/windows/plot/plot-slopes-2.svg new file mode 100644 index 000000000..235adf6fd --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-slopes-2.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-0.4 +-0.2 +0.0 +0.2 + + + + + + + + + + +0.0 +0.5 +1.0 +1.5 +2.0 +2.5 +Petal.Width +Slope of Petal.Length +plot-slopes-2 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-slopes-3.svg b/tests/testthat/_snaps/windows/plot/plot-slopes-3.svg new file mode 100644 index 000000000..9adf9d759 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-slopes-3.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 + + + + + + + +setosa +versicolor +virginica +Species +Slope of Petal.Length +plot-slopes-3 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-slopes-4.svg b/tests/testthat/_snaps/windows/plot/plot-slopes-4.svg new file mode 100644 index 000000000..a0b3fe3fb --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-slopes-4.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-0.4 +-0.2 +0.0 +0.2 + + + + + + + + + + +0.0 +0.5 +1.0 +1.5 +2.0 +2.5 +Petal.Width +Slope of Petal.Length + +p + + + + + + +not significant +significant +plot-slopes-4 + + diff --git a/tests/testthat/_snaps/windows/plot/plot-slopes-5.svg b/tests/testthat/_snaps/windows/plot/plot-slopes-5.svg new file mode 100644 index 000000000..9ac487747 --- /dev/null +++ b/tests/testthat/_snaps/windows/plot/plot-slopes-5.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1 +2 +3 + + + + + + + + + +2.0 +2.5 +3.0 +3.5 +4.0 +4.5 +Sepal.Width +Slope of Species + +Comparison + + + + + + +versicolor - setosa +virginica - setosa +plot-slopes-5 + + From 49a57cbbb33a648d6875d3a85d57b41fcef6d051 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 14:52:57 +0100 Subject: [PATCH 28/56] remove duplicates --- .../_snaps/plot/plot-4way-numeric-1.svg | 483 ------------------ .../_snaps/plot/plot-cat-num-predictor-1.svg | 55 -- .../_snaps/plot/plot-cat-num-predictor-2.svg | 55 -- .../_snaps/plot/plot-cat-num-predictor-3.svg | 57 --- .../_snaps/plot/plot-cat-num-predictor-4.svg | 57 --- .../_snaps/plot/plot-cat-num-predictor-5.svg | 57 --- .../_snaps/plot/plot-cat-num-predictor-6.svg | 59 --- .../_snaps/plot/plot-cat-num-predictor-7.svg | 59 --- .../_snaps/plot/plot-expectation-fivenum.svg | 101 ---- .../_snaps/plot/plot-glm-logistic-1.svg | 93 ---- .../_snaps/plot/plot-glm-logistic-2.svg | 55 -- .../_snaps/plot/plot-grouplevel-lme4-1.svg | 274 ---------- .../_snaps/plot/plot-grouplevel-lme4-2.svg | 274 ---------- .../testthat/_snaps/plot/plot-join-dots-1.svg | 243 --------- .../testthat/_snaps/plot/plot-join-dots-2.svg | 277 ---------- .../_snaps/plot/plot-logistic-bounds-1.svg | 75 --- .../testthat/_snaps/plot/plot-me-means-1.svg | 59 --- .../testthat/_snaps/plot/plot-me-means-2.svg | 63 --- .../testthat/_snaps/plot/plot-me-means-3.svg | 85 --- .../testthat/_snaps/plot/plot-me-means-4.svg | 131 ----- .../_snaps/plot/plot-me-means-showdata-1.svg | 207 -------- .../_snaps/plot/plot-me-means-showdata-2.svg | 211 -------- .../_snaps/plot/plot-me-means-showdata-3.svg | 238 --------- .../_snaps/plot/plot-me-means-showdata-4.svg | 281 ---------- .../_snaps/plot/plot-means-1-lines.svg | 60 --- tests/testthat/_snaps/plot/plot-means-1.svg | 59 --- tests/testthat/_snaps/plot/plot-means-2.svg | 63 --- tests/testthat/_snaps/plot/plot-means-3.svg | 85 --- .../_snaps/plot/plot-means-4-lines.svg | 141 ----- tests/testthat/_snaps/plot/plot-means-4.svg | 131 ----- .../_snaps/plot/plot-means-poisson-1.svg | 163 ------ .../_snaps/plot/plot-means-poisson-2.svg | 163 ------ .../plot/plot-means-predictor-order-1.svg | 127 ----- .../plot/plot-means-predictor-order-2.svg | 81 --- .../plot/plot-means-predictor-order-3.svg | 127 ----- .../plot/plot-means-predictor-order-4.svg | 81 --- .../_snaps/plot/plot-means-showdata-1.svg | 207 -------- .../_snaps/plot/plot-means-showdata-2.svg | 211 -------- .../_snaps/plot/plot-means-showdata-3.svg | 238 --------- .../_snaps/plot/plot-means-showdata-4.svg | 281 ---------- .../testthat/_snaps/plot/plot-relation-1.svg | 59 --- .../testthat/_snaps/plot/plot-relation-2.svg | 65 --- .../testthat/_snaps/plot/plot-relation-3.svg | 83 --- .../testthat/_snaps/plot/plot-relation-4.svg | 109 ---- .../plot-relation-logistic-percentage-1.svg | 59 --- .../plot/plot-relation-multiple-ci-1.svg | 99 ---- .../_snaps/plot/plot-relation-showdata-1.svg | 207 -------- .../_snaps/plot/plot-relation-showdata-2.svg | 213 -------- .../_snaps/plot/plot-relation-showdata-3.svg | 238 --------- .../_snaps/plot/plot-relation-showdata-4.svg | 261 ---------- tests/testthat/_snaps/plot/plot-slopes-1.svg | 58 --- tests/testthat/_snaps/plot/plot-slopes-2.svg | 62 --- tests/testthat/_snaps/plot/plot-slopes-3.svg | 58 --- tests/testthat/_snaps/plot/plot-slopes-4.svg | 82 --- tests/testthat/_snaps/plot/plot-slopes-5.svg | 75 --- 55 files changed, 7495 deletions(-) delete mode 100644 tests/testthat/_snaps/plot/plot-4way-numeric-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-cat-num-predictor-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-cat-num-predictor-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-cat-num-predictor-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-cat-num-predictor-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-cat-num-predictor-5.svg delete mode 100644 tests/testthat/_snaps/plot/plot-cat-num-predictor-6.svg delete mode 100644 tests/testthat/_snaps/plot/plot-cat-num-predictor-7.svg delete mode 100644 tests/testthat/_snaps/plot/plot-expectation-fivenum.svg delete mode 100644 tests/testthat/_snaps/plot/plot-glm-logistic-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-glm-logistic-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-grouplevel-lme4-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-grouplevel-lme4-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-join-dots-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-join-dots-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-logistic-bounds-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-me-means-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-me-means-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-me-means-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-me-means-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-me-means-showdata-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-me-means-showdata-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-me-means-showdata-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-me-means-showdata-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-1-lines.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-4-lines.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-poisson-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-poisson-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-predictor-order-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-predictor-order-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-predictor-order-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-predictor-order-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-showdata-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-showdata-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-showdata-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-means-showdata-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-logistic-percentage-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-multiple-ci-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-showdata-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-showdata-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-showdata-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-relation-showdata-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-slopes-1.svg delete mode 100644 tests/testthat/_snaps/plot/plot-slopes-2.svg delete mode 100644 tests/testthat/_snaps/plot/plot-slopes-3.svg delete mode 100644 tests/testthat/_snaps/plot/plot-slopes-4.svg delete mode 100644 tests/testthat/_snaps/plot/plot-slopes-5.svg diff --git a/tests/testthat/_snaps/plot/plot-4way-numeric-1.svg b/tests/testthat/_snaps/plot/plot-4way-numeric-1.svg deleted file mode 100644 index 0afc50619..000000000 --- a/tests/testthat/_snaps/plot/plot-4way-numeric-1.svg +++ /dev/null @@ -1,483 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -low - - - - - - - - - - -mid - - - - - - - - - - -high - - - - - - - - - - -0 - - - - - - - - - - -45 - - - - - - - - - - -70 - - - - - - - - - - -90 - - - - - - - - - - -100 - - - - - - -0 -50 -100 -150 - - - - -0 -50 -100 -150 - - - - -0 -50 -100 -150 -7.5 -10.0 -12.5 -15.0 -17.5 - - - - - -7.5 -10.0 -12.5 -15.0 -17.5 - - - - - -7.5 -10.0 -12.5 -15.0 -17.5 - - - - - -7.5 -10.0 -12.5 -15.0 -17.5 - - - - - -7.5 -10.0 -12.5 -15.0 -17.5 - - - - - -average number of hours of care per week -Mean of Negative impact with 7 items - -carer's gender - - - - - - -Male -Female -plot-4way-numeric-1 - - diff --git a/tests/testthat/_snaps/plot/plot-cat-num-predictor-1.svg b/tests/testthat/_snaps/plot/plot-cat-num-predictor-1.svg deleted file mode 100644 index df26d80d0..000000000 --- a/tests/testthat/_snaps/plot/plot-cat-num-predictor-1.svg +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -15 -20 -25 - - - - - - -4 -6 -8 -cyl -Predicted value of mpg -plot-cat-num-predictor-1 - - diff --git a/tests/testthat/_snaps/plot/plot-cat-num-predictor-2.svg b/tests/testthat/_snaps/plot/plot-cat-num-predictor-2.svg deleted file mode 100644 index d001ba61c..000000000 --- a/tests/testthat/_snaps/plot/plot-cat-num-predictor-2.svg +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -15 -20 -25 - - - - - - -4 -6 -8 -cyl -Mean of mpg -plot-cat-num-predictor-2 - - diff --git a/tests/testthat/_snaps/plot/plot-cat-num-predictor-3.svg b/tests/testthat/_snaps/plot/plot-cat-num-predictor-3.svg deleted file mode 100644 index 65afbf233..000000000 --- a/tests/testthat/_snaps/plot/plot-cat-num-predictor-3.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -16 -20 -24 -28 - - - - - - - -4 -6 -8 -cyl -Predicted value of mpg -plot-cat-num-predictor-3 - - diff --git a/tests/testthat/_snaps/plot/plot-cat-num-predictor-4.svg b/tests/testthat/_snaps/plot/plot-cat-num-predictor-4.svg deleted file mode 100644 index 085ae2b4a..000000000 --- a/tests/testthat/_snaps/plot/plot-cat-num-predictor-4.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -16 -20 -24 -28 - - - - - - - -4 -6 -8 -cyl -Mean of mpg -plot-cat-num-predictor-4 - - diff --git a/tests/testthat/_snaps/plot/plot-cat-num-predictor-5.svg b/tests/testthat/_snaps/plot/plot-cat-num-predictor-5.svg deleted file mode 100644 index 0886f7f9f..000000000 --- a/tests/testthat/_snaps/plot/plot-cat-num-predictor-5.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -16 -20 -24 -28 - - - - - - - -4 -6 -8 -cyl -Predicted value of mpg -plot-cat-num-predictor-5 - - diff --git a/tests/testthat/_snaps/plot/plot-cat-num-predictor-6.svg b/tests/testthat/_snaps/plot/plot-cat-num-predictor-6.svg deleted file mode 100644 index 50426e3bb..000000000 --- a/tests/testthat/_snaps/plot/plot-cat-num-predictor-6.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -12 -14 -16 - - - - - - - - - -0 -25 -50 -75 -100 -Total score BARTHEL INDEX -Mean of Negative impact with 7 items -plot-cat-num-predictor-6 - - diff --git a/tests/testthat/_snaps/plot/plot-cat-num-predictor-7.svg b/tests/testthat/_snaps/plot/plot-cat-num-predictor-7.svg deleted file mode 100644 index 76758da06..000000000 --- a/tests/testthat/_snaps/plot/plot-cat-num-predictor-7.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -12 -14 -16 - - - - - - - - - -0 -25 -50 -75 -100 -Total score BARTHEL INDEX -Mean of Negative impact with 7 items -plot-cat-num-predictor-7 - - diff --git a/tests/testthat/_snaps/plot/plot-expectation-fivenum.svg b/tests/testthat/_snaps/plot/plot-expectation-fivenum.svg deleted file mode 100644 index 9b8592cb4..000000000 --- a/tests/testthat/_snaps/plot/plot-expectation-fivenum.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 -4 -6 - - - - - - -setosa -versicolor -virginica -Species -Predicted value of Sepal.Width - -Petal.Width - - - - - - - - - - - - - - - -0.10 -0.30 -1.30 -1.80 -2.50 -plot-expectation-fivenum - - diff --git a/tests/testthat/_snaps/plot/plot-glm-logistic-1.svg b/tests/testthat/_snaps/plot/plot-glm-logistic-1.svg deleted file mode 100644 index 00a55d5a4..000000000 --- a/tests/testthat/_snaps/plot/plot-glm-logistic-1.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| - - - - - - - -0% -20% -40% -60% -80% -100% - - - - - - - - - - -2 -3 -4 -5 -wt -Probability of vs -plot-glm-logistic-1 - - diff --git a/tests/testthat/_snaps/plot/plot-glm-logistic-2.svg b/tests/testthat/_snaps/plot/plot-glm-logistic-2.svg deleted file mode 100644 index c0c1b4c7c..000000000 --- a/tests/testthat/_snaps/plot/plot-glm-logistic-2.svg +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - --5 -0 -5 - - - - - - - -2 -3 -4 -5 -wt -Mean of vs -plot-glm-logistic-2 - - diff --git a/tests/testthat/_snaps/plot/plot-grouplevel-lme4-1.svg b/tests/testthat/_snaps/plot/plot-grouplevel-lme4-1.svg deleted file mode 100644 index 4d292c915..000000000 --- a/tests/testthat/_snaps/plot/plot-grouplevel-lme4-1.svg +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Newfactor: (Intercept) - - - - - - - - - - -Subject: (Intercept) - - - - - - - - - - -Subject: Days - - - - - --4 -0 -4 - - - - - --60 --30 -0 -30 -60 - - - --10 -0 -10 -308 -309 -310 -330 -331 -332 -333 -334 -335 -337 -349 -350 -351 -352 -369 -370 -371 -372 - - - - - - - - - - - - - - - - - - -308 -309 -310 -330 -331 -332 -333 -334 -335 -337 -349 -350 -351 -352 -369 -370 -371 -372 - - - - - - - - - - - - - - - - - - -A -B -C -D - - - - -Coefficient -Level -plot-grouplevel-lme4-1 - - diff --git a/tests/testthat/_snaps/plot/plot-grouplevel-lme4-2.svg b/tests/testthat/_snaps/plot/plot-grouplevel-lme4-2.svg deleted file mode 100644 index ceb4983a9..000000000 --- a/tests/testthat/_snaps/plot/plot-grouplevel-lme4-2.svg +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Newfactor: (Intercept) - - - - - - - - - - -Subject: (Intercept) - - - - - - - - - - -Subject: Days - - - - - --4 -0 -4 - - - - - --60 --30 -0 -30 -60 - - - --10 -0 -10 -308 -309 -310 -330 -331 -332 -333 -334 -335 -337 -349 -350 -351 -352 -369 -370 -371 -372 - - - - - - - - - - - - - - - - - - -308 -309 -310 -330 -331 -332 -333 -334 -335 -337 -349 -350 -351 -352 -369 -370 -371 -372 - - - - - - - - - - - - - - - - - - -A -B -C -D - - - - -Coefficient -Level -plot-grouplevel-lme4-2 - - diff --git a/tests/testthat/_snaps/plot/plot-join-dots-1.svg b/tests/testthat/_snaps/plot/plot-join-dots-1.svg deleted file mode 100644 index 2566089d4..000000000 --- a/tests/testthat/_snaps/plot/plot-join-dots-1.svg +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 - - - - - - - - - -setosa -versicolor -virginica -Species -Predicted value of Sepal.Width - -Petal.Width - - - - - - - - - - - -0.5 -1.0 -1.5 -2.0 -2.5 -plot-join-dots-1 - - diff --git a/tests/testthat/_snaps/plot/plot-join-dots-2.svg b/tests/testthat/_snaps/plot/plot-join-dots-2.svg deleted file mode 100644 index 93e57a716..000000000 --- a/tests/testthat/_snaps/plot/plot-join-dots-2.svg +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 -4 -6 - - - - - - -setosa -versicolor -virginica -Species -Predicted value of Sepal.Width - -Petal.Width - - - - - - - - - - - -0.5 -1.0 -1.5 -2.0 -2.5 -plot-join-dots-2 - - diff --git a/tests/testthat/_snaps/plot/plot-logistic-bounds-1.svg b/tests/testthat/_snaps/plot/plot-logistic-bounds-1.svg deleted file mode 100644 index 4772d6074..000000000 --- a/tests/testthat/_snaps/plot/plot-logistic-bounds-1.svg +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -20% -40% -60% -80% -100% - - - - - - - - -2.79 -10.12 -17.44 -var2 -Probability of outcome - -var1 - - - - - - -0 -1 -plot-logistic-bounds-1 - - diff --git a/tests/testthat/_snaps/plot/plot-me-means-1.svg b/tests/testthat/_snaps/plot/plot-me-means-1.svg deleted file mode 100644 index d15e6d182..000000000 --- a/tests/testthat/_snaps/plot/plot-me-means-1.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4.5 -5.0 -5.5 -6.0 -6.5 - - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length -plot-me-means-1 - - diff --git a/tests/testthat/_snaps/plot/plot-me-means-2.svg b/tests/testthat/_snaps/plot/plot-me-means-2.svg deleted file mode 100644 index d0377c1f4..000000000 --- a/tests/testthat/_snaps/plot/plot-me-means-2.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -5.0 -5.5 -6.0 -6.5 -7.0 - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Sepal.Length -plot-me-means-2 - - diff --git a/tests/testthat/_snaps/plot/plot-me-means-3.svg b/tests/testthat/_snaps/plot/plot-me-means-3.svg deleted file mode 100644 index 401be0d6a..000000000 --- a/tests/testthat/_snaps/plot/plot-me-means-3.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Sepal.Length - -Species - - - - - - - - - -setosa -versicolor -virginica -plot-me-means-3 - - diff --git a/tests/testthat/_snaps/plot/plot-me-means-4.svg b/tests/testthat/_snaps/plot/plot-me-means-4.svg deleted file mode 100644 index deaf059f3..000000000 --- a/tests/testthat/_snaps/plot/plot-me-means-4.svg +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-me-means-4 - - diff --git a/tests/testthat/_snaps/plot/plot-me-means-showdata-1.svg b/tests/testthat/_snaps/plot/plot-me-means-showdata-1.svg deleted file mode 100644 index bd0227848..000000000 --- a/tests/testthat/_snaps/plot/plot-me-means-showdata-1.svg +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -5 -6 -7 -8 - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length -plot-me-means-showdata-1 - - diff --git a/tests/testthat/_snaps/plot/plot-me-means-showdata-2.svg b/tests/testthat/_snaps/plot/plot-me-means-showdata-2.svg deleted file mode 100644 index 0ac4d565a..000000000 --- a/tests/testthat/_snaps/plot/plot-me-means-showdata-2.svg +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -5 -6 -7 -8 - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Sepal.Length -plot-me-means-showdata-2 - - diff --git a/tests/testthat/_snaps/plot/plot-me-means-showdata-3.svg b/tests/testthat/_snaps/plot/plot-me-means-showdata-3.svg deleted file mode 100644 index a7b768c2b..000000000 --- a/tests/testthat/_snaps/plot/plot-me-means-showdata-3.svg +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Sepal.Length - -Species - - - - - - - - - - - - -setosa -versicolor -virginica -plot-me-means-showdata-3 - - diff --git a/tests/testthat/_snaps/plot/plot-me-means-showdata-4.svg b/tests/testthat/_snaps/plot/plot-me-means-showdata-4.svg deleted file mode 100644 index a3d8e1efe..000000000 --- a/tests/testthat/_snaps/plot/plot-me-means-showdata-4.svg +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-me-means-showdata-4 - - diff --git a/tests/testthat/_snaps/plot/plot-means-1-lines.svg b/tests/testthat/_snaps/plot/plot-means-1-lines.svg deleted file mode 100644 index 1556beb65..000000000 --- a/tests/testthat/_snaps/plot/plot-means-1-lines.svg +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4.5 -5.0 -5.5 -6.0 -6.5 - - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length -plot-means-1-lines - - diff --git a/tests/testthat/_snaps/plot/plot-means-1.svg b/tests/testthat/_snaps/plot/plot-means-1.svg deleted file mode 100644 index eb7838441..000000000 --- a/tests/testthat/_snaps/plot/plot-means-1.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4.5 -5.0 -5.5 -6.0 -6.5 - - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length -plot-means-1 - - diff --git a/tests/testthat/_snaps/plot/plot-means-2.svg b/tests/testthat/_snaps/plot/plot-means-2.svg deleted file mode 100644 index a22b8b6cf..000000000 --- a/tests/testthat/_snaps/plot/plot-means-2.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -5.0 -5.5 -6.0 -6.5 -7.0 - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Sepal.Length -plot-means-2 - - diff --git a/tests/testthat/_snaps/plot/plot-means-3.svg b/tests/testthat/_snaps/plot/plot-means-3.svg deleted file mode 100644 index bf53ce774..000000000 --- a/tests/testthat/_snaps/plot/plot-means-3.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Sepal.Length - -Species - - - - - - - - - -setosa -versicolor -virginica -plot-means-3 - - diff --git a/tests/testthat/_snaps/plot/plot-means-4-lines.svg b/tests/testthat/_snaps/plot/plot-means-4-lines.svg deleted file mode 100644 index 826a1aba6..000000000 --- a/tests/testthat/_snaps/plot/plot-means-4-lines.svg +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-means-4-lines - - diff --git a/tests/testthat/_snaps/plot/plot-means-4.svg b/tests/testthat/_snaps/plot/plot-means-4.svg deleted file mode 100644 index dbcd4fd75..000000000 --- a/tests/testthat/_snaps/plot/plot-means-4.svg +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-means-4 - - diff --git a/tests/testthat/_snaps/plot/plot-means-poisson-1.svg b/tests/testthat/_snaps/plot/plot-means-poisson-1.svg deleted file mode 100644 index 2cf82fd4b..000000000 --- a/tests/testthat/_snaps/plot/plot-means-poisson-1.svg +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 -2 -4 -6 -8 - - - - - - - - - -1 -2 -3 -4 -fa -Rate of y -plot-means-poisson-1 - - diff --git a/tests/testthat/_snaps/plot/plot-means-poisson-2.svg b/tests/testthat/_snaps/plot/plot-means-poisson-2.svg deleted file mode 100644 index e46a6e1fb..000000000 --- a/tests/testthat/_snaps/plot/plot-means-poisson-2.svg +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 -2 -4 -6 -8 - - - - - - - - - -1 -2 -3 -4 -fa -Mean of y -plot-means-poisson-2 - - diff --git a/tests/testthat/_snaps/plot/plot-means-predictor-order-1.svg b/tests/testthat/_snaps/plot/plot-means-predictor-order-1.svg deleted file mode 100644 index 9725d47ca..000000000 --- a/tests/testthat/_snaps/plot/plot-means-predictor-order-1.svg +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 -4 -6 - - - - - - -setosa -versicolor -virginica -Species -Mean of Petal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-means-predictor-order-1 - - diff --git a/tests/testthat/_snaps/plot/plot-means-predictor-order-2.svg b/tests/testthat/_snaps/plot/plot-means-predictor-order-2.svg deleted file mode 100644 index 73c39b7c5..000000000 --- a/tests/testthat/_snaps/plot/plot-means-predictor-order-2.svg +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 -4 -6 - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Petal.Length - -Species - - - - - - - - - -setosa -versicolor -virginica -plot-means-predictor-order-2 - - diff --git a/tests/testthat/_snaps/plot/plot-means-predictor-order-3.svg b/tests/testthat/_snaps/plot/plot-means-predictor-order-3.svg deleted file mode 100644 index 5069addfa..000000000 --- a/tests/testthat/_snaps/plot/plot-means-predictor-order-3.svg +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 -4 -6 - - - - - - -setosa -versicolor -virginica -Species -Mean of Petal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-means-predictor-order-3 - - diff --git a/tests/testthat/_snaps/plot/plot-means-predictor-order-4.svg b/tests/testthat/_snaps/plot/plot-means-predictor-order-4.svg deleted file mode 100644 index 893710794..000000000 --- a/tests/testthat/_snaps/plot/plot-means-predictor-order-4.svg +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -2 -4 -6 - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Petal.Length - -Species - - - - - - - - - -setosa -versicolor -virginica -plot-means-predictor-order-4 - - diff --git a/tests/testthat/_snaps/plot/plot-means-showdata-1.svg b/tests/testthat/_snaps/plot/plot-means-showdata-1.svg deleted file mode 100644 index c8e42401d..000000000 --- a/tests/testthat/_snaps/plot/plot-means-showdata-1.svg +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -5 -6 -7 -8 - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length -plot-means-showdata-1 - - diff --git a/tests/testthat/_snaps/plot/plot-means-showdata-2.svg b/tests/testthat/_snaps/plot/plot-means-showdata-2.svg deleted file mode 100644 index d74db5ea0..000000000 --- a/tests/testthat/_snaps/plot/plot-means-showdata-2.svg +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -5 -6 -7 -8 - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Sepal.Length -plot-means-showdata-2 - - diff --git a/tests/testthat/_snaps/plot/plot-means-showdata-3.svg b/tests/testthat/_snaps/plot/plot-means-showdata-3.svg deleted file mode 100644 index 2f5a5d224..000000000 --- a/tests/testthat/_snaps/plot/plot-means-showdata-3.svg +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Mean of Sepal.Length - -Species - - - - - - - - - - - - -setosa -versicolor -virginica -plot-means-showdata-3 - - diff --git a/tests/testthat/_snaps/plot/plot-means-showdata-4.svg b/tests/testthat/_snaps/plot/plot-means-showdata-4.svg deleted file mode 100644 index 12eccca75..000000000 --- a/tests/testthat/_snaps/plot/plot-means-showdata-4.svg +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - -setosa -versicolor -virginica -Species -Mean of Sepal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-means-showdata-4 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-1.svg b/tests/testthat/_snaps/plot/plot-relation-1.svg deleted file mode 100644 index 0b106b4bd..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-1.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4.5 -5.0 -5.5 -6.0 -6.5 - - - - - - - - -setosa -versicolor -virginica -Species -Predicted value of Sepal.Length -plot-relation-1 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-2.svg b/tests/testthat/_snaps/plot/plot-relation-2.svg deleted file mode 100644 index 769d82b04..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-2.svg +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -3.5 -4.0 -4.5 -5.0 -5.5 -6.0 - - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Predicted value of Sepal.Length -plot-relation-2 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-3.svg b/tests/testthat/_snaps/plot/plot-relation-3.svg deleted file mode 100644 index 660315dfd..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-3.svg +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Predicted value of Sepal.Length - -Species - - - - - - - - - -setosa -versicolor -virginica -plot-relation-3 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-4.svg b/tests/testthat/_snaps/plot/plot-relation-4.svg deleted file mode 100644 index 3a2910071..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-4.svg +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 - - - - - - - -setosa -versicolor -virginica -Species -Predicted value of Sepal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-relation-4 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-logistic-percentage-1.svg b/tests/testthat/_snaps/plot/plot-relation-logistic-percentage-1.svg deleted file mode 100644 index 89b3bcdd7..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-logistic-percentage-1.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -20% -40% -60% -80% -100% - - - - - - - - - -3000 -4000 -5000 -6000 -body_mass -Predicted value of sex -plot-relation-logistic-percentage-1 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-multiple-ci-1.svg b/tests/testthat/_snaps/plot/plot-relation-multiple-ci-1.svg deleted file mode 100644 index 6e37260ee..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-multiple-ci-1.svg +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 -30 -35 - - - - - - - - - - -16 -18 -20 -22 -qsec -Predicted value of mpg -plot-relation-multiple-ci-1 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-showdata-1.svg b/tests/testthat/_snaps/plot/plot-relation-showdata-1.svg deleted file mode 100644 index 5404ec65b..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-showdata-1.svg +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -5 -6 -7 -8 - - - - - - - -setosa -versicolor -virginica -Species -Predicted value of Sepal.Length -plot-relation-showdata-1 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-showdata-2.svg b/tests/testthat/_snaps/plot/plot-relation-showdata-2.svg deleted file mode 100644 index 33c324fad..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-showdata-2.svg +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Predicted value of Sepal.Length -plot-relation-showdata-2 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-showdata-3.svg b/tests/testthat/_snaps/plot/plot-relation-showdata-3.svg deleted file mode 100644 index c0e6a2773..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-showdata-3.svg +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Predicted value of Sepal.Length - -Species - - - - - - - - - - - - -setosa -versicolor -virginica -plot-relation-showdata-3 - - diff --git a/tests/testthat/_snaps/plot/plot-relation-showdata-4.svg b/tests/testthat/_snaps/plot/plot-relation-showdata-4.svg deleted file mode 100644 index 636c9d51c..000000000 --- a/tests/testthat/_snaps/plot/plot-relation-showdata-4.svg +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -4 -5 -6 -7 -8 - - - - - - - - -setosa -versicolor -virginica -Species -Predicted value of Sepal.Length - -Sepal.Width - - - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -plot-relation-showdata-4 - - diff --git a/tests/testthat/_snaps/plot/plot-slopes-1.svg b/tests/testthat/_snaps/plot/plot-slopes-1.svg deleted file mode 100644 index 9c6614621..000000000 --- a/tests/testthat/_snaps/plot/plot-slopes-1.svg +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 - - - - - - - -setosa -versicolor -virginica -Species -Slope of Petal.Length -plot-slopes-1 - - diff --git a/tests/testthat/_snaps/plot/plot-slopes-2.svg b/tests/testthat/_snaps/plot/plot-slopes-2.svg deleted file mode 100644 index 235adf6fd..000000000 --- a/tests/testthat/_snaps/plot/plot-slopes-2.svg +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --0.4 --0.2 -0.0 -0.2 - - - - - - - - - - -0.0 -0.5 -1.0 -1.5 -2.0 -2.5 -Petal.Width -Slope of Petal.Length -plot-slopes-2 - - diff --git a/tests/testthat/_snaps/plot/plot-slopes-3.svg b/tests/testthat/_snaps/plot/plot-slopes-3.svg deleted file mode 100644 index 9adf9d759..000000000 --- a/tests/testthat/_snaps/plot/plot-slopes-3.svg +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 - - - - - - - -setosa -versicolor -virginica -Species -Slope of Petal.Length -plot-slopes-3 - - diff --git a/tests/testthat/_snaps/plot/plot-slopes-4.svg b/tests/testthat/_snaps/plot/plot-slopes-4.svg deleted file mode 100644 index a0b3fe3fb..000000000 --- a/tests/testthat/_snaps/plot/plot-slopes-4.svg +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --0.4 --0.2 -0.0 -0.2 - - - - - - - - - - -0.0 -0.5 -1.0 -1.5 -2.0 -2.5 -Petal.Width -Slope of Petal.Length - -p - - - - - - -not significant -significant -plot-slopes-4 - - diff --git a/tests/testthat/_snaps/plot/plot-slopes-5.svg b/tests/testthat/_snaps/plot/plot-slopes-5.svg deleted file mode 100644 index 9ac487747..000000000 --- a/tests/testthat/_snaps/plot/plot-slopes-5.svg +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1 -2 -3 - - - - - - - - - -2.0 -2.5 -3.0 -3.5 -4.0 -4.5 -Sepal.Width -Slope of Species - -Comparison - - - - - - -versicolor - setosa -virginica - setosa -plot-slopes-5 - - From ae953ab5ffda31b394f1cc16b45a533ab84b894b Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 15:41:20 +0100 Subject: [PATCH 29/56] address comments --- R/table_footer.R | 51 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/R/table_footer.R b/R/table_footer.R index b1ea6f4cf..676b86a9e 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -54,6 +54,9 @@ if (!is.null(ref_cat_data)) { # get values at which non-focal terms are hold constant adjusted_values <- lapply(adjusted_for, function(i) ref_cat_data[[i]][1]) + # if we have values at which non-focal terms are held constant, we want + # them in a separate string; same for predictors we average over + averaged_over <- held_constant <- list() # at values to names of non-focal terms (table_footer). we have to iterate # over the list, because we may have different types of data for (av in seq_along(adjusted_values)) { @@ -63,26 +66,52 @@ adjusted_for[av], adjusted_values[[av]] ) + # add to final list + held_constant <- c(held_constant, adjusted_for[av]) } else if (identical(type, "predictions")) { adjusted_for[av] <- sprintf("%s (%s)", adjusted_for[av], adjusted_values[[av]]) + # add to final list + held_constant <- c(held_constant, adjusted_for[av]) + } else { + # add to final list - we have factors that are averaged over levels, + # not hold constant at a certain level + averaged_over <- c(averaged_over, adjusted_for[av]) } } } - # The "predictors averaged" line does not strictly apply to marginal - # predictions like `estimate = "average"` or `estimate = "population"`, - # because we average across all predictions, we do not take an "average - # value" of a non-focal predictor. Thus, we skip this line in the footer + + # convert to strings + held_constant <- unlist(held_constant, use.names = FALSE) + averaged_over <- unlist(averaged_over, use.names = FALSE) + + # first, information about non-focal terms that were hold constant at + # specific values or levels + if (!is.null(held_constant)) { + table_footer <- paste0( + table_footer, + paste0("\nPredictors held at: ", toString(held_constant)) + ) + } + + # then, information about non-focal terms that were averaged over levels + # or within groups if ( - is.null(marginalization) || - !marginalization %in% c("average", "population", "counterfactual") + !is.null(averaged_over) && !is.null(marginalization) && length(marginalization) == 1 ) { - average_string <- switch(type, predictions = "controlled", "averaged") + average_string <- paste( + "Predictors averaged", + switch( + marginalization, + typical = "(balanced)", + average = "(within groups)", + population = , + counterfactual = "(full sample)", + "" + ) + ) table_footer <- paste0( table_footer, - "\nPredictors ", - average_string, - ": ", - toString(adjusted_for) + paste0("\n", average_string, ": ", toString(averaged_over)) ) } } From 58df7955ff587c9754350117d97dd01a273d4d35 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 17:19:21 +0100 Subject: [PATCH 30/56] handle mixed models --- R/get_marginalcontrasts.R | 16 +++++++++++++--- R/get_marginalmeans.R | 32 +++++++++++++++++++++++++++++--- R/table_footer.R | 2 +- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/R/get_marginalcontrasts.R b/R/get_marginalcontrasts.R index f5fa89edf..26a52636c 100644 --- a/R/get_marginalcontrasts.R +++ b/R/get_marginalcontrasts.R @@ -135,7 +135,10 @@ get_marginalcontrasts <- function( } else { slope_filter <- .parse_by_filter(my_args$by) } - slope_filter <- .present_filter_values(insight::get_data(model, verbose = FALSE), slope_filter) + slope_filter <- .present_filter_values( + insight::get_data(model, verbose = FALSE), + slope_filter + ) # sanity check - we need at least two slopes to compare. We use the # original `by`, because a group in a `comparison` formula replaces it if ( @@ -244,7 +247,11 @@ get_marginalcontrasts <- function( context_effects = my_args$context_effects, iterations = iterations, keep_iterations = keep_iterations - ) + ), + # some additional information for mixed models + response = insight::find_response(model, combine = FALSE), + re_intercept = insight::find_random(model, flatten = TRUE, split_nested = TRUE), + no_re_intercept = !is.null(dots$re.form) && is.na(dots$re.form) ) out <- .rename_focal_attributes(out) @@ -319,7 +326,10 @@ get_marginalcontrasts <- function( .parse_by_filter <- function(by) { by_filter <- list() for (i in by[grepl("=", by, fixed = TRUE)]) { - filter_value <- insight::trim_ws(unlist(strsplit(i, "=", fixed = TRUE), use.names = FALSE)) + filter_value <- insight::trim_ws(unlist( + strsplit(i, "=", fixed = TRUE), + use.names = FALSE + )) if (length(filter_value) > 1) { value <- .safe(eval(str2lang(filter_value[2]))) if (!is.null(value)) { diff --git a/R/get_marginalmeans.R b/R/get_marginalmeans.R index 4138f5ed0..92b6f4039 100644 --- a/R/get_marginalmeans.R +++ b/R/get_marginalmeans.R @@ -329,7 +329,11 @@ get_marginalmeans <- function( vcov = vcov_means, equivalence = dots$equivalence ) - ) + ), + # some additional information for mixed models + response = insight::find_response(model, combine = FALSE), + re_intercept = insight::find_random(model, flatten = TRUE, split_nested = TRUE), + no_re_intercept = !is.null(dots$re.form) && is.na(dots$re.form) ) class(means) <- unique(c("marginaleffects_means", class(means))) @@ -673,7 +677,15 @@ get_marginalmeans <- function( # - renamed_focal: focal terms with the name of an output column, named by # their old names, with the new names ".1" as values #' @keywords internal -.add_attributes <- function(x, by = NULL, model_info = NULL, info = NULL) { +.add_attributes <- function( + x, + by = NULL, + model_info = NULL, + info = NULL, + response = NULL, + re_intercept = NULL, + no_re_intercept = FALSE +) { attr(x, "at") <- by attr(x, "by") <- by attr(x, "model_info") <- model_info @@ -681,6 +693,20 @@ get_marginalmeans <- function( # compact list info <- insight::compact_list(info) + # some special handling for mixed models + if (isTRUE(model_info$is_mixed)) { + # if we have mixed models, we don't want the response in the adusted-for + # information, so we check and remove it here, if necessary + if (!is.null(info$adjusted_for) && !is.null(response)) { + info$adjusted_for <- setdiff(info$adjusted_for, response) + } + # if we have mixed models, and re.form = NA, we want to remove the random + # intercept from the footer + if (isTRUE(no_re_intercept)) { + info$adjusted_for <- setdiff(info$adjusted_for, re_intercept) + } + } + if (!is.null(info) && length(info)) { if (!is.null(info$at_specs$varname)) { attr(x, "focal_terms") <- info$at_specs$varname @@ -704,7 +730,7 @@ get_marginalmeans <- function( "contrast", "estimate", "p_adjust", "transform", "transform_arg", "datagrid", "preserve_range", "coef_name", "slope", "ci", "model_info", "contrast_filter", "null", "iterations", "keep_iterations", "joint_test", "omnibus_test", "vcov", - "equivalence", "context_effects", "renamed_focal" + "equivalence", "context_effects", "renamed_focal", "re_intercept" ) } diff --git a/R/table_footer.R b/R/table_footer.R index 676b86a9e..f44b8153f 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -99,7 +99,7 @@ !is.null(averaged_over) && !is.null(marginalization) && length(marginalization) == 1 ) { average_string <- paste( - "Predictors averaged", + "Predictors averaged over", switch( marginalization, typical = "(balanced)", From 219fbf5999e6832e95fe49b83ef42fafb1e43197 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 18:29:37 +0100 Subject: [PATCH 31/56] handle mixed models --- R/get_marginalcontrasts.R | 2 +- R/get_marginalmeans.R | 6 ++++-- R/table_footer.R | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/R/get_marginalcontrasts.R b/R/get_marginalcontrasts.R index 26a52636c..8298f42d2 100644 --- a/R/get_marginalcontrasts.R +++ b/R/get_marginalcontrasts.R @@ -18,6 +18,7 @@ get_marginalcontrasts <- function( ) { # check if available insight::check_if_installed("marginaleffects", minimum_version = "0.29.0") + dots <- list(...) # temporarily overwrite settings that error on "too many" rows me_option <- getOption("marginaleffects_safe") @@ -170,7 +171,6 @@ get_marginalcontrasts <- function( # the hypothesis compares all slopes, so we cannot filter the contrasts # later. Instead, we only keep the data rows that pass the filter. The # slopes are averaged within each group of `by`, so they don't change. - dots <- list(...) if ( identical(estimate, "average") && length(slope_filter) && diff --git a/R/get_marginalmeans.R b/R/get_marginalmeans.R index 92b6f4039..4ccdb8c22 100644 --- a/R/get_marginalmeans.R +++ b/R/get_marginalmeans.R @@ -700,10 +700,12 @@ get_marginalmeans <- function( if (!is.null(info$adjusted_for) && !is.null(response)) { info$adjusted_for <- setdiff(info$adjusted_for, response) } + # we definitely don't want + info$adjusted_for <- setdiff(info$adjusted_for, re_intercept) # if we have mixed models, and re.form = NA, we want to remove the random # intercept from the footer - if (isTRUE(no_re_intercept)) { - info$adjusted_for <- setdiff(info$adjusted_for, re_intercept) + if (!isTRUE(no_re_intercept)) { + info$re_intercept <- re_intercept } } diff --git a/R/table_footer.R b/R/table_footer.R index f44b8153f..ca94f3100 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -7,6 +7,7 @@ datagrid <- info$datagrid p_adjust <- info$p_adjust adjusted_for <- info$adjusted_for + re_intercept <- info$re_intercept transform <- info$transform model_info <- info$model_info marginalization <- info$estimate @@ -116,6 +117,25 @@ } } + # Random effects handling ------------------------------------------------ + + if (!is.null(re_intercept) && !is.null(marginalization)) { + if (marginalization %in% c("average", "population", "counterfactual")) { + table_footer <- paste0( + table_footer, + paste0( + "\nResults are marginalized over random effects levels of: ", + toString(re_intercept) + ) + ) + } else { + table_footer <- paste0( + table_footer, + "\nResults refer to a typical or to an average random effects group." + ) + } + } + # P-value adjustment footer ------------------------------------------------ if (!is.null(p_adjust) && "p" %in% names(x)) { From d423e88fa0ea78b582a6efd072e0f9e565f65112 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 18:34:59 +0100 Subject: [PATCH 32/56] fix --- .../test-estimate_means_print_footer.R | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/testthat/test-estimate_means_print_footer.R diff --git a/tests/testthat/test-estimate_means_print_footer.R b/tests/testthat/test-estimate_means_print_footer.R new file mode 100644 index 000000000..8f964ab8a --- /dev/null +++ b/tests/testthat/test-estimate_means_print_footer.R @@ -0,0 +1,40 @@ +skip_on_cran() + +test_that("estimate_means - print footer for estimate types and re.form", { + skip_if_not_installed("lme4") + skip_if_not_installed("marginaleffects") + skip_if(getRversion() < "4.5.0") + + data(penguins) + set.seed(123) + d <- penguins + d$weights <- abs(rnorm(nrow(d), 1, 0.2)) + model <- lm(body_mass ~ species + sex + bill_len, data = d, weights = weights) + + expect_snapshot(print(estimate_means(model, "sex", estimate = "specific"))) + expect_snapshot(print(estimate_means(model, "sex", estimate = "typical"))) + expect_snapshot(print(estimate_means(model, "sex", estimate = "average"))) + expect_snapshot(print(estimate_means(model, "sex", estimate = "population"))) + + data(cbpp, package = "lme4") + m <- lme4::glmer( + cbind(incidence, size - incidence) ~ period + (1 | herd), + data = cbpp, + family = binomial + ) + + expect_snapshot(print(estimate_means(m, by = "period", estimate = "typical"))) + expect_snapshot(print(estimate_means( + m, + by = "period", + estimate = "typical", + re.form = NA + ))) + expect_snapshot(print(estimate_means(m, by = "period", estimate = "average"))) + expect_snapshot(print(estimate_means( + m, + by = "period", + estimate = "average", + re.form = NA + ))) +}) From 7fbf6c47a29541e3770e2a97c88da239f108245c Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 18:35:14 +0100 Subject: [PATCH 33/56] add test --- .../_snaps/estimate_means_print_footer.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 tests/testthat/_snaps/estimate_means_print_footer.md diff --git a/tests/testthat/_snaps/estimate_means_print_footer.md b/tests/testthat/_snaps/estimate_means_print_footer.md new file mode 100644 index 000000000..c986a984f --- /dev/null +++ b/tests/testthat/_snaps/estimate_means_print_footer.md @@ -0,0 +1,141 @@ +# estimate_means - print footer for estimate types and re.form + + Code + print(estimate_means(model, "sex", estimate = "specific")) + Output + Conditional Predictions + + sex | Mean | SE | 95% CI | t(328) + ------------------------------------------------------ + female | 3611.50 | 59.73 | [3494.00, 3729.01] | 60.46 + male | 4148.88 | 38.84 | [4072.48, 4225.28] | 106.83 + + Variable predicted: body_mass + Predictors modulated: sex + Predictors held at: species (Adelie), bill_len (44) + +--- + + Code + print(estimate_means(model, "sex", estimate = "typical")) + Output + Conditional Predictions + + sex | Mean | SE | 95% CI | t(328) + ------------------------------------------------------ + female | 3873.98 | 25.06 | [3824.69, 3923.27] | 154.61 + male | 4411.36 | 32.43 | [4347.56, 4475.15] | 136.03 + + Variable predicted: body_mass + Predictors modulated: sex + Predictors held at: bill_len (44) + Predictors averaged over (balanced): species + +--- + + Code + print(estimate_means(model, "sex", estimate = "average")) + Output + Marginal Predictions + + sex | Mean | SE | 95% CI | t(328) + ------------------------------------------------------ + female | 3868.92 | 23.72 | [3822.27, 3915.58] | 163.13 + male | 4545.49 | 23.74 | [4498.79, 4592.19] | 191.49 + + Variable predicted: body_mass + Predictors modulated: sex + Predictors held at: bill_len (44) + Predictors averaged over (within groups): species + +--- + + Code + print(estimate_means(model, "sex", estimate = "population")) + Output + Marginal Predictions (G-computation) + + sex | Mean | SE | 95% CI | t(328) + ------------------------------------------------------ + female | 3939.15 | 27.46 | [3885.12, 3993.17] | 143.44 + male | 4476.52 | 27.38 | [4422.66, 4530.38] | 163.50 + + Variable predicted: body_mass + Predictors modulated: sex + Predictors held at: bill_len (44) + Predictors averaged over (full sample): species + +--- + + Code + print(estimate_means(m, by = "period", estimate = "typical")) + Output + Conditional Predictions + + period | Probability | SE | 95% CI | z + ------------------------------------------------- + 1 | 0.22 | 0.04 | [0.14, 0.29] | 5.76 + 2 | 0.10 | 0.03 | [0.04, 0.15] | 3.66 + 3 | 0.08 | 0.02 | [0.04, 0.13] | 3.39 + 4 | 0.06 | 0.02 | [0.01, 0.10] | 2.50 + + Variable predicted: cbind(incidence, size - incidence) + Predictors modulated: period + Results refer to a typical or to an average random effects group. + Predictions are on the response-scale. + +--- + + Code + print(estimate_means(m, by = "period", estimate = "typical", re.form = NA)) + Output + Conditional Predictions + + period | Probability | SE | 95% CI | z + ------------------------------------------------- + 1 | 0.20 | 0.04 | [0.13, 0.27] | 5.36 + 2 | 0.08 | 0.02 | [0.04, 0.13] | 3.52 + 3 | 0.07 | 0.02 | [0.03, 0.12] | 3.27 + 4 | 0.05 | 0.02 | [0.01, 0.09] | 2.44 + + Variable predicted: cbind(incidence, size - incidence) + Predictors modulated: period + Predictions are on the response-scale. + +--- + + Code + print(estimate_means(m, by = "period", estimate = "average")) + Output + Marginal Predictions + + period | Probability | SE | 95% CI | z + ------------------------------------------------- + 1 | 0.22 | 0.04 | [0.14, 0.29] | 5.76 + 2 | 0.09 | 0.03 | [0.04, 0.14] | 3.65 + 3 | 0.08 | 0.02 | [0.03, 0.13] | 3.38 + 4 | 0.06 | 0.02 | [0.01, 0.10] | 2.50 + + Variable predicted: cbind(incidence, size - incidence) + Predictors modulated: period + Results are marginalized over random effects levels of: herd + Predictions are on the response-scale. + +--- + + Code + print(estimate_means(m, by = "period", estimate = "average", re.form = NA)) + Output + Marginal Predictions + + period | Probability | SE | 95% CI | z + ------------------------------------------------- + 1 | 0.20 | 0.04 | [0.13, 0.27] | 5.36 + 2 | 0.08 | 0.02 | [0.04, 0.13] | 3.52 + 3 | 0.07 | 0.02 | [0.03, 0.12] | 3.27 + 4 | 0.05 | 0.02 | [0.01, 0.09] | 2.44 + + Variable predicted: cbind(incidence, size - incidence) + Predictors modulated: period + Predictions are on the response-scale. + From 8e92e1370bd6d7878a9c9d5b6b247e05a5091289 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:16:42 +0100 Subject: [PATCH 34/56] fix --- R/get_marginalmeans.R | 4 +++- R/table_footer.R | 23 ++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/R/get_marginalmeans.R b/R/get_marginalmeans.R index 4ccdb8c22..ff21d6d2b 100644 --- a/R/get_marginalmeans.R +++ b/R/get_marginalmeans.R @@ -707,6 +707,8 @@ get_marginalmeans <- function( if (!isTRUE(no_re_intercept)) { info$re_intercept <- re_intercept } + # save info if re.form was NA + info$re_form_na <- isTRUE(no_re_intercept) } if (!is.null(info) && length(info)) { @@ -732,7 +734,7 @@ get_marginalmeans <- function( "contrast", "estimate", "p_adjust", "transform", "transform_arg", "datagrid", "preserve_range", "coef_name", "slope", "ci", "model_info", "contrast_filter", "null", "iterations", "keep_iterations", "joint_test", "omnibus_test", "vcov", - "equivalence", "context_effects", "renamed_focal", "re_intercept" + "equivalence", "context_effects", "renamed_focal", "re_intercept", "re_form_na" ) } diff --git a/R/table_footer.R b/R/table_footer.R index ca94f3100..276faba12 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -8,6 +8,7 @@ p_adjust <- info$p_adjust adjusted_for <- info$adjusted_for re_intercept <- info$re_intercept + re_form_na <- info$re_form_na transform <- info$transform model_info <- info$model_info marginalization <- info$estimate @@ -103,10 +104,10 @@ "Predictors averaged over", switch( marginalization, - typical = "(balanced)", - average = "(within groups)", + typical = "(balanced grid)", + average = , population = , - counterfactual = "(full sample)", + counterfactual = "(sample)", "" ) ) @@ -119,23 +120,27 @@ # Random effects handling ------------------------------------------------ - if (!is.null(re_intercept) && !is.null(marginalization)) { + if (!is.null(re_intercept) && !isTRUE(re_form_na) && !is.null(marginalization)) { if (marginalization %in% c("average", "population", "counterfactual")) { table_footer <- paste0( table_footer, - paste0( - "\nResults are marginalized over random effects levels of: ", - toString(re_intercept) - ) + "\nRandom effects marginalized across clusters." ) } else { table_footer <- paste0( table_footer, - "\nResults refer to a typical or to an average random effects group." + "\nRandom effects averaged over balanced grid of cluster levels." ) } } + if (isTRUE(re_form_na)) { + table_footer <- paste0( + table_footer, + "\nRandom effects: Conditional on a typical cluster." + ) + } + # P-value adjustment footer ------------------------------------------------ if (!is.null(p_adjust) && "p" %in% names(x)) { From 4ae38d548e54f79e35a0136d5681f0a2027e0c85 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:18:50 +0100 Subject: [PATCH 35/56] minor --- R/table_footer.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/table_footer.R b/R/table_footer.R index 276faba12..57393f2ce 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -124,12 +124,12 @@ if (marginalization %in% c("average", "population", "counterfactual")) { table_footer <- paste0( table_footer, - "\nRandom effects marginalized across clusters." + "\nRandom effects: Marginalized across clusters." ) } else { table_footer <- paste0( table_footer, - "\nRandom effects averaged over balanced grid of cluster levels." + "\nRandom effects: Averaged over a balanced grid of cluster levels." ) } } From 5bd449a715979d947fa6305033d9b057dee82f50 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:22:22 +0100 Subject: [PATCH 36/56] footer for emmeans --- R/get_emcontrasts.R | 11 ++++++++++- R/get_emmeans.R | 15 +++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/R/get_emcontrasts.R b/R/get_emcontrasts.R index b3303ed15..265634c2b 100644 --- a/R/get_emcontrasts.R +++ b/R/get_emcontrasts.R @@ -71,7 +71,11 @@ get_emcontrasts <- function( fun_args$mode <- ordinal$mode } .check_ordinal_response_filter(my_args$response_filter, ordinal$mode) - .check_ordinal_response_filter(my_args$response_contrast_filter, ordinal$mode, "contrast") + .check_ordinal_response_filter( + my_args$response_contrast_filter, + ordinal$mode, + "contrast" + ) } # add dots @@ -199,6 +203,11 @@ get_emcontrasts <- function( keep_iterations <- FALSE } + # emmeans is always conditioning on a typical cluster + if (insight::is_mixed_model(model)) { + attr(estimated, "re_form_na") <- TRUE + } + attr(out, "contrast") <- my_args$contrast attr(out, "predict") <- predict attr(out, "at") <- my_args$by diff --git a/R/get_emmeans.R b/R/get_emmeans.R index 2d4e8ad4e..97b9ea941 100644 --- a/R/get_emmeans.R +++ b/R/get_emmeans.R @@ -122,6 +122,11 @@ get_emmeans <- function( keep_iterations <- FALSE } + # emmeans is always conditioning on a typical cluster + if (insight::is_mixed_model(model)) { + attr(estimated, "re_form_na") <- TRUE + } + attr(estimated, "at") <- my_args$by attr(estimated, "by") <- my_args$by attr(estimated, "predict") <- predict @@ -318,7 +323,9 @@ get_emmeans <- function( } estimate_name <- x@misc$estName if (!is.null(estimate_name) && estimate_name %in% colnames(means)) { - colnames(means)[colnames(means) == estimate_name] <- .emmeans_ordinal_estimate_names[[ordinal_mode]] + colnames(means)[colnames(means) == estimate_name] <- .emmeans_ordinal_estimate_names[[ + ordinal_mode + ]] } .clean_pseudo_factor_emmeans_ordinal( means, @@ -603,7 +610,11 @@ get_emmeans <- function( # we cannot use the response in `by` (or `contrast`) for the other modes. # `ordinal_mode` is the mode the user asked for, not the mode that we use # internally for slopes -.check_ordinal_response_filter <- function(response_filter, ordinal_mode, argument = "by") { +.check_ordinal_response_filter <- function( + response_filter, + ordinal_mode, + argument = "by" +) { if (!is.null(response_filter) && !identical(ordinal_mode, "prob")) { insight::format_error(paste0( "The response `", From 6e2a1ad533f1fc0f3fd7d88bad8ce458ab629859 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:38:50 +0100 Subject: [PATCH 37/56] refactor a bit --- R/get_marginalcontrasts.R | 7 +++---- R/get_marginalmeans.R | 29 ++++++++++++++++++----------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/R/get_marginalcontrasts.R b/R/get_marginalcontrasts.R index 8298f42d2..cb71a42b1 100644 --- a/R/get_marginalcontrasts.R +++ b/R/get_marginalcontrasts.R @@ -248,10 +248,9 @@ get_marginalcontrasts <- function( iterations = iterations, keep_iterations = keep_iterations ), - # some additional information for mixed models - response = insight::find_response(model, combine = FALSE), - re_intercept = insight::find_random(model, flatten = TRUE, split_nested = TRUE), - no_re_intercept = !is.null(dots$re.form) && is.na(dots$re.form) + # needed for some additional information for mixed models + model = model, + re_form = isTRUE(dots$re.form) || isTRUE(dots$re_formula) ) out <- .rename_focal_attributes(out) diff --git a/R/get_marginalmeans.R b/R/get_marginalmeans.R index ff21d6d2b..f645799bb 100644 --- a/R/get_marginalmeans.R +++ b/R/get_marginalmeans.R @@ -330,10 +330,9 @@ get_marginalmeans <- function( equivalence = dots$equivalence ) ), - # some additional information for mixed models - response = insight::find_response(model, combine = FALSE), - re_intercept = insight::find_random(model, flatten = TRUE, split_nested = TRUE), - no_re_intercept = !is.null(dots$re.form) && is.na(dots$re.form) + # needed for some additional information for mixed models + model = model, + re_form = isTRUE(dots$re.form) || isTRUE(dots$re_formula) ) class(means) <- unique(c("marginaleffects_means", class(means))) @@ -682,28 +681,36 @@ get_marginalmeans <- function( by = NULL, model_info = NULL, info = NULL, - response = NULL, - re_intercept = NULL, - no_re_intercept = FALSE + model = NULL, + re_form = NULL ) { attr(x, "at") <- by attr(x, "by") <- by attr(x, "model_info") <- model_info + # extract information, required for mixed models handling + if (!is.null(model)) { + response <- insight::find_response(model, combine = FALSE) + re_intercept <- insight::find_random(model, flatten = TRUE, split_nested = TRUE) + no_re_intercept <- !is.null(re_form) && is.na(re_form) + } else { + response <- re_intercept <- no_re_intercept <- NULL + } + # compact list info <- insight::compact_list(info) - # some special handling for mixed models + # some special handling for mixed models - we need this information for + # printing an informative table footer. if (isTRUE(model_info$is_mixed)) { # if we have mixed models, we don't want the response in the adusted-for # information, so we check and remove it here, if necessary if (!is.null(info$adjusted_for) && !is.null(response)) { info$adjusted_for <- setdiff(info$adjusted_for, response) } - # we definitely don't want + # we definitely don't want the random-intercept in the "adjusted for" list info$adjusted_for <- setdiff(info$adjusted_for, re_intercept) - # if we have mixed models, and re.form = NA, we want to remove the random - # intercept from the footer + # save information about random effects (cluster/grouping variable) if (!isTRUE(no_re_intercept)) { info$re_intercept <- re_intercept } From 07ae2c277b7605bdc6a51d30e662edafa09e6bdf Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:47:04 +0100 Subject: [PATCH 38/56] update --- R/get_marginalcontrasts.R | 7 ++++++- R/get_marginalmeans.R | 16 ++++++++++------ .../_snaps/estimate_means_print_footer.md | 12 +++++++----- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/R/get_marginalcontrasts.R b/R/get_marginalcontrasts.R index cb71a42b1..920eadcc3 100644 --- a/R/get_marginalcontrasts.R +++ b/R/get_marginalcontrasts.R @@ -231,6 +231,11 @@ get_marginalcontrasts <- function( # Last step: Save information in attributes -------------------------------- # --------------------------------------------------------------------------- + # handle brms-alias + if (!is.null(dots$re_formula)) { + dots$re.form <- dots$re_formula + } + out <- .add_attributes( out, by = my_args$by, @@ -250,7 +255,7 @@ get_marginalcontrasts <- function( ), # needed for some additional information for mixed models model = model, - re_form = isTRUE(dots$re.form) || isTRUE(dots$re_formula) + re_form_na = !is.null(dots$re.form) && is.na(dots$re.form) ) out <- .rename_focal_attributes(out) diff --git a/R/get_marginalmeans.R b/R/get_marginalmeans.R index f645799bb..4ab310a11 100644 --- a/R/get_marginalmeans.R +++ b/R/get_marginalmeans.R @@ -309,6 +309,11 @@ get_marginalmeans <- function( # Last step: Save information in attributes -------------------------------- # --------------------------------------------------------------------------- + # handle brms-alias + if (!is.null(dots$re_formula)) { + dots$re.form <- dots$re_formula + } + means <- .add_attributes( means, by = my_args$by, @@ -332,7 +337,7 @@ get_marginalmeans <- function( ), # needed for some additional information for mixed models model = model, - re_form = isTRUE(dots$re.form) || isTRUE(dots$re_formula) + re_form_na = !is.null(dots$re.form) && is.na(dots$re.form) ) class(means) <- unique(c("marginaleffects_means", class(means))) @@ -682,7 +687,7 @@ get_marginalmeans <- function( model_info = NULL, info = NULL, model = NULL, - re_form = NULL + re_form_na = NULL ) { attr(x, "at") <- by attr(x, "by") <- by @@ -692,9 +697,8 @@ get_marginalmeans <- function( if (!is.null(model)) { response <- insight::find_response(model, combine = FALSE) re_intercept <- insight::find_random(model, flatten = TRUE, split_nested = TRUE) - no_re_intercept <- !is.null(re_form) && is.na(re_form) } else { - response <- re_intercept <- no_re_intercept <- NULL + response <- re_form_na <- no_re_intercept <- NULL } # compact list @@ -711,11 +715,11 @@ get_marginalmeans <- function( # we definitely don't want the random-intercept in the "adjusted for" list info$adjusted_for <- setdiff(info$adjusted_for, re_intercept) # save information about random effects (cluster/grouping variable) - if (!isTRUE(no_re_intercept)) { + if (!isTRUE(re_form_na)) { info$re_intercept <- re_intercept } # save info if re.form was NA - info$re_form_na <- isTRUE(no_re_intercept) + info$re_form_na <- isTRUE(re_form_na) } if (!is.null(info) && length(info)) { diff --git a/tests/testthat/_snaps/estimate_means_print_footer.md b/tests/testthat/_snaps/estimate_means_print_footer.md index c986a984f..c26bf77e2 100644 --- a/tests/testthat/_snaps/estimate_means_print_footer.md +++ b/tests/testthat/_snaps/estimate_means_print_footer.md @@ -29,7 +29,7 @@ Variable predicted: body_mass Predictors modulated: sex Predictors held at: bill_len (44) - Predictors averaged over (balanced): species + Predictors averaged over (balanced grid): species --- @@ -46,7 +46,7 @@ Variable predicted: body_mass Predictors modulated: sex Predictors held at: bill_len (44) - Predictors averaged over (within groups): species + Predictors averaged over (sample): species --- @@ -63,7 +63,7 @@ Variable predicted: body_mass Predictors modulated: sex Predictors held at: bill_len (44) - Predictors averaged over (full sample): species + Predictors averaged over (sample): species --- @@ -81,7 +81,7 @@ Variable predicted: cbind(incidence, size - incidence) Predictors modulated: period - Results refer to a typical or to an average random effects group. + Random effects: Averaged over a balanced grid of cluster levels. Predictions are on the response-scale. --- @@ -100,6 +100,7 @@ Variable predicted: cbind(incidence, size - incidence) Predictors modulated: period + Random effects: Conditional on a typical cluster. Predictions are on the response-scale. --- @@ -118,7 +119,7 @@ Variable predicted: cbind(incidence, size - incidence) Predictors modulated: period - Results are marginalized over random effects levels of: herd + Random effects: Marginalized across clusters. Predictions are on the response-scale. --- @@ -137,5 +138,6 @@ Variable predicted: cbind(incidence, size - incidence) Predictors modulated: period + Random effects: Conditional on a typical cluster. Predictions are on the response-scale. From aea72e2127b88f22e9688ff12457b8a45d4c493d Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:50:03 +0100 Subject: [PATCH 39/56] update --- NEWS.md | 4 +++- tests/testthat/_snaps/betareg.md | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 6d6b063cc..9565d98c5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,9 @@ Specifically, `estimate` defines the *unit of interest* for your *estimand*, distinguishing between predictions *conditioned* on specific, theoretical individual levels and *marginal* predictions averaged over empirical observations - at the sample or population level. + at the sample or population level. Furthermore, table footer are now more + informative for mixed models and describe the handling of random effects more + in detail. ## Changes diff --git a/tests/testthat/_snaps/betareg.md b/tests/testthat/_snaps/betareg.md index a2cc6bebb..57b8e20b4 100644 --- a/tests/testthat/_snaps/betareg.md +++ b/tests/testthat/_snaps/betareg.md @@ -20,7 +20,7 @@ Variable predicted: yield Predictors modulated: batch - Predictors averaged: temp (3.3e+02) + Predictors held at: temp (3.3e+02) Predictions are on the response-scale. # estimate_relation for betareg @@ -45,6 +45,6 @@ Variable predicted: yield Predictors modulated: batch - Predictors controlled: temp (3.3e+02) + Predictors held at: temp (3.3e+02) Predictions are on the response-scale. From acd6fa7183e14f641522cd0b2757e3a5e5e99438 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:51:08 +0100 Subject: [PATCH 40/56] fix --- R/get_marginalmeans.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/get_marginalmeans.R b/R/get_marginalmeans.R index 4ab310a11..cb358e2bc 100644 --- a/R/get_marginalmeans.R +++ b/R/get_marginalmeans.R @@ -698,7 +698,7 @@ get_marginalmeans <- function( response <- insight::find_response(model, combine = FALSE) re_intercept <- insight::find_random(model, flatten = TRUE, split_nested = TRUE) } else { - response <- re_form_na <- no_re_intercept <- NULL + response <- re_form_na <- re_intercept <- NULL } # compact list From 52f70e2ea60f7d50c6307771fc407eb6c3ab5a29 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:52:56 +0100 Subject: [PATCH 41/56] news --- NEWS.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 9565d98c5..b566ff9c7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,10 +10,10 @@ (https://easystats.github.io/modelbased/articles/technical_marginalization.html)). Specifically, `estimate` defines the *unit of interest* for your *estimand*, distinguishing between predictions *conditioned* on specific, theoretical - individual levels and *marginal* predictions averaged over empirical observations - at the sample or population level. Furthermore, table footer are now more - informative for mixed models and describe the handling of random effects more - in detail. + individual levels and *marginal* predictions averaged over empirical + observations at the sample or population level. Furthermore, table footers for + mixed models are now more informative, detailing how random effects are + handled. ## Changes From 3ffad665c30f6b1d23a3d7367782ff403ced87af Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 19:54:28 +0100 Subject: [PATCH 42/56] update test --- tests/testthat/test-estimate_contrasts_counterfactual.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-estimate_contrasts_counterfactual.R b/tests/testthat/test-estimate_contrasts_counterfactual.R index 0837624fd..f645eba53 100644 --- a/tests/testthat/test-estimate_contrasts_counterfactual.R +++ b/tests/testthat/test-estimate_contrasts_counterfactual.R @@ -167,7 +167,7 @@ test_that("estimate_contrast, counterfactual, custom hypothesis", { expect_equal(out$Difference, -4.591834, tolerance = 1e-3) expect_identical( attributes(out)$table_footer[1], - "\nVariable predicted: QoL\nPredictors contrasted: treatment\np-values are uncorrected.\nParameters:\nb3 = treatment [0], time [2]\nb1 = treatment [0], time [1]\nb4 = treatment [1], time [2]\nb2 = treatment [1], time [1]\n" + "\nVariable predicted: QoL\nPredictors contrasted: treatment\nPredictors held at: hospital (0.95), age (0.22), phq4 (-0.076)\nPredictors averaged over (sample): education\nRandom effects: Marginalized across clusters.\np-values are uncorrected.\nParameters:\nb3 = treatment [0], time [2]\nb1 = treatment [0], time [1]\nb4 = treatment [1], time [2]\nb2 = treatment [1], time [1]\n" ) }) From cac5e358e22db241c4ef6096dd31728d30e6b1c1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:03:02 +0100 Subject: [PATCH 43/56] snap --- tests/testthat/_snaps/estimate_contrasts_counterfactual.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/testthat/_snaps/estimate_contrasts_counterfactual.md b/tests/testthat/_snaps/estimate_contrasts_counterfactual.md index 07a4f0709..dbeb5874b 100644 --- a/tests/testthat/_snaps/estimate_contrasts_counterfactual.md +++ b/tests/testthat/_snaps/estimate_contrasts_counterfactual.md @@ -11,6 +11,9 @@ Variable predicted: QoL Predictors contrasted: treatment + Predictors held at: hospital (0.95), age (0.22), phq4 (-0.076) + Predictors averaged over (sample): time, education + Random effects: Marginalized across clusters. p-values are uncorrected. --- @@ -28,5 +31,8 @@ Variable predicted: QoL Predictors contrasted: treatment + Predictors held at: hospital (0.95), age (0.22), phq4 (-0.076) + Predictors averaged over (sample): education + Random effects: Marginalized across clusters. p-values are uncorrected. From 15fee6dd841d6d243c1ab61f0ac35df9be932fa5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:04:16 +0100 Subject: [PATCH 44/56] snap --- tests/testthat/_snaps/estimate_contrasts.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/testthat/_snaps/estimate_contrasts.md b/tests/testthat/_snaps/estimate_contrasts.md index 90e1eadcd..8f68b4b38 100644 --- a/tests/testthat/_snaps/estimate_contrasts.md +++ b/tests/testthat/_snaps/estimate_contrasts.md @@ -59,7 +59,7 @@ Variable predicted: alertness Predictors contrasted: time, coffee - Predictors averaged: sex + Predictors averaged over (balanced grid): sex p-values are uncorrected. --- @@ -80,7 +80,7 @@ Variable predicted: alertness Predictors contrasted: time - Predictors averaged: sex + Predictors averaged over (balanced grid): sex p-values are uncorrected. --- @@ -98,7 +98,7 @@ Variable predicted: alertness Predictors contrasted: time, coffee - Predictors averaged: sex + Predictors averaged over (balanced grid): sex p-values are uncorrected. Parameters: b2 = time [noon], coffee [coffee] @@ -120,7 +120,7 @@ Variable predicted: alertness Predictors contrasted: time, coffee - Predictors averaged: sex + Predictors averaged over (balanced grid): sex p-values are uncorrected. Parameters: b5 = time [noon], coffee [control] @@ -140,7 +140,8 @@ Variable predicted: neg_c_7 Predictors contrasted: e42dep, c172code - Predictors averaged: c12hour (42), barthtot (65), c161sex + Predictors held at: c12hour (42), barthtot (65) + Predictors averaged over (balanced grid): c161sex p-values are uncorrected. Parameters: b6 = e42dep [slightly dependent], c172code [intermediate level of education] @@ -256,7 +257,7 @@ Variable predicted: neg_c_7 Predictors contrasted: c161sex, c172code - Predictors averaged: e16sex + Predictors averaged over (balanced grid): e16sex p-values are uncorrected. # estimate_contrasts - examples from docs work as intendec @@ -275,7 +276,7 @@ Variable predicted: Sepal.Width Predictors contrasted: Petal.Width - Predictors averaged: Petal.Width (1.2) + Predictors held at: Petal.Width (1.2) p-values are uncorrected. # estimate_contrast, slopes with emmeans-2 From 29898c49a889201f420bed91ee8c9f16923be26e Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:05:05 +0100 Subject: [PATCH 45/56] format --- .../test-estimate_means_counterfactuals.R | 60 +++++++++++++++++-- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-estimate_means_counterfactuals.R b/tests/testthat/test-estimate_means_counterfactuals.R index b5584e464..03b664c00 100644 --- a/tests/testthat/test-estimate_means_counterfactuals.R +++ b/tests/testthat/test-estimate_means_counterfactuals.R @@ -11,11 +11,45 @@ test_that("estimate_means() - counterfactuals", { family = poisson(), data = Salamanders ) - expect_snapshot(print(estimate_means(m, "spp", backend = "marginaleffects"), zap_small = TRUE, table_width = Inf), variant = "windows") # nolint - expect_snapshot(print(estimate_means(m, "spp", backend = "marginaleffects", estimate = "population"), zap_small = TRUE, table_width = Inf), variant = "windows") # nolint + expect_snapshot( + print( + estimate_means(m, "spp", backend = "marginaleffects"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) # nolint + expect_snapshot( + print( + estimate_means(m, "spp", backend = "marginaleffects", estimate = "population"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) # nolint - expect_snapshot(print(estimate_means(m, "spp", backend = "marginaleffects", predict = "inverse_link"), zap_small = TRUE, table_width = Inf), variant = "windows") # nolint - expect_snapshot(print(estimate_means(m, "spp", backend = "marginaleffects", estimate = "population", predict = "inverse_link"), zap_small = TRUE, table_width = Inf), variant = "windows") # nolint + expect_snapshot( + print( + estimate_means(m, "spp", backend = "marginaleffects", predict = "inverse_link"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) # nolint + expect_snapshot( + print( + estimate_means( + m, + "spp", + backend = "marginaleffects", + estimate = "population", + predict = "inverse_link" + ), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) # nolint out1 <- estimate_means(m, "spp", backend = "marginaleffects", predict = "inverse_link") out2 <- estimate_means(m, "spp", backend = "emmeans") @@ -26,6 +60,20 @@ test_that("estimate_means() - counterfactuals", { set.seed(123) strapped <- sleepstudy[sample.int(nrow(sleepstudy), nrow(sleepstudy), replace = TRUE), ] m <- lme4::lmer(Reaction ~ Days + (1 + Days | Subject), data = strapped) - expect_snapshot(print(estimate_means(m, "Days", backend = "marginaleffects"), zap_small = TRUE, table_width = Inf), variant = "windows") # nolint - expect_snapshot(print(estimate_means(m, "Days", backend = "marginaleffects", estimate = "population"), zap_small = TRUE, table_width = Inf), variant = "windows") # nolint + expect_snapshot( + print( + estimate_means(m, "Days", backend = "marginaleffects"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) # nolint + expect_snapshot( + print( + estimate_means(m, "Days", backend = "marginaleffects", estimate = "population"), + zap_small = TRUE, + table_width = Inf + ), + variant = "windows" + ) # nolint }) From ac8c8c2e3ca16b9af7c7bacce79fead2180520ec Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:06:04 +0100 Subject: [PATCH 46/56] snap --- tests/testthat/_snaps/estimate_means_mixed.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/estimate_means_mixed.md b/tests/testthat/_snaps/estimate_means_mixed.md index 96bcbbfdd..8f1f9ac94 100644 --- a/tests/testthat/_snaps/estimate_means_mixed.md +++ b/tests/testthat/_snaps/estimate_means_mixed.md @@ -24,7 +24,7 @@ Variable predicted: count Predictors modulated: mined, spp - Predictors averaged: site + Random effects: Averaged over a balanced grid of cluster levels. Predictions are on the response-scale. --- @@ -53,7 +53,7 @@ Variable predicted: count Predictors modulated: mined, spp - Predictors averaged: site + Random effects: Averaged over a balanced grid of cluster levels. Predictions are on the response-scale. --- From b8128b3d67f462b673be05e19a52213fb56d5873 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:09:52 +0100 Subject: [PATCH 47/56] snaps --- .../_snaps/windows/estimate_contrasts.md | 25 +++++++++++-------- .../windows/estimate_means_counterfactuals.md | 13 +++++++--- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/tests/testthat/_snaps/windows/estimate_contrasts.md b/tests/testthat/_snaps/windows/estimate_contrasts.md index e111f8afc..833145bb6 100644 --- a/tests/testthat/_snaps/windows/estimate_contrasts.md +++ b/tests/testthat/_snaps/windows/estimate_contrasts.md @@ -55,7 +55,7 @@ Variable predicted: mpg Predictors contrasted: am - Predictors averaged: three, vs + Predictors averaged over (balanced grid): three, vs p-values are uncorrected. # estimate_contrasts - filtering works @@ -74,7 +74,7 @@ Variable predicted: neg_c_7 Predictors contrasted: c172code - Predictors averaged: e16sex, c161sex + Predictors averaged over (balanced grid): e16sex, c161sex p-values are uncorrected. --- @@ -93,7 +93,7 @@ Variable predicted: neg_c_7 Predictors contrasted: c161sex - Predictors averaged: e16sex + Predictors averaged over (balanced grid): e16sex p-values are uncorrected. --- @@ -144,7 +144,8 @@ Variable predicted: neg_c_7 Predictors contrasted: barthtot - Predictors averaged: e16sex, barthtot (65) + Predictors held at: barthtot (65) + Predictors averaged over (balanced grid): e16sex p-values are uncorrected. --- @@ -175,7 +176,7 @@ Variable predicted: neg_c_7 Predictors contrasted: barthtot - Predictors averaged: barthtot (65) + Predictors held at: barthtot (65) p-values are uncorrected. # estimate_contrasts - simple contrasts and with - in levels works @@ -194,7 +195,7 @@ Variable predicted: Sepal.Length Predictors contrasted: Species - Predictors averaged: Sepal.Width (3.1) + Predictors held at: Sepal.Width (3.1) p-values are uncorrected. --- @@ -225,7 +226,7 @@ Variable predicted: alertness Predictors contrasted: time, coffee - Predictors averaged: sex + Predictors averaged over (balanced grid): sex p-values are uncorrected. --- @@ -247,7 +248,7 @@ Variable predicted: alertness Predictors contrasted: time - Predictors averaged: sex + Predictors averaged over (balanced grid): sex p-values are uncorrected. --- @@ -354,7 +355,8 @@ Variable predicted: count Predictors contrasted: mined, spp - Predictors averaged: cover (8.7e-11), site + Predictors held at: cover (8.7e-11) + Random effects: Averaged over a balanced grid of cluster levels. p-values are uncorrected. Contrasts are on the response-scale. @@ -378,7 +380,8 @@ Variable predicted: count Predictors contrasted: mined - Predictors averaged: cover (8.7e-11), site + Predictors held at: cover (8.7e-11) + Random effects: Averaged over a balanced grid of cluster levels. p-values are uncorrected. Contrasts are on the response-scale. @@ -575,7 +578,7 @@ Variable predicted: score Predictors contrasted: grp - Predictors averaged: x + Predictors averaged over (balanced grid): x p-values are uncorrected. --- diff --git a/tests/testthat/_snaps/windows/estimate_means_counterfactuals.md b/tests/testthat/_snaps/windows/estimate_means_counterfactuals.md index 14e1ca9bf..7a626d110 100644 --- a/tests/testthat/_snaps/windows/estimate_means_counterfactuals.md +++ b/tests/testthat/_snaps/windows/estimate_means_counterfactuals.md @@ -18,7 +18,8 @@ Variable predicted: count Predictors modulated: spp - Predictors averaged: mined, site + Predictors averaged over (balanced grid): mined + Random effects: Averaged over a balanced grid of cluster levels. Predictions are on the response-scale. --- @@ -41,6 +42,8 @@ Variable predicted: count Predictors modulated: spp + Predictors averaged over (sample): mined + Random effects: Marginalized across clusters. Predictions are on the response-scale. --- @@ -63,7 +66,8 @@ Variable predicted: count Predictors modulated: spp - Predictors averaged: mined, site + Predictors averaged over (balanced grid): mined + Random effects: Averaged over a balanced grid of cluster levels. Predictions are on the response-scale. --- @@ -86,6 +90,8 @@ Variable predicted: count Predictors modulated: spp + Predictors averaged over (sample): mined + Random effects: Marginalized across clusters. Predictions are on the response-scale. --- @@ -111,7 +117,7 @@ Variable predicted: Reaction Predictors modulated: Days - Predictors averaged: Subject + Random effects: Averaged over a balanced grid of cluster levels. --- @@ -136,4 +142,5 @@ Variable predicted: Reaction Predictors modulated: Days + Random effects: Marginalized across clusters. From f2f0defde3414de940c19aa3d0ae16c9b28d03ca Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:10:45 +0100 Subject: [PATCH 48/56] snaps --- .../_snaps/windows/estimate_contrasts_counterfactual.md | 3 +++ tests/testthat/_snaps/windows/ordinal.md | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md index 73c64943d..83f9d091b 100644 --- a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md +++ b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md @@ -16,5 +16,8 @@ Variable predicted: QoL Predictors contrasted: time + Predictors held at: hospital (0.95), age (0.22), phq4 (-0.076) + Predictors averaged over (sample): education + Random effects: Marginalized across clusters. p-values are uncorrected. diff --git a/tests/testthat/_snaps/windows/ordinal.md b/tests/testthat/_snaps/windows/ordinal.md index 52a6b203e..3c8d90cb3 100644 --- a/tests/testthat/_snaps/windows/ordinal.md +++ b/tests/testthat/_snaps/windows/ordinal.md @@ -195,7 +195,7 @@ Variable predicted: species Predictors modulated: island - Predictors averaged: sex + Predictors averaged over (balanced grid): sex Predictions are on the probs-scale. --- @@ -219,6 +219,6 @@ Variable predicted: species Predictors modulated: island - Predictors averaged: sex + Predictors averaged over (balanced grid): sex Predictions are on the probs-scale. From c60c2ca2f0665b77350c2d8bd8883c1a6e6267cd Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:14:33 +0100 Subject: [PATCH 49/56] fix --- R/table_footer.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/R/table_footer.R b/R/table_footer.R index 57393f2ce..d3a9191ad 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -53,12 +53,14 @@ } else { ref_cat_data <- NULL } + + # if we have values at which non-focal terms are held constant, we want + # them in a separate string; same for predictors we average over + averaged_over <- held_constant <- list() + if (!is.null(ref_cat_data)) { # get values at which non-focal terms are hold constant adjusted_values <- lapply(adjusted_for, function(i) ref_cat_data[[i]][1]) - # if we have values at which non-focal terms are held constant, we want - # them in a separate string; same for predictors we average over - averaged_over <- held_constant <- list() # at values to names of non-focal terms (table_footer). we have to iterate # over the list, because we may have different types of data for (av in seq_along(adjusted_values)) { From 0ad9c4cb489f95a25dd2a6d2624cd72da0e28799 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:16:27 +0100 Subject: [PATCH 50/56] skip --- tests/testthat/test-g_computation.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/testthat/test-g_computation.R b/tests/testthat/test-g_computation.R index 75d6d7b27..493edaa23 100644 --- a/tests/testthat/test-g_computation.R +++ b/tests/testthat/test-g_computation.R @@ -5,6 +5,8 @@ skip_on_os("mac") test_that("estimate_contrasts - ATT and ATU", { skip_if_not_installed("Rdatasets") + skip_on_os("linux") + dat <- marginaleffects::get_dataset("lottery") dat <- subset(dat, win_big == 1 | win == 0) dat$win_big <- as.factor(dat$win_big) From 33412b1deb12de84cf5cea17705a715b507f0391 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:21:38 +0100 Subject: [PATCH 51/56] fix tests --- tests/testthat/test-joint_test.R | 3 +- tests/testthat/test-table_footer.R | 46 +++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/tests/testthat/test-joint_test.R b/tests/testthat/test-joint_test.R index 71effce36..d7760af79 100644 --- a/tests/testthat/test-joint_test.R +++ b/tests/testthat/test-joint_test.R @@ -48,7 +48,7 @@ test_that("estimate_contrasts - joint test, 2-way", { "------------------------", "3 | 114 | 2.35 | 0.076", "", - "Predictors averaged: coffee", + "Predictors averaged over (balanced grid): coffee", "p-values are uncorrected.", "Null-hypothesis: Group means equal 16.20" ) @@ -73,6 +73,7 @@ test_that("estimate_contrasts - joint test, 2-way", { "------------------------", "3 | 114 | 2.35 | 0.076", "", + "Predictors averaged over (sample): coffee", "p-values are uncorrected.", "Null-hypothesis: Group means equal 16.20" ) diff --git a/tests/testthat/test-table_footer.R b/tests/testthat/test-table_footer.R index 0ab4d775e..bef172532 100644 --- a/tests/testthat/test-table_footer.R +++ b/tests/testthat/test-table_footer.R @@ -5,18 +5,30 @@ test_that("table_footer", { data(efc, package = "modelbased") efc <- datawizard::to_factor(efc, c("c161sex", "c172code", "e16sex", "e42dep")) m <- lm(neg_c_7 ~ c12hour + barthtot + c161sex + e42dep + c172code, data = efc) - out <- utils::capture.output(estimate_means(m, "c172code", estimate = "specific", verbose = FALSE)) - expect_identical( - out[11], - "Predictors controlled: c12hour (42), barthtot (65), c161sex (Male), e42dep (independent)" - ) - out <- utils::capture.output(estimate_means(m, "c172code", estimate = "typical", verbose = FALSE)) + out <- utils::capture.output(estimate_means( + m, + "c172code", + estimate = "specific", + verbose = FALSE + )) expect_identical( out[11], - "Predictors averaged: c12hour (42), barthtot (65), c161sex, e42dep" + "Predictors held at: c12hour (42), barthtot (65), c161sex (Male), e42dep (independent)" ) - out <- utils::capture.output(estimate_means(m, "c172code", estimate = "average", verbose = FALSE)) - expect_length(out, 10) + out <- utils::capture.output(estimate_means( + m, + "c172code", + estimate = "typical", + verbose = FALSE + )) + expect_identical(out[11], "Predictors held at: c12hour (42), barthtot (65)") + out <- utils::capture.output(estimate_means( + m, + "c172code", + estimate = "average", + verbose = FALSE + )) + expect_length(out, 12) }) @@ -103,9 +115,13 @@ test_that("table_footer, link-scale and transform", { transform = exp ))) expect_true("Contrasts are on the transformed link-scale." %in% out) - out <- utils::capture.output( - estimate_contrasts(g, "wt", by = "cyl", predict = "link", transform = exp) - ) + out <- utils::capture.output(estimate_contrasts( + g, + "wt", + by = "cyl", + predict = "link", + transform = exp + )) expect_true("Contrasts are on the transformed link-scale." %in% out) }) @@ -119,6 +135,10 @@ test_that("table_footer, no prediction intervals if insight falls back", { "predict" ) skip_if(identical(predict_type, "prediction")) - out <- utils::capture.output(suppressWarnings(estimate_prediction(m, data = "grid", length = 3))) + out <- utils::capture.output(suppressWarnings(estimate_prediction( + m, + data = "grid", + length = 3 + ))) expect_false("Intervals are prediction intervals." %in% out) }) From 069a108831753031384bae63f45e347e84012b4b Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 20:25:25 +0100 Subject: [PATCH 52/56] spellcheck --- inst/WORDLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/inst/WORDLIST b/inst/WORDLIST index 1d8f4cdee..bc5391fe3 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -82,6 +82,7 @@ behaviour bootES brglm brms +callout cdot ception codecov From 459eecef95e9880c28b628a73c4e5f61c2549ff9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Nov 2026 22:18:34 +0100 Subject: [PATCH 53/56] structure code --- R/table_footer.R | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/R/table_footer.R b/R/table_footer.R index d3a9191ad..ee675c6d0 100644 --- a/R/table_footer.R +++ b/R/table_footer.R @@ -20,6 +20,7 @@ } # name of predicted response ----------------------------------------------- + # -------------------------------------------------------------------------- if (isTRUE(info$joint_test)) { table_footer <- NULL @@ -31,6 +32,7 @@ } # modulated predictors (focal terms) --------------------------------------- + # -------------------------------------------------------------------------- if (!is.null(by) && !isTRUE(info$joint_test) && !inherits(by, "formula")) { modulate_string <- switch(type, inequality = , contrasts = "contrasted", "modulated") @@ -44,6 +46,8 @@ } # predictors controlled (non-focal terms) ---------------------------------- + # -------------------------------------------------------------------------- + if (!is.null(adjusted_for) && length(adjusted_for) >= 1 && !all(is.na(adjusted_for))) { # if we have values of adjusted terms, add these here if (all(adjusted_for %in% colnames(x))) { @@ -121,6 +125,7 @@ } # Random effects handling ------------------------------------------------ + # -------------------------------------------------------------------------- if (!is.null(re_intercept) && !isTRUE(re_form_na) && !is.null(marginalization)) { if (marginalization %in% c("average", "population", "counterfactual")) { @@ -144,6 +149,7 @@ } # P-value adjustment footer ------------------------------------------------ + # -------------------------------------------------------------------------- if (!is.null(p_adjust) && "p" %in% names(x)) { if (p_adjust == "none") { @@ -158,6 +164,7 @@ } # leave early for joint tests ---------------------------------------------- + # -------------------------------------------------------------------------- if (isTRUE(info$joint_test)) { if (!is.null(info$null) && info$omnibus_test) { @@ -171,6 +178,7 @@ } # tell user about scale of predictions / contrasts ------------------------- + # -------------------------------------------------------------------------- result_type <- switch( type, @@ -223,6 +231,7 @@ } # tell user about prediction intervals ------------------------------------- + # -------------------------------------------------------------------------- if ( identical(type, "predictions") && @@ -233,6 +242,7 @@ } # Parameter labels for special hypothesis testing -------------------------- + # -------------------------------------------------------------------------- # for special hypothesis testing, like "(b1 - b2) = (b4 - b3)", we want to # add information about the parameter names @@ -268,7 +278,9 @@ } } - # ROPE? + # ROPE? -------------------------------------------------------------------- + # -------------------------------------------------------------------------- + if (!is.null(rope)) { table_footer <- paste0( table_footer, @@ -286,6 +298,7 @@ # name of the link-scale, including a transformation ------------------------- +# ---------------------------------------------------------------------------- .link_transform_label <- function(transform, model = NULL) { if (is.character(transform) && length(transform) == 1) { From cb4862d5abd1114fa6cfa490e9da1825fbc90fcf Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 13 Nov 2026 11:19:40 +0100 Subject: [PATCH 54/56] update snap --- tests/testthat/_snaps/print.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testthat/_snaps/print.md b/tests/testthat/_snaps/print.md index d0d14ab0d..a0ecea4ef 100644 --- a/tests/testthat/_snaps/print.md +++ b/tests/testthat/_snaps/print.md @@ -33,7 +33,7 @@ | 100 | high level of education | Female | 13.21 | 0.84 | (11.56, 14.85) | 15.75 | +=========+=================================+=========+=======+======+================+========+ | Variable predicted: neg_c_7
Predictors modulated: c12hour = c(50, 100), c172code, | - | c161sex
Predictors averaged: barthtot (65) | + | c161sex
Predictors held at: barthtot (65) | +=========+=================================+=========+=======+======+================+========+ Table: Conditional Predictions @@ -205,7 +205,7 @@ Variable predicted: neg_c_7 Predictors modulated: c172code = c('low', 'high'), c161sex = c('Female', 'Male') - Predictors averaged: e16sex + Predictors averaged over (balanced grid): e16sex --- @@ -225,7 +225,7 @@ Variable predicted: neg_c_7 Predictors modulated: c172code = c('low', 'high'), c161sex = c('Female', 'Male') - Predictors averaged: e16sex + Predictors averaged over (balanced grid): e16sex # estimate_epectation - don't print empty RE columns @@ -246,7 +246,7 @@ Variable predicted: count Predictors modulated: spp - Predictors controlled: mined (yes) + Predictors held at: mined (yes) Predictions are on the conditional-scale. # print - layouts and include data grid @@ -337,7 +337,7 @@ Variable predicted: wt Predictors modulated: qsec - Predictors controlled: mpg (20) + Predictors held at: mpg (20) --- @@ -361,5 +361,5 @@ Variable predicted: wt Predictors modulated: qsec - Predictors controlled: mpg (20) + Predictors held at: mpg (20) From 368f967aca45558eddc9c838f7b3b69aee5fb092 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 13 Nov 2026 11:21:16 +0100 Subject: [PATCH 55/56] snap --- tests/testthat/_snaps/windows/print.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/testthat/_snaps/windows/print.md b/tests/testthat/_snaps/windows/print.md index 9c7990db5..a0937d718 100644 --- a/tests/testthat/_snaps/windows/print.md +++ b/tests/testthat/_snaps/windows/print.md @@ -140,7 +140,7 @@ Variable predicted: neg_c_7 Predictors modulated: c12hour, c172code, c161sex - Predictors averaged: barthtot (65) + Predictors held at: barthtot (65) --- @@ -406,7 +406,7 @@ Female | high level of education | male | Care Level 3/3+ | 0 | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 Male | low level of education | female | Care Level 3/3+ | 0 | 8.50 | 1.61 | [ 5.33, 11.67] | 5.27 Female | low level of education | female | Care Level 3/3+ | 0 | 8.67 | 1.32 | [ 6.08, 11.26] | 6.58 - Male | intermediate level of education | female | Care Level 3/3+ | 0 | 9.13 | 0.81 | [ 7.54, 10.71] | 11.31 + Male | intermediate level of education | female | Care Level 3/3+ | 0 | 9.12 | 0.81 | [ 7.54, 10.71] | 11.31 Female | intermediate level of education | female | Care Level 3/3+ | 0 | 9.78 | 0.76 | [ 8.28, 11.27] | 12.86 Male | high level of education | female | Care Level 3/3+ | 0 | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 Female | high level of education | female | Care Level 3/3+ | 0 | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 @@ -492,7 +492,7 @@ Female | | | | | 11.00 | 2.28 | [ 6.51, 15.49] | 4.82 Male | low level of education | female | | | 8.50 | 1.61 | [ 5.33, 11.67] | 5.27 Female | | | | | 8.67 | 1.32 | [ 6.08, 11.26] | 6.58 - Male | intermediate level of education | | | | 9.13 | 0.81 | [ 7.54, 10.71] | 11.31 + Male | intermediate level of education | | | | 9.12 | 0.81 | [ 7.54, 10.71] | 11.31 Female | | | | | 9.78 | 0.76 | [ 8.28, 11.27] | 12.86 Male | high level of education | | | | 9.00 | 2.28 | [ 4.51, 13.49] | 3.94 Female | | | | | 9.00 | 1.32 | [ 6.41, 11.59] | 6.83 @@ -556,7 +556,7 @@ Variable predicted: neg_c_7 Predictors modulated: c160age=[fivenum], c161sex - Predictors controlled: barthtot (65), e16sex (male) + Predictors held at: barthtot (65), e16sex (male) --- @@ -580,5 +580,6 @@ Variable predicted: neg_c_7 Predictors modulated: c160age=[fivenum], c161sex - Predictors averaged: barthtot (65), e16sex + Predictors held at: barthtot (65) + Predictors averaged over (balanced grid): e16sex From d2cc5f4e24b5d27a848e645ec573628acc8485c0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 13 Nov 2026 11:22:45 +0100 Subject: [PATCH 56/56] win-snap --- .../_snaps/windows/estimate_contrasts_counterfactual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md index 83f9d091b..9a2687b6e 100644 --- a/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md +++ b/tests/testthat/_snaps/windows/estimate_contrasts_counterfactual.md @@ -9,7 +9,7 @@ --------------------------------------------------------------------------------- post | pre | control | 1.85 | 1.22 | [-0.53, 4.23] | 1.52 | 0.128 end | pre | control | 0.86 | 1.21 | [-1.51, 3.24] | 0.71 | 0.477 - end | post | control | -0.99 | 1.22 | [-3.37, 1.39] | -0.81 | 0.417 + end | post | control | -0.99 | 1.22 | [-3.37, 1.40] | -0.81 | 0.417 post | pre | tx | 6.57 | 1.57 | [ 3.50, 9.65] | 4.19 | < .001 end | pre | tx | 17.26 | 1.57 | [14.18, 20.34] | 10.99 | < .001 end | post | tx | 10.69 | 1.57 | [ 7.62, 13.76] | 6.82 | < .001