From 3d578a98c0e21e87ae15bdb8eaa496eed9399558 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 28 Jan 2025 17:22:17 +0100 Subject: [PATCH 01/51] Fix due to changes in {marginaleffects} --- DESCRIPTION | 3 ++- R/test_predictions.R | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d7fedd81..eaf79e68 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: ggeffects Type: Package Encoding: UTF-8 Title: Create Tidy Data Frames of Marginal Effects for 'ggplot' from Model Outputs -Version: 2.1.0 +Version: 2.1.0.1 Authors@R: c( person("Daniel", "Lüdecke", role = c("aut", "cre"), email = "d.luedecke@uke.de", comment = c(ORCID = "0000-0002-8895-3206")), person("Frederik", "Aust", role = "ctb", comment = c(ORCID = "0000-0003-4900-788X")), @@ -108,3 +108,4 @@ Config/testthat/edition: 3 Roxygen: list(markdown = TRUE) License: MIT + file LICENSE LazyData: true +Remotes: vincentarelbundock/marginaleffects diff --git a/R/test_predictions.R b/R/test_predictions.R index 291cb217..d62feaa4 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -596,6 +596,9 @@ test_predictions.default <- function(object, df <- .get_df(object) } + # hypothesis arg needs to be a formula for marginaleffects > 0.24.0 + hypothesis_arg <- stats::as.formula(paste("~", test)) + # =========================================================================== # the following, very long code block, mainly does two things: first, extract # the requested pairwise comparisons or contrasts, either for slopes or for @@ -646,7 +649,7 @@ test_predictions.default <- function(object, variables = focal[1], by = focal[2:length(focal)], newdata = datagrid, - hypothesis = test, + hypothesis = hypothesis_arg, df = df, conf_level = ci_level ) @@ -756,7 +759,7 @@ test_predictions.default <- function(object, by = by_arg, variables = by_variables, newdata = datagrid, - hypothesis = test, + hypothesis = hypothesis_arg, df = df, conf_level = ci_level ) From a7e1f7e050ea3c798a5d5a460be526780caf6fee Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 29 Jan 2025 14:13:38 +0100 Subject: [PATCH 02/51] fix --- R/utils_test_predictions.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/utils_test_predictions.R b/R/utils_test_predictions.R index ecb1aa46..c722da4e 100644 --- a/R/utils_test_predictions.R +++ b/R/utils_test_predictions.R @@ -8,10 +8,14 @@ if (include_random) { all_args$re.form <- NULL # avoid message - suppressMessages(suppressWarnings(do.call(get(fun, asNamespace("marginaleffects")), all_args))) + out <- suppressMessages(suppressWarnings(do.call(get(fun, asNamespace("marginaleffects")), all_args))) } else { - do.call(get(fun, asNamespace("marginaleffects")), all_args) + out <- do.call(get(fun, asNamespace("marginaleffects")), all_args) } + # clean column names + colnames(out)[tolower(colnames(out)) == "hypothesis"] <- "term" + # return + out } From db591cf310f24bbc5ee48390ab9859d88bf773b2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 29 Jan 2025 14:37:17 +0100 Subject: [PATCH 03/51] fix --- R/test_predictions.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/test_predictions.R b/R/test_predictions.R index d62feaa4..30088464 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -597,7 +597,11 @@ test_predictions.default <- function(object, } # hypothesis arg needs to be a formula for marginaleffects > 0.24.0 - hypothesis_arg <- stats::as.formula(paste("~", test)) + if (is.null(test)) { + hypothesis_arg <- NULL + } else { + hypothesis_arg <- stats::as.formula(paste("~", test)) + } # =========================================================================== # the following, very long code block, mainly does two things: first, extract From 90a9fe96e6c307b62abb18e6be88010c24af3937 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 30 Jan 2025 17:48:03 +0100 Subject: [PATCH 04/51] Update test-test_predictions_emmeans.R --- tests/testthat/test-test_predictions_emmeans.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-test_predictions_emmeans.R b/tests/testthat/test-test_predictions_emmeans.R index 85e1d7bf..fad5ce78 100644 --- a/tests/testthat/test-test_predictions_emmeans.R +++ b/tests/testthat/test-test_predictions_emmeans.R @@ -17,7 +17,7 @@ test_that("test_predictions, engine emmeans", { # categorical out1 <- test_predictions(m, "c172code") out2 <- test_predictions(m, "c172code", engine = "emmeans") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-3) + expect_equal(out1$Contrast, out2$Contrast * -1, tolerance = 1e-3) expect_identical(out1$c172code, out2$c172code) expect_equal(attributes(out1)$standard_error, attributes(out2)$standard_error, tolerance = 1e-3) From be278ba1110a5d6a2b948f334cc0ed26975e0a00 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 30 Jan 2025 19:35:53 +0100 Subject: [PATCH 05/51] fix --- tests/testthat/test-glmmTMB.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-glmmTMB.R b/tests/testthat/test-glmmTMB.R index e718b4e0..07d82383 100644 --- a/tests/testthat/test-glmmTMB.R +++ b/tests/testthat/test-glmmTMB.R @@ -146,6 +146,7 @@ test_that("ggpredict, glmmTMB", { test_that("ggpredict and ggaverage, glmmTMB", { + data(Salamanders, package = "glmmTMB") mx <- glmmTMB::glmmTMB( count ~ mined + (1 | site), ziformula = ~mined, From 4eed5f8a9cd8aa6b614be49d498895e9b4e8fcca Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 31 Jan 2025 14:05:01 +0100 Subject: [PATCH 06/51] Update DESCRIPTION --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index eaf79e68..5cb1874f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: ggeffects Type: Package Encoding: UTF-8 Title: Create Tidy Data Frames of Marginal Effects for 'ggplot' from Model Outputs -Version: 2.1.0.1 +Version: 2.1.0.2 Authors@R: c( person("Daniel", "Lüdecke", role = c("aut", "cre"), email = "d.luedecke@uke.de", comment = c(ORCID = "0000-0002-8895-3206")), person("Frederik", "Aust", role = "ctb", comment = c(ORCID = "0000-0003-4900-788X")), From 02b597ef3e58281b91ef071e4242ae35fa6b0eb3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 31 Jan 2025 20:59:28 +0100 Subject: [PATCH 07/51] fix --- R/test_predictions.R | 2 ++ R/utils_test_predictions.R | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/R/test_predictions.R b/R/test_predictions.R index 30088464..cc800e67 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -599,6 +599,8 @@ test_predictions.default <- function(object, # hypothesis arg needs to be a formula for marginaleffects > 0.24.0 if (is.null(test)) { hypothesis_arg <- NULL + } else if (.is_custom_hypothesis(test)) { + hypothesis_arg <- test } else { hypothesis_arg <- stats::as.formula(paste("~", test)) } diff --git a/R/utils_test_predictions.R b/R/utils_test_predictions.R index c722da4e..8dd67c2b 100644 --- a/R/utils_test_predictions.R +++ b/R/utils_test_predictions.R @@ -19,6 +19,15 @@ } +.is_custom_hypothesis <- function(x) { + !is.null(x) && + length(x) == 1 && + is.character(x) && + grepl("=", x, fixed = TRUE) && + grepl("\\bb\\d+\\b", x) +} + + .validate_by_argument <- function(by, datagrid) { # check for valid by-variable if (!is.null(by)) { From 428f2f9b31c4e72737eb442ad8ababce4d7ce946 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 31 Jan 2025 21:10:37 +0100 Subject: [PATCH 08/51] fix --- tests/testthat/test-ggaverage.R | 4 ++-- tests/testthat/test-pool_comparisons.R | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-ggaverage.R b/tests/testthat/test-ggaverage.R index 4a2ce086..6b48f7cc 100644 --- a/tests/testthat/test-ggaverage.R +++ b/tests/testthat/test-ggaverage.R @@ -23,7 +23,7 @@ test_that("ggaverage works with condition", { # test predictions out <- test_predictions(out1) - expect_equal(out$Contrast[c(1, 3)], -diff(out1$predicted), tolerance = 1e-4) + expect_equal(out$Contrast[c(1, 3)], diff(out1$predicted), tolerance = 1e-4) expect_equal(out$p.value, c(0.3571, 0.42296, 0.76791), tolerance = 1e-4) d <- data_grid(moff, "x2", condition = c(offset_1 = 2)) @@ -36,6 +36,6 @@ test_that("ggaverage works with condition", { # test predictions out <- test_predictions(out1) - expect_equal(out$Contrast[c(1, 3)], -diff(out1$predicted), tolerance = 1e-4) + expect_equal(out$Contrast[c(1, 3)], diff(out1$predicted), tolerance = 1e-4) expect_equal(out$p.value, c(0.3571, 0.42296, 0.76791), tolerance = 1e-4) }) diff --git a/tests/testthat/test-pool_comparisons.R b/tests/testthat/test-pool_comparisons.R index 1db94d40..e91de717 100644 --- a/tests/testthat/test-pool_comparisons.R +++ b/tests/testthat/test-pool_comparisons.R @@ -11,6 +11,6 @@ test_that("ggeffects, pool comparisons", { hypothesis_test(m, "age") }) pool_com <- pool_comparisons(comparisons) - expect_equal(pool_com$Contrast, c(4.6464, 6.70639, 2.05999), tolerance = 1e-3) - expect_equal(pool_com$conf.low, c(-0.3772104, -1.3017958, -4.4172299), tolerance = 1e-3) + expect_equal(pool_com$Contrast, c(-4.6464, -6.70639, -2.05999), tolerance = 1e-3) + expect_equal(pool_com$conf.high, c(0.3772104, 1.3017958, 4.4172299), tolerance = 1e-3) }) From bd2d99c84ece25fec137cc4fff4d24db31fa448e Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 1 Feb 2025 10:44:30 +0100 Subject: [PATCH 09/51] use modelbased --- DESCRIPTION | 3 +- R/test_predictions.R | 488 ++-------------------------------------- man/test_predictions.Rd | 9 +- 3 files changed, 23 insertions(+), 477 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5cb1874f..dc5a3027 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -63,6 +63,7 @@ Suggests: logistf, logitr, marginaleffects (>= 0.24.0), + modelbased, MASS, Matrix, mice, @@ -108,4 +109,4 @@ Config/testthat/edition: 3 Roxygen: list(markdown = TRUE) License: MIT + file LICENSE LazyData: true -Remotes: vincentarelbundock/marginaleffects +Remotes: vincentarelbundock/marginaleffects, easystats/modelbased diff --git a/R/test_predictions.R b/R/test_predictions.R index cc800e67..b8483c80 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -392,7 +392,6 @@ test_predictions.default <- function(object, p_adjust = NULL, df = NULL, ci_level = 0.95, - collapse_levels = FALSE, margin = "mean_reference", condition = NULL, engine = "marginaleffects", @@ -403,11 +402,6 @@ test_predictions.default <- function(object, # --------------------------------------------------------------------------- margin <- .tp_validate_margin(margin) - # handle alias - "slope" or "trend" are aliases for simply setting it to NULL - if (!is.null(test) && !is.data.frame(test) && !inherits(test, "formula") && test %in% c("trend", "slope")) { # nolint - test <- NULL - } - # check engine and check for installed packages ----------------------------- # check if we have the appropriate package version installed # --------------------------------------------------------------------------- @@ -424,19 +418,6 @@ test_predictions.default <- function(object, } miss_scale <- missing(scale) - # random effects ----------------------------------------------------------- - # check if we have random effects in the model, and if pairwise comparisons - # should be done for randome effects only (i.e. all focal terms are specified - # as random effects in the model). If so, we need to tell the user that they - # have to use `engine = "ggeffects"` - # --------------------------------------------------------------------------- - random_pars <- insight::find_random(object, split_nested = TRUE, flatten = TRUE) - if (verbose && !is.null(random_pars) && all(.clean_terms(terms) %in% random_pars)) { - insight::format_alert( - "All focal terms are included as random effects in the model. To calculate pairwise comparisons for random effects, use `engine = \"ggeffects\"`." # nolint - ) - } - # dot-arguments ------------------------------------------------------------- # evaluate dots - remove conflicting additional arguments. We have our own # "scale" argument that modulates the "type" and "transform" arguments @@ -475,460 +456,25 @@ test_predictions.default <- function(object, )) } - minfo <- insight::model_info(object, verbose = FALSE) - model_data <- .get_model_data(object) - - # make sure that we have logistic regression when scale is "oddsratios" - if (scale == "oddsratios" && !minfo$is_logit) { - insight::format_error( - "Argument `scale = \"oddsratios\"` is only supported for logistic regression models." - ) - } - # make sure that we have count regression when scale is "irr" - if (scale == "irr" && !minfo$is_count) { - insight::format_error( - "Argument `scale = \"irr\"` is only supported for count models (Poisson, negative binomial, ...)." - ) - } - - # for mixed models, we need different handling later... - need_average_predictions <- include_random <- insight::is_mixed_model(object) - # for "marginalmeans", don't condition on random effects - if (margin == "marginalmeans" && include_random) { - include_random <- FALSE - dot_args$re.form <- NA - } - - # for zero-inflation probabilities, we need to set "need_average_predictions" - # to FALSE, else no confidence intervals will be returned. - if (scale %in% c("zi_prob", "zero", "zprob")) { - need_average_predictions <- FALSE - } - - # by-variables are included in terms - if (!is.null(by)) { - terms <- unique(c(terms, by)) - } - - # we want contrasts or comparisons for these focal predictors... - focal <- .clean_terms(terms) - random_group <- NULL - - # check if we have a mixed model - in this case, we need to ensure that our - # random effect variable (group factor) is included in the grid - if (need_average_predictions) { - random_group <- insight::find_random(object, split_nested = TRUE, flatten = TRUE) - if (!all(random_group %in% terms)) { - terms <- unique(c(terms, random_group)) - } - } - - # data grids ----------------------------------------------------------------- - # we need data grids only for marginal means or mean/mode, not for - # counterfactuals predictions that average over non-focal terms. - # ---------------------------------------------------------------------------- - - # data grid, varies depending on "margin" argument. For "marginalmeans", - # we need a balanced data grid - if (margin == "marginalmeans") { - datagrid <- marginaleffects::datagrid(model = object, grid_type = "balanced") - } else { - datagrid <- data_grid( - object, - terms, - condition = condition, - group_factor = random_group, - ... - ) - # make sure characters are preserved - for (i in colnames(datagrid)) { - if (i %in% colnames(model_data) && is.character(model_data[[i]])) { - datagrid[[i]] <- as.character(datagrid[[i]]) - } - } - } - - # check for valid by-variable - by <- .validate_by_argument(by, datagrid) - by_arg <- NULL - # for models with ordinal/categorical outcome, we need focal terms and - # response variable as "by" argument - if (minfo$is_ordinal || minfo$is_multinomial) { - by_arg <- unique(c(focal, insight::find_response(object))) - } else if (margin %in% c("marginalmeans", "empirical")) { - # for "marginalmeans", when we have a balanced data grid, we also need the - # focal term(s) as by-argument. And we need them for "empirical". - by_arg <- focal - } - - # sanity check - variable names in the grid should not "mask" standard names - # from the marginal effects output - reserved <- c( - "group", "term", "contrast", "estimate", "std.error", "statistic", "conf.low", - "conf.high", "p.value", "p.value.nonsup", "p.value.noninf", "type" + marginalize <- switch(margin, + mean_reference = , + mean_mode = "specific", + marginalmeans = "average", + "population" ) - invalid_names <- reserved %in% colnames(datagrid) - if (any(invalid_names)) { - insight::format_error( - "Some variable names in the model are not allowed when using `test_predictions()` because they are reserved by the internally used {.pkg marginaleffects} package.", # nolint - paste0("Please rename following variables and fit your model again: ", toString(paste0("`", reserved[invalid_names], "`"))) # nolint - ) - } - - # comparisons only make sense if we have at least two predictors, or if - # we have one categorical - focal_numeric <- vapply(datagrid[focal], is.numeric, TRUE) - focal_other <- !focal_numeric - hypothesis_label <- rope_range <- NULL - - # do we want an equivalence-test? - if (!is.null(equivalence)) { - if (all(equivalence == "default")) { - insight::check_if_installed("bayestestR") - rope_range <- bayestestR::rope_range(object) - } else { - rope_range <- equivalence - } - } - - # extract degrees of freedom - if (is.null(df)) { - df <- .get_df(object) - } - - # hypothesis arg needs to be a formula for marginaleffects > 0.24.0 - if (is.null(test)) { - hypothesis_arg <- NULL - } else if (.is_custom_hypothesis(test)) { - hypothesis_arg <- test - } else { - hypothesis_arg <- stats::as.formula(paste("~", test)) - } - - # =========================================================================== - # the following, very long code block, mainly does two things: first, extract - # the requested pairwise comparisons or contrasts, either for slopes or for - # categorical predictors. The result is a data frame named ".comparisons". - # second, a very long block of code extracts the labels for the contrasts or - # comparisons, to have nice, readable labels in the printed output. That data - # frame is named "out". At the end of this function, we combine both data. - # =========================================================================== - # numeric focal terms (slopes) ---------------------------------------------- - # we *only* calculate (average) slopes when numeric focal terms come first - # thus, we don't need to care about the "margin" argument here - # --------------------------------------------------------------------------- - - # if *first* focal predictor is numeric, compute average slopes - if (isTRUE(focal_numeric[1])) { - # just the "trend" (slope) of one focal predictor - if (length(focal) == 1) { - # contrasts of slopes --------------------------------------------------- - # here comes the code to test wether a slope is significantly different - # from null (contrasts) - # ----------------------------------------------------------------------- - - # argument "test" will be ignored for average slopes - test <- NULL - # prepare argument list for "marginaleffects::slopes" - # we add dot-args later, that modulate the scale of the contrasts - fun_args <- list( - model = object, - variables = focal, - df = df, - conf_level = ci_level - ) - .comparisons <- .call_me("avg_slopes", fun_args, dot_args, include_random) - # "extracting" labels for this simple case is easy... - out <- data.frame(x_ = "slope", stringsAsFactors = FALSE) - colnames(out) <- focal - } else { - # pairwise comparison of slopes ----------------------------------------- - # here comes the code to test wether slopes between groups are - # significantly different from each other (pairwise comparison) - # ----------------------------------------------------------------------- - - # prepare argument list for "marginaleffects::slopes" - # we add dot-args later, that modulate the scale of the contrasts - fun_args <- list( - model = object, - variables = focal[1], - by = focal[2:length(focal)], - newdata = datagrid, - hypothesis = hypothesis_arg, - df = df, - conf_level = ci_level - ) - # "trends" (slopes) of numeric focal predictor by group levels - # of other focal predictor - .comparisons <- .call_me("slopes", fun_args, dot_args, include_random) - - # labelling terms ------------------------------------------------------ - # here comes the code for extracting nice term labels - # ---------------------------------------------------------------------- - - # for pairwise comparisons, we need to extract contrasts - if (!is.null(test) && !inherits(test, "formula") && all(test == "pairwise")) { - # pairwise comparisons of slopes -------------------------------------- - # here comes the code to extract labels for pairwise comparison of slopes - # --------------------------------------------------------------------- - - # extract labels - result <- .tp_label_pairwise_slopes(.comparisons, datagrid, focal) - # update objects - .comparisons <- result$.comparison - out <- result$out - } else if (is.null(test)) { - # contrasts of slopes ------------------------------------------------- - # here comes the code to extract labels for trends of slopes - # --------------------------------------------------------------------- - - # if we have simple slopes without pairwise comparisons, we can - # copy the information directly from the marginaleffects-object - grid_categorical <- as.data.frame( - .comparisons[focal[2:length(focal)]], - stringsAsFactors = FALSE - ) - out <- cbind(data.frame(x_ = "slope", stringsAsFactors = FALSE), grid_categorical) - colnames(out) <- focal - } else if (inherits(test, "formula")) { - # formulas ----------------------------------------------- - # here comes the code to extract labels from formula tests - # -------------------------------------------------------- - - columns_to_select <- c("hypothesis", intersect(focal, colnames(.comparisons))) - out <- as.data.frame(.comparisons[columns_to_select], stringsAsFactors = FALSE) - } else { - # hypothesis testing of slopes ---------------------------------------- - # here comes the code to extract labels for special hypothesis tests - # --------------------------------------------------------------------- - - # extract labels - result <- .tp_label_hypothesis_slopes( - .comparisons, - object = object, - focal = focal, - df = df, - ci_level = ci_level, - dot_args = dot_args, - include_random = include_random, - test = test - ) - # update objects - hypothesis_label <- result$hypothesis_label - out <- result$out - } - } - estimate_name <- ifelse(is.null(test), "Slope", "Contrast") - } else { - # testing groups (factors) ------------------------------------------------ - # Here comes the code for pairwise comparisons of categorical focal terms - # ------------------------------------------------------------------------- - - by_variables <- NULL # for average predictions - fun <- "predictions" - - # "variables" argument ---------------------------------------------------- - # for mixed models, and for "marginalmeans" and "empirical", we need to - # provide the "variables" argument to "marginaleffects::predictions". - # furthermore, for mixed models, we average across random effects and thus - # use "avg_predictions" instead of "predictions" - # ------------------------------------------------------------------------- - - if (need_average_predictions) { - # marginaleffects handles single and multiple variables differently here - if (length(focal) > 1) { - by_variables <- sapply(focal, function(i) unique(datagrid[[i]]), simplify = FALSE) # nolint - } else { - by_variables <- focal - } - by_arg <- NULL - fun <- "avg_predictions" - } else if (margin %in% c("marginalmeans", "empirical")) { - # for "marginalmeans", we need "variables" argument. This must be a list - # with representative values. Else, we cannot calculate comparisons at - # representative values of the balanced data grid - by_variables <- .data_grid( - object, - model_frame = model_data, - terms = terms, - typical = "mean", - condition = condition, - emmeans_only = TRUE, - verbose = FALSE - ) - } - # prepare argument list for "marginaleffects::predictions" - # we add dot-args later, that modulate the scale of the contrasts - fun_args <- list( - model = object, - by = by_arg, - variables = by_variables, - newdata = datagrid, - hypothesis = hypothesis_arg, - df = df, - conf_level = ci_level - ) - # for counterfactual predictions, we need no data grid - if (margin == "empirical") { - fun_args$newdata <- NULL - } - .comparisons <- .call_me(fun, fun_args, dot_args, include_random) - - # nice term labels -------------------------------------------------------- - # here comes the code for extracting nice term labels --------------------- - # ------------------------------------------------------------------------- - - # pairwise comparisons - we now extract the group levels from the "term" - # column and create separate columns for contrats of focal predictors - if (!is.null(test) && !inherits(test, "formula") && all(test == "pairwise")) { - ## pairwise comparisons of group levels ----- - out <- .tp_label_pairwise_categorical( - .comparisons, - datagrid = datagrid, - focal = focal, - need_average_predictions = need_average_predictions, - margin = margin, - by_variables = by_variables, - minfo = minfo - ) - } else if (is.null(test)) { - ## contrasts of group levels ----- - - # we have simple contrasts - we can just copy from the data frame - # returned by "marginaleffects" to get nice labels - out <- as.data.frame(.comparisons[focal], stringsAsFactors = FALSE) - } else if (inherits(test, "formula")) { - ## formula ----- - result <- .tp_label_hypothesis_formula( - .comparisons, - focal = focal, - margin = margin, - model_data = model_data, - test = test - ) - # update objects - hypothesis_label <- result$hypothesis_label - out <- result$out - } else { - ## hypothesis testing of group levels ----- - result <- .tp_label_hypothesis_categorical( - .comparisons, - need_average_predictions = need_average_predictions, - margin = margin, - object = object, - by_variables = by_variables, - datagrid = datagrid, - df = df, - ci_level = ci_level, - dot_args = dot_args, - include_random = include_random, - focal = focal, - test = test - ) - # update objects - hypothesis_label <- result$hypothesis_label - out <- result$out - } - estimate_name <- ifelse(is.null(test), "Predicted", "Contrast") - } - - # add result from equivalence test - if (!is.null(rope_range)) { - .comparisons <- marginaleffects::hypotheses(.comparisons, equivalence = rope_range, conf_level = ci_level) - .comparisons$p.value <- .comparisons$p.value.equiv - } - - # further results - out[[estimate_name]] <- .comparisons$estimate - out$conf.low <- .comparisons$conf.low - out$conf.high <- .comparisons$conf.high - out$p.value <- .comparisons$p.value - - # for pairwise comparisons, we may have comparisons inside one level when we - # have multiple focal terms, like "1-1" and "a-b". In this case, the comparison - # of 1 to 1 ("1-1") is just the contrast for the level "1", we therefore can - # collpase that string - if (isTRUE(collapse_levels)) { - out <- .collapse_levels(out, datagrid, focal, by) - } - - # replace back commas - for (i in focal) { - # in ".fix_comma_levels()", we replaced "," by "#*#", and now - # we need to revert this, to preserve original level strings - if (any(grepl("#*#", out[[i]], fixed = TRUE))) { - out[[i]] <- gsub("#*#", ",", out[[i]], fixed = TRUE) - } - } - - # filter by-variables? - if (!is.null(by)) { - for (by_factor in by) { - # values in "by" are character vectors, which are saved as "level-level". - # we now extract the unique values, and filter the data frame - unique_values <- unique(datagrid[[by_factor]]) - by_levels <- paste0(unique_values, "-", unique_values) - keep_rows <- out[[by_factor]] %in% c(by_levels, unique_values) - # filter final data frame - out <- out[keep_rows, , drop = FALSE] - # but we also need to filter the ".comparisons" data frame - .comparisons <- .comparisons[keep_rows, , drop = FALSE] - # finally, replace "level-level" just by "level" - for (i in seq_along(by_levels)) { - out[[by_factor]] <- gsub( - by_levels[i], - unique_values[i], - out[[by_factor]], - fixed = TRUE - ) - } - } - # remove by-terms from focal terms - focal <- focal[!focal %in% by] - } - - # p-value adjustment? - if (!is.null(p_adjust)) { - out <- .p_adjust(out, p_adjust, datagrid, focal, .comparisons$statistic, df, verbose) - } - - # add back response levels? - if ("group" %in% colnames(.comparisons)) { - out <- cbind( - data.frame(response.level = .comparisons$group, stringsAsFactors = FALSE), - out - ) - } else if (minfo$is_ordinal || minfo$is_multinomial) { - resp_levels <- levels(insight::get_response(object, verbose = FALSE)) - if (!is.null(resp_levels) && all(rowMeans(sapply(resp_levels, grepl, .comparisons$term, fixed = TRUE)) > 0)) { # nolint - colnames(out)[seq_along(focal)] <- paste0("Response Level by ", paste0(focal, collapse = " & ")) - if (length(focal) > 1) { - out[2:length(focal)] <- NULL - } - } - } - - class(out) <- c("ggcomparisons", "data.frame") - attr(out, "ci_level") <- ci_level - attr(out, "test") <- test - attr(out, "p_adjust") <- p_adjust - attr(out, "df") <- df - attr(out, "by_factor") <- by - attr(out, "rope_range") <- rope_range - attr(out, "scale") <- scale - attr(out, "scale_label") <- .scale_label(minfo, scale) - attr(out, "linear_model") <- minfo$is_linear - attr(out, "hypothesis_label") <- hypothesis_label - attr(out, "estimate_name") <- estimate_name - attr(out, "verbose") <- verbose - attr(out, "engine") <- "marginaleffects" - attr(out, "datagrid") <- datagrid - attr(out, "standard_error") <- .comparisons$std.error - attr(out, "link_inverse") <- .link_inverse(object, ...) - attr(out, "link_function") <- insight::link_function(object) - - out + modelbased::estimate_contrasts( + object, + contrast = terms, + by = by, + predict = scale, + ci = ci_level, + comparison = test, + marginalize = marginalize, + p_adjust = p_adjust, + equivalence = equivalence, + ... + ) } diff --git a/man/test_predictions.Rd b/man/test_predictions.Rd index 40c3874f..53a8a080 100644 --- a/man/test_predictions.Rd +++ b/man/test_predictions.Rd @@ -22,7 +22,6 @@ hypothesis_test(object, ...) p_adjust = NULL, df = NULL, ci_level = 0.95, - collapse_levels = FALSE, margin = "mean_reference", condition = NULL, engine = "marginaleffects", @@ -186,10 +185,6 @@ the model using \code{\link[insight:get_df]{insight::get_df()}} with \code{type is an object of class \code{ggeffects}, the same \code{ci_level} argument is used as for the predictions, i.e. \code{ci_level} can be ignored.} -\item{collapse_levels}{Logical, if \code{TRUE}, term labels that refer to identical -levels are no longer separated by "-", but instead collapsed into a unique -term label (e.g., \code{"level a-level a"} becomes \code{"level a"}). See 'Examples'.} - \item{margin}{Character string, indicates the method how to marginalize over non-focal terms. See \code{\link[=predict_response]{predict_response()}} for details. If \code{object} is an object of class \code{ggeffects}, the same \code{margin} argument is used as for the @@ -219,6 +214,10 @@ automatically. If this package is not installed as well, \code{engine = "ggeffec is used.} \item{verbose}{Toggle messages and warnings.} + +\item{collapse_levels}{Logical, if \code{TRUE}, term labels that refer to identical +levels are no longer separated by "-", but instead collapsed into a unique +term label (e.g., \code{"level a-level a"} becomes \code{"level a"}). See 'Examples'.} } \value{ A data frame containing predictions (e.g. for \code{test = NULL}), From 109927181bc3bd5ecbec7a3d2a5ef1094d76d88b Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 1 Feb 2025 11:06:11 +0100 Subject: [PATCH 10/51] remove --- NAMESPACE | 8 - R/format.R | 113 -------- R/johnson_neyman.R | 393 +--------------------------- R/johnson_neyman_numcat.R | 372 -------------------------- R/print.R | 351 ------------------------- R/test_predictions.R | 2 +- R/tp_label_hypothesis_categorical.R | 50 ---- R/tp_label_hypothesis_formula.R | 30 --- R/tp_label_hypothesis_slopes.R | 38 --- R/tp_label_pairwise_categorical.R | 106 -------- R/tp_label_pairwise_slopes.R | 41 --- man/johnson_neyman.Rd | 14 +- man/print.Rd | 35 +-- man/test_predictions.Rd | 2 +- 14 files changed, 21 insertions(+), 1534 deletions(-) delete mode 100644 R/johnson_neyman_numcat.R delete mode 100644 R/tp_label_hypothesis_categorical.R delete mode 100644 R/tp_label_hypothesis_formula.R delete mode 100644 R/tp_label_hypothesis_slopes.R delete mode 100644 R/tp_label_pairwise_categorical.R delete mode 100644 R/tp_label_pairwise_slopes.R diff --git a/NAMESPACE b/NAMESPACE index 8db1e6df..3832bbd4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,7 +2,6 @@ S3method("[",ggeffects) S3method(as.data.frame,ggeffects) -S3method(format,ggcomparisons) S3method(format,ggeffects) S3method(get_predictions,Gam) S3method(get_predictions,MCMCglmm) @@ -92,16 +91,9 @@ S3method(get_predictions,zeroinfl) S3method(get_predictions,zerotrunc) S3method(plot,ggalleffects) S3method(plot,ggeffects) -S3method(plot,ggjohnson_neyman) -S3method(plot,ggjohnson_neyman_numcat) S3method(plot,see_equivalence_test_ggeffects) -S3method(print,ggcomparisons) S3method(print,ggeffects) -S3method(print,ggjohnson_neyman) -S3method(print,ggjohnson_neyman_numcat) -S3method(print_html,ggcomparisons) S3method(print_html,ggeffects) -S3method(print_md,ggcomparisons) S3method(print_md,ggeffects) S3method(residualize_over_grid,data.frame) S3method(residualize_over_grid,ggeffects) diff --git a/R/format.R b/R/format.R index 3b5edfa5..c88cc21d 100644 --- a/R/format.R +++ b/R/format.R @@ -209,119 +209,6 @@ format.ggeffects <- function(x, } -#' @rdname print -#' @export -format.ggcomparisons <- function(x, - collapse_ci = FALSE, - collapse_p = FALSE, - combine_levels = FALSE, - ...) { - ci <- attributes(x)$ci_level - by_factor <- attributes(x)$by_factor - estimate_name <- attributes(x)$estimate_name - datagrid <- attributes(x)$datagrid - - out <- insight::standardize_names(x) - attr(out, "ci") <- ci - # format confidence intervals - dots <- list(...) - if (is.null(dots$ci_brackets)) { - dots$ci_brackets <- getOption("ggeffects_ci_brackets", c("", "")) - } - # zap small values by default - if (is.null(dots$zap_small)) { - dots$zap_small <- TRUE - } - # set default for collapse_ci - collapse_ci <- getOption("ggeffects_collapse_ci", collapse_ci) - # set default for collapse_p - collapse_p <- getOption("ggeffects_collapse_p", collapse_p) - - out <- do.call(insight::format_table, c(list(out), dots)) - # collapse p? - out <- .collapse_p(out, collapse_p) - # collapse CI? - out <- .collapse_ci(out, collapse_ci, ci_brackets = dots$ci_brackets) - # mix levels and re-combine? - out <- .combine_level_pairs(out, combine_levels, datagrid, estimate_name, by_factor) - out -} - - -# helper ---------------------------------------------------------------------- - -# helper to re-arrange column values. Each column no longer represents pairs of -# the same focal term, but the levels of the first comparison of each focal -# term against the second. e.g. instead "education = low-high" and -# "sex = male-female", it will become "first = low-male" and "second = high-female" -.combine_level_pairs <- function(x, combine_levels, datagrid, estimate_name, by_factor = NULL) { - if (!combine_levels) { - return(x) - } - # retrieve columns that represent focal terms, but exclude group-by variable - focal_terms <- colnames(x)[1:(which(colnames(x) == estimate_name) - 1)] - focal_terms <- setdiff(focal_terms, by_factor) - # check if some of the levels contain a hyphen, which is used to separate - # the levels of the first and second comparison. If so, we need to temporatily - # replace the hyphen with another character, so that we can split the levels - needs_preparation <- focal_terms[vapply(datagrid[focal_terms], function(i) { - any(grepl("-", i, fixed = TRUE)) - }, logical(1))] - if (length(needs_preparation)) { - for (i in needs_preparation) { - unique_values <- as.character(unique(datagrid[[i]])) - for (j in unique_values) { - j_new <- gsub("-", "#_#", j, fixed = TRUE) - x[[i]] <- gsub(j, j_new, x[[i]], fixed = TRUE) - } - } - } - # separate columns, so we have one column for each level of the focal terms - out <- datawizard::data_separate( - x, - focal_terms, - guess_columns = "mode", - separator = "-", - append = FALSE - ) - # check if we need to replace special characters back to hyphens - if (length(needs_preparation)) { - for (i in needs_preparation) { - # if yes, we need to find the new columnsm which are no longer named - # "a" or "b", but "a_1", "a_2" etc. - split_columns <- grep(paste0(i, "_", "\\d"), colnames(out), value = TRUE) - for (j in split_columns) { - # add back hypen - out[[j]] <- gsub("#_#", "-", out[[j]], fixed = TRUE) - } - } - } - # unite split columns again. we need to do this for each split-part separately - split_parts <- unique(gsub("(.*)_(\\d)", "\\2", grep("_\\d$", colnames(out), value = TRUE))) - for (i in split_parts) { - # find columns that belong to the same focal term - unite_columns <- grep( - paste0("(", paste(focal_terms, collapse = "|"), ")_", i), - colnames(out), - value = TRUE - ) - out <- datawizard::data_relocate( - datawizard::data_unite( - out, - select = unite_columns, - new_column = paste("Pair", i), - append = FALSE, - separator = "-" - ), - select = "^Pair", - regex = TRUE - ) - } - # finished... - out -} - - .collapse_ci <- function(x, collapse_ci, ci_brackets) { # collapse CI? ci_column <- grep("\\d{2}% CI", colnames(x)) diff --git a/R/johnson_neyman.R b/R/johnson_neyman.R index a245ea75..d10a3f33 100644 --- a/R/johnson_neyman.R +++ b/R/johnson_neyman.R @@ -68,7 +68,7 @@ #' Moderated Regression. Journal of Marketing Research, 50(2), 277–288. #' doi:10.1509/jmr.12.0420 #' -#' @examplesIf requireNamespace("ggplot2") && requireNamespace("marginaleffects") +#' @examplesIf all(insight::check_if_installed(c("ggplot2", "marginaleffects", "modelbased"), quietly = TRUE)) #' \dontrun{ #' data(efc, package = "ggeffects") #' efc$c172code <- as.factor(efc$c172code) @@ -78,7 +78,7 @@ #' johnson_neyman(pr) #' plot(johnson_neyman(pr)) #' -#' pr <- predict_response(m, c("c12hour", "c172code", "barthtot")) +#' pr <- predict_response(m, c("c12hour", "barthtot", "c172code")) #' johnson_neyman(pr) #' plot(johnson_neyman(pr)) #' @@ -109,7 +109,6 @@ johnson_neyman <- function(x, precision = 500, p_adjust = NULL, ...) { # extract focal terms focal_terms <- attributes(x)$terms - original_terms <- attributes(x)$original.terms dot_args <- list(...) # information about vcov-matrix @@ -137,95 +136,17 @@ johnson_neyman <- function(x, precision = 500, p_adjust = NULL, ...) { insight::format_error("At least one numeric focal term is required.") } - # if we have only one numeric focal term, we create contrasts - # by levels of categorical focal term - if (sum(numeric_focal) < 2) { - return(johnson_neyman_numcat( - x, - model = model, - model_data = model_data, - focal_terms = focal_terms, - original_terms = original_terms, - numeric_focal = numeric_focal, - dot_args = dot_args, - p_adjust = p_adjust, - precision = round(precision / 3) - )) - } - - # first and last element of numeric_focal must be TRUE - if (!numeric_focal[1] && !numeric_focal[length(numeric_focal)]) { - insight::format_error("First and last focal term must be numeric.") - } - - # now compute contrasts. we first need to make sure to have enough data points - pr <- pretty(model_data[[focal_terms[length(focal_terms)]]], n = precision) - - # modify "terms" argument - original_terms[length(original_terms)] <- paste0(focal_terms[length(focal_terms)], " [", toString(pr), "]") - # calculate contrasts of slopes - fun_args <- list(model, terms = original_terms, test = NULL) + fun_args <- list( + model, + terms = focal_terms[1], + by = focal_terms[2:length(focal_terms)], + test = "comparison" + ) if (identical(p_adjust, "fdr")) { fun_args$p_adjust <- "fdr" } - jn_slopes <- do.call("test_predictions", c(fun_args, dot_args)) - - # we need a "Slope" column in jn_slopes - if (!"Slope" %in% colnames(jn_slopes)) { - insight::format_error("No slope information found.") - } - - # p-adjustment based on Esarey and Sumner? - if (identical(p_adjust, "es")) { - jn_slopes <- .fdr_interaction(jn_slopes, focal_terms, model) - } - - # remove first element from "focal_terms" and "numeric_focal" - # the first element is "Slope" - focal_terms <- focal_terms[-1] - numeric_focal <- numeric_focal[-1] - - # if we still have two focal terms, check if all are numeric - if (length(numeric_focal) == 2 && all(numeric_focal)) { - # if so, convert first to factor - jn_slopes[[focal_terms[1]]] <- as.factor(jn_slopes[[focal_terms[1]]]) - } - # now add variable name to factor levels, as "heading" in facets - if (is.factor(jn_slopes[[focal_terms[1]]])) { - levels(jn_slopes[[focal_terms[1]]]) <- paste(focal_terms[1], "=", levels(jn_slopes[[focal_terms[1]]])) - } - - # add a new column to jn_slopes, which indicates whether confidence intervals - # cover zero - jn_slopes$significant <- ifelse(jn_slopes$conf.low > 0 | jn_slopes$conf.high < 0, "yes", "no") - - # p-adjustment based on fdr? we then need to update the significant-column here - if (identical(p_adjust, "fdr")) { - jn_slopes$significant[jn_slopes$p.value >= 0.05] <- "no" - } - - # find groups, if we have three focal terms - if (length(focal_terms) > 1) { - groups <- split(jn_slopes, jn_slopes[[focal_terms[1]]]) - } else { - jn_slopes$group <- "jn_no_group" - groups <- list(jn_slopes) - names(groups) <- "jn_no_group" - } - - # find x-position where significant changes to not-significant - interval_data <- .find_jn_intervals(groups, focal_term = focal_terms[length(focal_terms)]) - - # add additional information - attr(jn_slopes, "focal_terms") <- focal_terms - attr(jn_slopes, "intervals") <- interval_data - attr(jn_slopes, "p_adjust") <- p_adjust - attr(jn_slopes, "response") <- insight::find_response(model) - attr(jn_slopes, "rug_data") <- .safe(model_data[[focal_terms[length(focal_terms)]]]) - - class(jn_slopes) <- c("ggjohnson_neyman", "data.frame") - jn_slopes + do.call("test_predictions", c(fun_args, dot_args)) } @@ -234,305 +155,9 @@ johnson_neyman <- function(x, precision = 500, p_adjust = NULL, ...) { spotlight_analysis <- johnson_neyman - -# methods --------------------------------------------------------------------- - - -#' @export -print.ggjohnson_neyman <- function(x, ...) { - # extract attributes - focal_terms <- attributes(x)$focal_terms - intervals <- attributes(x)$intervals - response <- attributes(x)$response - p_adjust <- attributes(x)$p_adjust - - # iterate all intervals - for (group in intervals$group) { - # add "header" for groups - if (group != "jn_no_group") { - insight::print_color(sprintf("# Level `%s`\n", group), color = "blue") - } - - # slice data, extract only for specific group - d <- intervals[intervals$group == group, ] - - # get bound - pos_lower <- d$pos_lower - pos_upper <- d$pos_upper - - # get current focal term - current_focal <- focal_terms[length(focal_terms)] - - # check which values are significant for the slope - if (is.na(pos_lower) && is.na(pos_upper)) { - # is everything non-significant? - msg <- sprintf( - "There are no clear negative or positive associations between `%s` and `%s` for any value of `%s`.", - colnames(x)[1], - response, - current_focal - ) - } else if (is.na(pos_upper)) { - # only one change from significant to non-significant - direction <- ifelse(d$significant == "yes", "lower", "higher") - association <- ifelse(d$slope_lower > 0, "positive", "negative") - msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` %s than %s.", - colnames(x)[1], - response, - association, - current_focal, - direction, - insight::format_value(pos_lower, protect_integers = TRUE) - ) - - unclear_direction <- ifelse(d$significant != "yes", "lower", "higher") - msg <- paste(msg, sprintf( - "There were no clear associations for values of `%s` %s than %s.", - current_focal, - unclear_direction, - insight::format_value(pos_lower, protect_integers = TRUE) - )) - } else { - # J-N interval - direction_lower <- ifelse(d$significant == "yes", "lower", "higher") - direction_higher <- ifelse(d$significant != "yes", "lower", "higher") - association_lower <- ifelse(d$slope_lower > 0, "positive", "negative") - association_higher <- ifelse(d$slope_upper > 0, "positive", "negative") - - # check whether significant range is inside or outside of that interval - if (direction_lower == "higher") { - # positive or negative associations *inside* of an interval - msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` that range from %s to %s.", - colnames(x)[1], - response, - association_lower, - current_focal, - insight::format_value(pos_lower, protect_integers = TRUE), - insight::format_value(pos_upper, protect_integers = TRUE) - ) - msg <- paste(msg, "Outside of this interval, there were no clear associations.") - } else { - # positive or negative associations *outside* of an interval - msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` %s than %s and %s for values %s than %s.", - colnames(x)[1], - response, - association_lower, - current_focal, - direction_lower, - insight::format_value(pos_lower, protect_integers = TRUE), - association_higher, - direction_higher, - insight::format_value(pos_upper, protect_integers = TRUE) - ) - msg <- paste(msg, sprintf( - "Inside the interval of %s, there were no clear associations.", - insight::format_ci(pos_lower, pos_upper, ci = NULL) - )) - } - } - - cat(insight::format_message(msg), "\n", sep = "") - if (group != "jn_no_group" && group != intervals$group[length(intervals$group)]) { - cat("\n") - } - } - - if (!is.null(p_adjust)) { - cat("\n", .format_p_adjust(p_adjust), "\n", sep = "") - } -} - - -#' @rdname johnson_neyman -#' @export -plot.ggjohnson_neyman <- function(x, - colors = c("#f44336", "#2196F3"), - show_association = TRUE, - show_rug = FALSE, - verbose = TRUE, ...) { - # print results, to make it obvious that we talk about associations, not significanse - if (verbose) { - print(x) - } - insight::check_if_installed("ggplot2") - .data <- NULL # avoid global variable warning - - # extract attributes - focal_terms <- attributes(x)$focal_terms - intervals <- attributes(x)$intervals - response <- attributes(x)$response - rug_data <- attributes(x)$rug_data - - # rename to association - x$Association <- x$significant - x$Association[x$Association == "yes"] <- "positive/negative" - x$Association[x$Association == "no"] <- "inconsistent" - - # need a group for segments in geom_ribbon - x$group <- gr <- 1 - if (!all(x$significant == "yes") && !all(x$significant == "no")) { - for (i in 2:(nrow(x))) { - if (x$significant[i] != x$significant[i - 1]) { - gr <- gr + 1 - } - x$group[i] <- gr - } - } - - # create data frame for rug data - if (!is.null(rug_data)) { - rug_data <- data.frame(x = rug_data, group = 1) - if (!all(is.na(intervals$pos_lower)) && !all(is.na(intervals$pos_lower))) { - rug_data$group[rug_data$x >= intervals$pos_lower & rug_data$x <= intervals$pos_upper] <- 2 - rug_data$group[rug_data$x > intervals$pos_upper] <- 3 - } else if (!all(is.na(intervals$pos_lower))) { - rug_data$group[rug_data$x > intervals$pos_lower] <- 2 - } - } - - # create plot - if (show_association) { - p <- ggplot2::ggplot( - data = x, - ggplot2::aes( - x = .data[[focal_terms[length(focal_terms)]]], - y = .data$Slope, - ymin = .data$conf.low, - ymax = .data$conf.high, - color = .data$Association, - fill = .data$Association, - group = .data$group - ) - ) + - ggplot2::scale_fill_manual(values = colors) + - ggplot2::scale_color_manual(values = colors) - } else { - colors <- c("black", "black") - p <- ggplot2::ggplot( - data = x, - ggplot2::aes( - x = .data[[focal_terms[length(focal_terms)]]], - y = .data$Slope, - ymin = .data$conf.low, - ymax = .data$conf.high - ) - ) - } - - # add remaining geoms - p <- p + - ggplot2::geom_hline(yintercept = 0, linetype = "dotted") + - ggplot2::geom_ribbon(alpha = 0.2, color = NA) + - ggplot2::geom_line() + - theme_ggeffects() + - ggplot2::labs( - y = paste0("Slope of ", colnames(x)[1]), - title = paste0("Association between ", colnames(x)[1], " and ", response) - ) - - # to make facets work - names(intervals)[names(intervals) == "group"] <- focal_terms[1] - - p <- p + - ggplot2::geom_vline( - data = intervals, - ggplot2::aes(xintercept = .data$pos_lower), - linetype = "dashed", - alpha = 0.6, - color = colors[2] - ) + - ggplot2::geom_vline( - data = intervals, - ggplot2::aes(xintercept = .data$pos_upper), - linetype = "dashed", - alpha = 0.6, - color = colors[2] - ) - - # if we have more than two focal terms, we need to facet - if (length(focal_terms) > 1) { - p <- p + ggplot2::facet_wrap(focal_terms[1]) - } - - # add rug data? - if (!is.null(rug_data) && show_rug) { - p <- p + ggplot2::geom_rug( - data = rug_data, - ggplot2::aes(x = .data$x, group = .data$group), - sides = "b", - length = ggplot2::unit(0.02, "npc"), - inherit.aes = FALSE - ) - } - - suppressWarnings(graphics::plot(p)) -} - - # helper ---------------------------------------------------------------------- -.find_jn_intervals <- function(groups, focal_term, comparison = "Slope") { - # find x-position where significant changes to not-significant - do.call(rbind, lapply(names(groups), function(g) { - pos_lower <- pos_upper <- NA_real_ - slope_lower <- slope_upper <- NA_real_ - significant <- NA_character_ - gr_data <- groups[[g]] - if (!all(gr_data$significant == "yes") && !all(gr_data$significant == "no")) { - for (i in 1:(nrow(gr_data) - 1)) { - if (gr_data$significant[i] != gr_data$significant[i + 1]) { - if (is.na(pos_lower)) { - pos_lower <- gr_data[[focal_term]][i] - slope_lower <- gr_data[[comparison]][i] - if (is.na(significant)) { - significant <- gr_data$significant[i] - } - } else if (is.na(pos_upper)) { - pos_upper <- gr_data[[focal_term]][i] - slope_upper <- gr_data[[comparison]][i] - } else { - break - } - } - } - } - data.frame( - pos_lower = pos_lower, - pos_upper = pos_upper, - slope_lower = slope_lower, - slope_upper = slope_upper, - group = g, - significant = significant, - stringsAsFactors = FALSE - ) - })) -} - - -.format_p_adjust <- function(method) { - method <- tolower(method) - method <- switch(method, - holm = "Holm (1979)", - hochberg = "Hochberg (1988)", - hommel = "Hommel (1988)", - bonferroni = "Bonferroni", - fdr = , - bh = "Benjamini & Hochberg (1995)", - by = "Benjamini & Yekutieli (2001)", - tukey = "Tukey", - scheffe = "Scheffe", - sidak = "Sidak", - es = , - esarey = "Esarey & Sumner (2017)", - method - ) - insight::format_message(sprintf("P-values were adjusted using the %s method.", method)) -} - .fdr_interaction <- function(x, focal_terms, model) { # get names of interaction terms diff --git a/R/johnson_neyman_numcat.R b/R/johnson_neyman_numcat.R deleted file mode 100644 index f14a4408..00000000 --- a/R/johnson_neyman_numcat.R +++ /dev/null @@ -1,372 +0,0 @@ -johnson_neyman_numcat <- function(x, - model = NULL, - model_data = NULL, - focal_terms = NULL, - original_terms = NULL, - numeric_focal = NULL, - dot_args = NULL, - p_adjust = NULL, - precision = 500) { - # pkg installed? - insight::check_if_installed("marginaleffects") - - # find out where we have *non* numerical focal terms - categorical_focal <- .safe(vapply(model_data[focal_terms], is.factor, logical(1))) - - # now compute contrasts. we first need to make sure to have enough data points - pr <- pretty(model_data[[focal_terms[numeric_focal]]], n = precision) - - jn_slopes <- do.call(rbind, lapply(sort(unique(pr)), function(i) { - # modify "terms" argument. We want the categorical focal term, - # and the numerical focal term at one(!) specific value - new_terms <- c( - focal_terms[categorical_focal][1], - paste0(focal_terms[numeric_focal], " [", toString(i), "]") - ) - # directly calling marginaleffects might be faster, but we need to - # make sure that columns / values are properly formatted - # fun_args <- list(model, newdata = new_data(m, new_terms)) - # do.call( - # marginaleffects::predictions, - # c(fun_args, dot_args) - # ) - # calculate contrasts of slopes - fun_args <- list(model, terms = new_terms) - if (identical(p_adjust, "fdr")) { - fun_args$p_adjust <- "fdr" - } - do.call("test_predictions", c(fun_args, dot_args)) - })) - - # we have now contrasts for each value of the numerical focal term - # make the values of the numeric focal term the x-axis, convert to numeric - jn_slopes[[focal_terms[numeric_focal]]] <- as.numeric(gsub("(\\d.*)-(\\d.*)", "\\1", jn_slopes[[focal_terms[numeric_focal]]])) # nolint - - # add a new column to jn_slopes, which indicates whether confidence intervals - # cover zero - jn_slopes$significant <- ifelse(jn_slopes$conf.low > 0 | jn_slopes$conf.high < 0, "yes", "no") - - # p-adjustment based on fdr? we then need to update the significant-column here - if (identical(p_adjust, "fdr")) { - jn_slopes$significant[jn_slopes$p.value >= 0.05] <- "no" - } - - # split data at each level of categorical term, so we can find the interval - # boundaries for each group - groups <- split(jn_slopes, jn_slopes[[focal_terms[categorical_focal][1]]]) - - # find x-position where significant changes to not-significant - interval_data <- .find_jn_intervals( - groups, - focal_term = focal_terms[numeric_focal], - comparison = "Contrast" - ) - - # add additional information - attr(jn_slopes, "focal_terms") <- focal_terms - attr(jn_slopes, "focal_cat") <- focal_terms[categorical_focal][1] - attr(jn_slopes, "focal_num") <- focal_terms[numeric_focal] - attr(jn_slopes, "intervals") <- interval_data - attr(jn_slopes, "p_adjust") <- p_adjust - attr(jn_slopes, "response") <- insight::find_response(model) - attr(jn_slopes, "rug_data") <- .safe(model_data[[focal_terms[numeric_focal]]]) - - class(jn_slopes) <- c("ggjohnson_neyman_numcat", "data.frame") - jn_slopes -} - - -# methods -------------- - - -#' @export -print.ggjohnson_neyman_numcat <- function(x, ...) { - # extract attributes - focal_terms <- attributes(x)$focal_terms - intervals <- attributes(x)$intervals - response <- attributes(x)$response - p_adjust <- attributes(x)$p_adjust - numeric_focal <- attributes(x)$focal_num - categorical_focal <- attributes(x)$focal_cat - - # iterate all intervals - for (group in intervals$group) { - # add "header" for groups - if (group != "jn_no_group") { - insight::print_color(sprintf( - "# Difference between levels `%s` of %s\n", - group, - categorical_focal - ), color = "blue") - } - - # slice data, extract only for specific group - d <- intervals[intervals$group == group, ] - - # get bound - pos_lower <- d$pos_lower - pos_upper <- d$pos_upper - - # get current focal term - current_focal <- numeric_focal - - # check which values are significant for the slope - if (is.na(pos_lower) && is.na(pos_upper)) { - # is everything non-significant? - msg <- sprintf( - "There are no statistically significant differencens between the levels `%s` of `%s` for any value of `%s`.", - group, - categorical_focal, - current_focal - ) - } else if (is.na(pos_upper)) { - # only one change from significant to non-significant - direction <- ifelse(d$significant == "yes", "lower", "higher") - msg <- sprintf( - "The difference between levels `%s` of `%s` is statistically significant for values of `%s` %s than %s.", - group, - categorical_focal, - current_focal, - direction, - insight::format_value(pos_lower, protect_integers = TRUE) - ) - - unclear_direction <- ifelse(d$significant != "yes", "lower", "higher") - msg <- paste(msg, sprintf( - "There were no statistically significant differencens for values of `%s` %s than %s.", - current_focal, - unclear_direction, - insight::format_value(pos_lower, protect_integers = TRUE) - )) - } else { - # J-N interval - direction_lower <- ifelse(d$significant == "yes", "lower", "higher") - direction_higher <- ifelse(d$significant != "yes", "lower", "higher") - - # check whether significant range is inside or outside of that interval - if (direction_lower == "higher") { - # positive or negative associations *inside* of an interval - msg <- sprintf( - "The difference between levels `%s` of `%s` is statistically significant for values of `%s` that range from %s to %s.", # nolint - group, - categorical_focal, - current_focal, - insight::format_value(pos_lower, protect_integers = TRUE), - insight::format_value(pos_upper, protect_integers = TRUE) - ) - msg <- paste(msg, "Outside of this interval, there were no statistically significant differences.") - } else { - # positive or negative associations *outside* of an interval - msg <- sprintf( - "The difference between levels `%s` of `%s` is statistically significant for values of `%s` %s than %s and %s than %s.", # nolint - group, - categorical_focal, - current_focal, - direction_lower, - insight::format_value(pos_lower, protect_integers = TRUE), - direction_higher, - insight::format_value(pos_upper, protect_integers = TRUE) - ) - msg <- paste(msg, sprintf( - "Inside the interval of %s, there were no statistically significant differences.", - insight::format_ci(pos_lower, pos_upper, ci = NULL) - )) - } - } - - cat(insight::format_message(msg), "\n", sep = "") - if (group != "jn_no_group" && group != intervals$group[length(intervals$group)]) { - cat("\n") - } - } - - if (!is.null(p_adjust)) { - cat("\n", .format_p_adjust(p_adjust), "\n", sep = "") - } -} - - -#' @export -plot.ggjohnson_neyman_numcat <- function(x, - colors = c("#f44336", "#2196F3"), - show_association = TRUE, - show_rug = FALSE, - verbose = TRUE, ...) { - # print results, to make it obvious that we talk about associations, not significanse - if (verbose) { - print(x) - } - insight::check_if_installed(c("ggplot2", "see")) - .data <- NULL # avoid global variable warning - - # extract attributes - focal_terms <- attributes(x)$focal_terms - focal_cat <- attributes(x)$focal_cat - focal_num <- attributes(x)$focal_num - intervals <- attributes(x)$intervals - response <- attributes(x)$response - rug_data <- attributes(x)$rug_data - - # rename to difference - x$Difference <- x$significant - x$Difference[x$Difference == "yes"] <- "significant" - x$Difference[x$Difference == "no"] <- "not significant" - - split_data <- split(x, x[[focal_cat]]) - plots <- lapply(seq_along(split_data), function(split_index) { - jndata <- split_data[[split_index]] - # need a group for segments in geom_ribbon - jndata$group <- gr <- 1 - if (!all(jndata$significant == "yes") && !all(jndata$significant == "no")) { - for (i in 2:(nrow(jndata))) { - if (jndata$significant[i] != jndata$significant[i - 1]) { - gr <- gr + 1 - } - jndata$group[i] <- gr - } - } - - # create data frame for rug data - if (!is.null(rug_data)) { - rug_data <- data.frame(x = rug_data, group = 1) - if (!all(is.na(intervals$pos_lower)) && !all(is.na(intervals$pos_lower))) { - rug_data$group[rug_data$x >= intervals$pos_lower & rug_data$x <= intervals$pos_upper] <- 2 - rug_data$group[rug_data$x > intervals$pos_upper] <- 3 - } else if (!all(is.na(intervals$pos_lower))) { - rug_data$group[rug_data$x > intervals$pos_lower] <- 2 - } - } - - # create plot - if (show_association) { - p <- ggplot2::ggplot( - data = jndata, - ggplot2::aes( - x = .data[[focal_num]], - y = .data$Contrast, - ymin = .data$conf.low, - ymax = .data$conf.high, - color = .data$Difference, - fill = .data$Difference, - group = .data$group - ) - ) + - ggplot2::scale_fill_manual(values = colors) + - ggplot2::scale_color_manual(values = colors) - } else { - colors <- c("black", "black") - p <- ggplot2::ggplot( - data = jndata, - ggplot2::aes( - x = .data[[focal_num]], - y = .data$Contrast, - ymin = .data$conf.low, - ymax = .data$conf.high - ) - ) - } - - # add remaining geoms - p <- p + - ggplot2::geom_hline(yintercept = 0, linetype = "dotted") + - ggplot2::geom_ribbon(alpha = 0.2, color = NA) + - ggplot2::geom_line() + - theme_ggeffects() - - # first plot gets titles - if (split_index == 1) { - p <- p + ggplot2::labs( - y = paste("Difference between", colnames(jndata)[1], jndata[[1]][1]), - title = paste0("Comparison of ", colnames(jndata)[1], "-levels across ", focal_num) - ) - } else { - p <- p + ggplot2::labs( - y = paste("Difference between", colnames(jndata)[1], jndata[[1]][1]) - ) - } - - # split interval data - interval_data <- intervals[intervals$group == jndata[[1]][1], ] - - suppressWarnings({ - p <- p + - ggplot2::geom_vline( - data = interval_data, - ggplot2::aes(xintercept = .data$pos_lower), - linetype = "dashed", - alpha = 0.6, - color = colors[2] - ) + - ggplot2::geom_vline( - data = interval_data, - ggplot2::aes(xintercept = .data$pos_upper), - linetype = "dashed", - alpha = 0.6, - color = colors[2] - ) - }) - - # add rug data? - if (!is.null(rug_data) && show_rug) { - p <- p + ggplot2::geom_rug( - data = rug_data, - ggplot2::aes(x = .data$jndata, group = .data$group), - sides = "b", - length = ggplot2::unit(0.02, "npc"), - inherit.aes = FALSE - ) - } - - # no legends except for last plot - if (split_index < length(split_data)) { - p <- p + ggplot2::theme(legend.position = "none") - } else { - p <- p + ggplot2::theme(legend.position = "bottom") - } - - # return final plot - suppressWarnings(p) - }) - - suppressWarnings(see::plots(plots)) -} - - -# library(ggeffects) -# library(ggplot2) -# ggplot(out, aes(x = x, y = Contrast, ymin = conf.low, ymax = conf.high, colour = color, fill = color)) + -# geom_ribbon(alpha = 0.2, colour = NA) + -# geom_line() + -# facet_wrap(~c172code) - -# data(efc, package = "ggeffects") -# efc$c172code <- as.factor(efc$c172code) -# m <- lm(neg_c_7 ~ c12hour * c172code, data = efc) -# ggpredict(m, terms = c("c12hour", "c172code")) |> plot() -# test_predictions(m, terms = c("c172code", "c12hour")) -# test_predictions(m, terms = c("c12hour [105]", "c172code")) |> as.data.frame() - -# head(unique(sort(efc$c12hour))) -# library(marginaleffects) -# nd <- data_grid(m, c("c172code")) -# marginaleffects::predictions(m, newdata = nd, variables = "c12hour", hypothesis = "pairwise") - - -# test_predictions(m, terms = c("c172code", "c12hour [5]")) - - -# model, -# by = by_arg, -# newdata = datagrid, -# hypothesis = test, -# df = df, -# conf_level = ci_level -# ) - - -# m2 <- lm(neg_c_7 ~ c12hour * barthtot, data = efc) -# pr <- predict_response(m2, c("c12hour", "barthtot")) -# out2 <- johnson_neyman(pr) -# head(as.data.frame(out2)) -# head(as.data.frame(out)) - diff --git a/R/print.R b/R/print.R index c835e5a5..dab90c03 100644 --- a/R/print.R +++ b/R/print.R @@ -354,354 +354,3 @@ print_html.ggeffects <- function(x, sample.rows } - - -# methods for ggcomparisons -------------------------------------------- - - -#' @rdname print -#' @export -print.ggcomparisons <- function(x, collapse_tables = FALSE, ...) { - # check if default format is "html" or "markdown" - output_format <- getOption("ggeffects_output_format", "text") - if (identical(output_format, "html")) { - return(print(print_html(x, ...))) - } - if (identical(output_format, "markdown")) { - return(print(print_md(x, ...))) - } - - test_pairwise <- identical(attributes(x)$test, "pairwise") - test_consecutive <- identical(attributes(x)$test, "consecutive") - test_interaction <- identical(attributes(x)$test, "interaction") - test_custom <- identical(attributes(x)$test, "custom") - estimate_name <- attributes(x)$estimate_name - by_factor <- attributes(x)$by_factor - rope_range <- attributes(x)$rope_range - verbose <- isTRUE(attributes(x)$verbose) - scale_outcome <- attributes(x)$scale - scale_label <- attributes(x)$scale_label - is_linear <- isTRUE(attributes(x)$linear_model) - - # if we want to collapse table, we don't need "by" variable - if (isTRUE(collapse_tables)) { - by_factor <- NULL - } - - # get header and footer, then print table - x <- format(x, ...) - slopes <- vapply(x, function(i) all(i == "slope"), TRUE) - if (!is.null(rope_range)) { - caption <- c("# TOST-test for Practical Equivalence", "blue") - } else if (any(slopes)) { - x[slopes] <- NULL - caption <- c(paste0("# (Average) Linear trend for ", names(slopes)[slopes]), "blue") - } else if (test_pairwise) { - caption <- c("# Pairwise comparisons", "blue") - } else if (test_consecutive) { - caption <- c("# Consecutive contrasts", "blue") - } else if (test_interaction) { - caption <- c("# Interaction contrasts", "blue") - } else if (test_custom) { - caption <- c("# Custom contrasts", "blue") - } else { - caption <- NULL - } - footer <- attributes(x)$hypothesis_label - if (!is.null(footer)) { - footer <- insight::format_message(paste0("Tested hypothesis: ", footer)) - footer <- paste0("\n", footer, "\n") - } - - # split tables by response levels? - if ("Response_Level" %in% colnames(x)) { - x$Response_Level <- factor(x$Response_Level, levels = unique(x$Response_Level)) - out <- split(x, x$Response_Level) - for (response_table in seq_along(out)) { - insight::print_color(paste0("\n# Response Level: ", names(out)[response_table], "\n\n"), "red") - tab <- out[[response_table]] - tab$Response_Level <- NULL - if (response_table == 1) { - cat(insight::export_table(tab, title = caption, footer = NULL, ...)) - } else if (response_table == length(out)) { - cat(insight::export_table(tab, title = NULL, footer = footer, ...)) - } else { - cat(insight::export_table(tab, title = NULL, footer = NULL, ...)) - } - } - # check if we have at least three rows by column, else splitting by "by" - # is not useful - } else if (!is.null(by_factor) && all(by_factor %in% colnames(x)) && (prod(lengths(lapply(x[by_factor], unique))) * 3) <= nrow(x)) { # nolint - # split tables by "by" variable? Need a different handling for captions here - out <- split(x, x[by_factor]) - if (!is.null(caption)) { - insight::print_color(caption[1], caption[2]) - cat("\n") - } - for (by_table in seq_along(out)) { - insight::print_color(paste0("\n", paste0(by_factor, collapse = "/"), " = ", names(out)[by_table], "\n\n"), "red") - tab <- out[[by_table]] - tab[by_factor] <- NULL - if (by_table == length(out)) { - cat(insight::export_table(tab, title = NULL, footer = footer, ...)) - } else { - cat(insight::export_table(tab, title = NULL, footer = NULL, ...)) - } - } - } else { - cat(insight::export_table(x, title = caption, footer = footer, ...)) - } - - # what type of estimates do we have? - type <- switch(estimate_name, - Predicted = "Predictions", - Contrast = "Contrasts", - Slope = "Slopes", - "Estimates" - ) - - # tell user about scale of estimate type - if (verbose && !(is_linear && identical(scale_outcome, "response"))) { - if (is.null(scale_label)) { - scale_label <- switch(scale_outcome, - response = "response", - probs = , - probability = if (type == "Contrasts") { - "probability (in %-points)" - } else { - "probability" - }, - exp = "exponentiated", - log = "log", - link = "link", - oddsratios = "odds ratio", - irr = "incident rate ratio", - count = , - conditional = "conditional means", - "unknown" - ) - msg <- paste0("\n", type, " are presented on the ", scale_label, " scale.") - } else { - # for proportions and probabilities, contrasts are differences in %-points - if (type == "Contrasts" && scale_label %in% c("probabilities", "proportions")) { - scale_label <- paste(scale_label, "(in %-points)") - } - msg <- paste0("\n", type, " are presented as ", scale_label, ".") - } - insight::format_alert(msg) - } -} - - -#' @rdname print -#' @export -print_html.ggcomparisons <- function(x, - collapse_ci = FALSE, - collapse_p = FALSE, - theme = NULL, - engine = c("tt", "gt"), - ...) { - engine <- getOption("ggeffects_html_engine", engine) - engine <- match.arg(engine) - .print_html_ggcomparisons( - x, - collapse_ci = collapse_ci, - collapse_p = collapse_p, - theme = theme, - engine = engine, - ... - ) -} - - -#' @rdname print -#' @export -print_md.ggcomparisons <- function(x, collapse_ci = FALSE, collapse_p = FALSE, theme = NULL, ...) { - .print_html_ggcomparisons( - x, - collapse_ci = collapse_ci, - collapse_p = collapse_p, - theme = theme, - engine = "tt", - output = "markdown", - ... - ) -} - - -.print_html_ggcomparisons <- function(x, - collapse_ci = FALSE, - collapse_p = FALSE, - theme = NULL, - engine = c("tt", "gt"), - output = "html", - ...) { - test_pairwise <- identical(attributes(x)$test, "pairwise") - test_interaction <- identical(attributes(x)$test, "interaction") - test_consecutive <- identical(attributes(x)$test, "consecutive") - test_custom <- identical(attributes(x)$test, "custom") - estimate_name <- attributes(x)$estimate_name - rope_range <- attributes(x)$rope_range - verbose <- isTRUE(attributes(x)$verbose) - by_factor <- attributes(x)$by_factor - scale_outcome <- attributes(x)$scale - scale_label <- attributes(x)$scale_label - is_linear <- isTRUE(attributes(x)$linear_model) - - # get header and footer, then print table - x <- format(x, collapse_ci = collapse_ci, collapse_p = collapse_p, ...) - slopes <- vapply(x, function(i) all(i == "slope"), TRUE) - if (!is.null(rope_range)) { - caption <- "TOST-test for Practical Equivalence" - } else if (any(slopes)) { - x[slopes] <- NULL - caption <- paste0("(Average) Linear trend for ", names(slopes)[slopes]) - } else if (test_pairwise) { - caption <- "Pairwise comparisons" - } else if (test_interaction) { - caption <- "Interaction contrasts" - } else if (test_consecutive) { - caption <- "Consecutive contrasts" - } else if (test_custom) { - caption <- "Custom contrasts" - } else { - caption <- NULL - } - - footer <- attributes(x)$hypothesis_label - if (!is.null(footer)) { - footer <- paste0("Tested hypothesis: ", footer) - } - - if (verbose) { - # what type of estimates do we have? - type <- switch(estimate_name, - Predicted = "Predictions", - Contrast = "Contrasts", - Slope = "Slopes", - "Estimates" - ) - - # line separator - line_sep <- ifelse(identical(output, "html"), "
", ", ") - - # tell user about scale of estimate type - if (!(is_linear && identical(scale_outcome, "response"))) { - if (is.null(scale_label)) { - scale_label <- switch(scale_outcome, - response = "response", - probs = , - probability = "probability", - exp = "exponentiated", - log = "log", - link = "link", - oddsratios = "odds ratio", - irr = "incident rate ratio", - "unknown" - ) - footer <- paste0( - footer, - ifelse(is.null(footer), "", line_sep), - type, - " are presented on the ", - scale_label, - " scale." - ) - } else { - footer <- paste0( - footer, - ifelse(is.null(footer), "", line_sep), - type, - " are presented as ", - scale_label, - "." - ) - } - } - } - - # format footer, make it a bit smaller - if (identical(output, "html")) { - footer <- .format_html_footer(footer) - } - - # split by "by"? But only, if we have enough rows for each group - # else, inserting table headings for each row is not useful - split_by <- !is.null(by_factor) && - all(by_factor %in% colnames(x)) && - (prod(lengths(lapply(x[by_factor], unique))) * 3) <= nrow(x) - - # start here for using tinytables - if (engine == "tt") { - insight::check_if_installed("tinytable", minimum_version = "0.1.0") - # used for subgroup headers, if available - row_header_pos <- row_header_labels <- NULL - - # do we have groups? - if (split_by) { # nolint - # if we have more than one group variable, we unite them into one - if (length(by_factor) > 1) { - group_by <- datawizard::data_unite(x, "group_by", by_factor, separator = ", ")$group_by - } else { - group_by <- x[[by_factor]] - } - x[by_factor] <- NULL - } else if ("Response_Level" %in% colnames(x)) { - group_by <- x$Response_Level - x$Response_Level <- NULL - } else { - group_by <- NULL - } - - # split tables by response levels? - if (!is.null(group_by)) { - # make sure group_by is ordered - if (is.unsorted(group_by)) { - new_row_order <- order(group_by) - # re-order group_by and data frame - group_by <- group_by[new_row_order] - x <- x[new_row_order, ] - } - # find start row of each subgroup - row_header_pos <- which(!duplicated(group_by)) - # create named list, required for tinytables - row_header_labels <- as.list(stats::setNames(row_header_pos, as.vector(group_by[row_header_pos]))) - # make sure that the row header positions are correct - each header - # must be shifted by the number of rows above - for (i in 2:length(row_header_pos)) { - row_header_pos[i] <- row_header_pos[i] + (i - 1) - } - } - - # base table - out <- tinytable::tt(x, caption = caption, notes = footer) - # add subheaders, if any - if (!is.null(row_header_labels)) { - out <- tinytable::group_tt(out, i = row_header_labels, indent = 2) - out <- tinytable::style_tt(out, i = row_header_pos, italic = TRUE) - } - # apply theme, if any - if (identical(output, "html")) { - out <- insight::apply_table_theme(out, x, theme = theme, sub_header_positions = row_header_pos) - } - # workaround, to make sure HTML is default output - out@output <- output - out - } else { - # here we go with gt - if ("Response_Level" %in% colnames(x)) { - group_by <- c("Response_Level", "groups") - } else if (split_by) { - groups <- c(by_factor, "groups") - } else { - group_by <- "groups" - } - insight::export_table( - x, - format = "html", - by = "groups", - footer = footer, - caption = caption - ) - } -} diff --git a/R/test_predictions.R b/R/test_predictions.R index b8483c80..14203812 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -279,7 +279,7 @@ #' Determining and controlling the false positive rate. Comparative Political #' Studies, 1–33. Advance online publication. doi: 10.1177/0010414017730080 #' -#' @examplesIf requireNamespace("marginaleffects") && requireNamespace("parameters") && interactive() +#' @examplesIf all(insight::check_if_installed(c("parameters", "marginaleffects", "modelbased"), quietly = TRUE)) && interactive() #' \donttest{ #' data(efc) #' efc$c172code <- as.factor(efc$c172code) diff --git a/R/tp_label_hypothesis_categorical.R b/R/tp_label_hypothesis_categorical.R deleted file mode 100644 index bf96f5be..00000000 --- a/R/tp_label_hypothesis_categorical.R +++ /dev/null @@ -1,50 +0,0 @@ -.tp_label_hypothesis_categorical <- function(.comparisons, - need_average_predictions, - margin, - object, - by_variables, - datagrid, - df, - ci_level, - dot_args, - include_random, - focal, - test) { - # if we have specific comparisons of estimates, like "b1 = b2", we - # want to replace these shortcuts with the full related predictor names - # and levels - if (any(grepl("b[0-9]+", .comparisons$term))) { - # re-compute comoparisons for all combinations, so we know which - # estimate refers to which combination of predictor levels - if (need_average_predictions || margin %in% c("marginalmeans", "empirical")) { - fun <- "avg_predictions" - } else { - fun <- "predictions" - } - fun_args <- list( - model = object, - variables = by_variables, - newdata = datagrid, - hypothesis = NULL, - df = df, - conf_level = ci_level - ) - # for counterfactual predictions, we need no data grid - if (margin == "empirical") { - fun_args$newdata <- NULL - } - .full_comparisons <- .call_me(fun, fun_args, dot_args, include_random) - - # replace "hypothesis" labels with names/levels of focal predictors - hypothesis_label <- .extract_labels( - full_comparisons = .full_comparisons, - focal = focal, - test = test, - old_labels = .comparisons$term - ) - } - # we have a specific hypothesis, like "b3 = b4". We just copy that information - out <- data.frame(Hypothesis = .comparisons$term, stringsAsFactors = FALSE) - - list(hypothesis_label = hypothesis_label, out = out) -} diff --git a/R/tp_label_hypothesis_formula.R b/R/tp_label_hypothesis_formula.R deleted file mode 100644 index 7ba8f409..00000000 --- a/R/tp_label_hypothesis_formula.R +++ /dev/null @@ -1,30 +0,0 @@ -.tp_label_hypothesis_formula <- function(.comparisons, - focal, - margin, - model_data, - test) { - columns_to_select <- c("hypothesis", intersect(focal, colnames(.comparisons))) - out <- as.data.frame(.comparisons[columns_to_select], stringsAsFactors = FALSE) - - # for default margin, we don't have factor levels. get them here - if (!margin %in% c("marginalmeans", "empirical")) { - factor_levels <- levels(model_data[[focal[1]]]) - regex <- "\\d+(\\.\\d+)?" - # Extract numbers using gregexpr and regmatches - matches <- gregexpr(regex, out$hypothesis) - numbers <- unique(unlist(regmatches(out$hypothesis, matches), use.names = FALSE)) - if (length(numbers) > length(factor_levels)) { - factor_levels <- rep(factor_levels, length(numbers) / length(factor_levels)) - } - factor_levels <- stats::setNames(factor_levels, seq_along(factor_levels)) - for (i in seq_along(factor_levels)) { - out$hypothesis <- gsub( - names(factor_levels[i]), - factor_levels[i], - out$hypothesis, - fixed = TRUE - ) - } - } - list(hypothesis_label = insight::safe_deparse(test), out = out) -} diff --git a/R/tp_label_hypothesis_slopes.R b/R/tp_label_hypothesis_slopes.R deleted file mode 100644 index 3dde1f0a..00000000 --- a/R/tp_label_hypothesis_slopes.R +++ /dev/null @@ -1,38 +0,0 @@ -.tp_label_hypothesis_slopes <- function(.comparisons, - object, - focal, - df, - ci_level, - dot_args, - include_random, - test) { - # if we have specific comparisons of estimates, like "b1 = b2", we - # want to replace these shortcuts with the full related predictor names - # and levels - if (any(grepl("b[0-9]+", .comparisons$term))) { - # prepare argument list for "marginaleffects::slopes" - # we add dot-args later, that modulate the scale of the contrasts - fun_args <- list( - model = object, - variables = focal[1], - by = focal[2:length(focal)], - hypothesis = NULL, - df = df, - conf_level = ci_level - ) - # re-compute comoparisons for all combinations, so we know which - # estimate refers to which combination of predictor levels - .full_comparisons <- .call_me("slopes", fun_args, dot_args, include_random) - # replace "hypothesis" labels with names/levels of focal predictors - hypothesis_label <- .extract_labels( - full_comparisons = .full_comparisons, - focal = focal[2:length(focal)], - test = test, - old_labels = .comparisons$term - ) - } - # we have a specific hypothesis, like "b3 = b4". We just copy that information - out <- data.frame(Hypothesis = .comparisons$term, stringsAsFactors = FALSE) - - list(hypothesis_label = hypothesis_label, out = out) -} diff --git a/R/tp_label_pairwise_categorical.R b/R/tp_label_pairwise_categorical.R deleted file mode 100644 index b8960919..00000000 --- a/R/tp_label_pairwise_categorical.R +++ /dev/null @@ -1,106 +0,0 @@ -.tp_label_pairwise_categorical <- function(.comparisons, - datagrid, - focal, - need_average_predictions, - margin, - by_variables, - minfo) { - # for "predictions()", term name is "Row 1 - Row 2" etc. For - # "avg_predictions()", we have "level_a1, level_b1 - level_a2, level_b1" - # etc. we first want to have a data frame, where each column is one - # combination of levels, so we split at "," and/or "-". - - # before we extract labels, we need to check whether any factor level - # contains a "," - in this case, strplit() will not work properly - .comparisons$term <- .fix_comma_levels(.comparisons$term, datagrid, focal) - - # split and recombine levels of focal terms. We now have a data frame - # where each column represents one factor level of one focal predictor - contrast_terms <- data.frame( - do.call(rbind, strsplit(.comparisons$term, "(,| - )")), - stringsAsFactors = FALSE - ) - contrast_terms[] <- lapply(contrast_terms, function(i) { - # remove certain chars - for (j in c("(", ")", "Row")) { - i <- gsub(j, "", i, fixed = TRUE) - } - insight::trim_ws(i) - }) - - if (need_average_predictions || margin %in% c("marginalmeans", "empirical")) { - # in .comparisons$term, for mixed models and when "margin" is either - # "marginalmeans" or "empirical", we have the factor levels as values, - # where factor levels from different variables are comma-separated. There - # are edge cases where we have more than one focal term, but for one of - # those only one value is requested, e.g.: `terms = c("sex", "education [high]")` - # in this case, .comparisons$term only contains levels of the first focal - # term, and no comma (no levels of second focal term are comma separated). - # in such cases, we simply remove those focal terms, which levels are not - # appearing in .comparisons$term - - # we first need to get the relevant values / factor levels we want to - # check for. These can be different from the data grid, when representative - # values are specified in brackets via the "terms" argument. - if (is.list(by_variables)) { - values_to_check <- by_variables - } else { - values_to_check <- lapply(datagrid[focal], unique) - } - - # we then check whether representative values of focal terms actually - # appear in our pairwise comparisons data frame. - focal_found <- vapply(values_to_check, function(i) { - any(vapply(as.character(i), function(j) { - any(grepl(j, unique(as.character(.comparisons$term)), fixed = TRUE)) - }, TRUE)) - }, TRUE) - - # we temporarily update our focal terms, for extracting labels. - if (all(focal_found)) { - updated_focal <- focal - } else { - updated_focal <- focal[focal_found] - } - - # for "avg_predictions()", we already have the correct labels of factor - # levels, we just need to re-arrange, so that each column represents a - # pairwise combination of factor levels for each factor - out <- as.data.frame(lapply(seq_along(updated_focal), function(i) { - tmp <- contrast_terms[seq(i, ncol(contrast_terms), by = length(updated_focal))] - unlist(lapply(seq_len(nrow(tmp)), function(j) { - .contrasts <- as.character(unlist(tmp[j, ])) - paste(.contrasts, collapse = "-") - })) - }), stringsAsFactors = FALSE) - } else { - # only for temporary use, for colnames, see below - updated_focal <- focal - # check whether we have row numbers, or (e.g., for polr or ordinal models) - # factor levels. When we have row numbers, we coerce them to numeric and - # extract related factor levels. Else, in case of ordinal outcomes, we - # should already have factor levels... - if (all(vapply(contrast_terms, function(i) anyNA(suppressWarnings(as.numeric(i))), TRUE)) || minfo$is_ordinal || minfo$is_multinomial) { # nolint - out <- as.data.frame(lapply(updated_focal, function(i) { - unlist(lapply(seq_len(nrow(contrast_terms)), function(j) { - paste(unlist(contrast_terms[j, ]), collapse = "-") - })) - }), stringsAsFactors = FALSE) - } else { - # for "predictions()", we now have the row numbers. We can than extract - # the factor levels from the data of the data grid, as row numbers in - # "contrast_terms" correspond to rows in "grid". - out <- as.data.frame(lapply(updated_focal, function(i) { - unlist(lapply(seq_len(nrow(contrast_terms)), function(j) { - .contrasts <- datagrid[[i]][as.numeric(unlist(contrast_terms[j, ]))] - paste(.contrasts, collapse = "-") - })) - }), stringsAsFactors = FALSE) - } - } - # the final result is a data frame with one column per focal predictor, - # and the pairwise combinations of factor levels are the values - colnames(out) <- updated_focal - - out -} diff --git a/R/tp_label_pairwise_slopes.R b/R/tp_label_pairwise_slopes.R deleted file mode 100644 index 30ca6ff5..00000000 --- a/R/tp_label_pairwise_slopes.R +++ /dev/null @@ -1,41 +0,0 @@ -.tp_label_pairwise_slopes <- function(.comparisons, datagrid, focal) { - # before we extract labels, we need to check whether any factor level - # contains a "," - in this case, strplit() will not work properly - .comparisons$term <- .fix_comma_levels(.comparisons$term, datagrid, focal) - - # if we find a comma in the terms column, we have two categorical predictors - if (any(grepl(",", .comparisons$term, fixed = TRUE))) { - contrast_terms <- data.frame( - do.call(rbind, strsplit(.comparisons$term, " - ", fixed = TRUE)), - stringsAsFactors = FALSE - ) - - # split and recombine term names - pairs1 <- unlist(strsplit(contrast_terms[[1]], ",", fixed = TRUE)) - pairs2 <- unlist(strsplit(contrast_terms[[2]], ",", fixed = TRUE)) - contrast_pairs <- paste0( - insight::trim_ws(pairs1), - "-", - insight::trim_ws(pairs2) - ) - - # create data frame - since we have two categorical predictors at - # this point (and one numerical), we create a data frame with three - # columns (one per focal term). - out <- data.frame( - x_ = "slope", - x__ = contrast_pairs[c(TRUE, FALSE)], - x___ = contrast_pairs[c(FALSE, TRUE)], - stringsAsFactors = FALSE - ) - } else { - out <- data.frame( - x_ = "slope", - x__ = gsub(" ", "", .comparisons$term, fixed = TRUE), - stringsAsFactors = FALSE - ) - } - colnames(out) <- focal - - list(.comparisons = .comparisons, out = out) -} diff --git a/man/johnson_neyman.Rd b/man/johnson_neyman.Rd index 73dc557d..55b71868 100644 --- a/man/johnson_neyman.Rd +++ b/man/johnson_neyman.Rd @@ -3,21 +3,11 @@ \name{johnson_neyman} \alias{johnson_neyman} \alias{spotlight_analysis} -\alias{plot.ggjohnson_neyman} \title{Spotlight-analysis: Create Johnson-Neyman confidence intervals and plots} \usage{ johnson_neyman(x, precision = 500, p_adjust = NULL, ...) spotlight_analysis(x, precision = 500, p_adjust = NULL, ...) - -\method{plot}{ggjohnson_neyman}( - x, - colors = c("#f44336", "#2196F3"), - show_association = TRUE, - show_rug = FALSE, - verbose = TRUE, - ... -) } \arguments{ \item{x}{An object of class \code{ggeffects}, as returned by the functions @@ -101,7 +91,7 @@ adjusted. \code{"esarey"} is slower, but confidence intervals are updated as wel } \examples{ -\dontshow{if (requireNamespace("ggplot2") && requireNamespace("marginaleffects")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (all(insight::check_if_installed(c("ggplot2", "marginaleffects", "modelbased"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \dontrun{ data(efc, package = "ggeffects") efc$c172code <- as.factor(efc$c172code) @@ -111,7 +101,7 @@ pr <- predict_response(m, c("c12hour", "barthtot")) johnson_neyman(pr) plot(johnson_neyman(pr)) -pr <- predict_response(m, c("c12hour", "c172code", "barthtot")) +pr <- predict_response(m, c("c12hour", "barthtot", "c172code")) johnson_neyman(pr) plot(johnson_neyman(pr)) diff --git a/man/print.Rd b/man/print.Rd index 30f6e696..ce818e1e 100644 --- a/man/print.Rd +++ b/man/print.Rd @@ -2,14 +2,10 @@ % Please edit documentation in R/format.R, R/print.R \name{format.ggeffects} \alias{format.ggeffects} -\alias{format.ggcomparisons} \alias{print} \alias{print.ggeffects} \alias{print_md.ggeffects} \alias{print_html.ggeffects} -\alias{print.ggcomparisons} -\alias{print_html.ggcomparisons} -\alias{print_md.ggcomparisons} \title{Print and format ggeffects-objects} \usage{ \method{format}{ggeffects}( @@ -25,8 +21,6 @@ ... ) -\method{format}{ggcomparisons}(x, collapse_ci = FALSE, collapse_p = FALSE, combine_levels = FALSE, ...) - \method{print}{ggeffects}(x, group_name = TRUE, digits = 2, verbose = TRUE, ...) \method{print_md}{ggeffects}(x, group_name = TRUE, digits = 2, ...) @@ -39,19 +33,6 @@ engine = c("tt", "gt"), ... ) - -\method{print}{ggcomparisons}(x, collapse_tables = FALSE, ...) - -\method{print_html}{ggcomparisons}( - x, - collapse_ci = FALSE, - collapse_p = FALSE, - theme = NULL, - engine = c("tt", "gt"), - ... -) - -\method{print_md}{ggcomparisons}(x, collapse_ci = FALSE, collapse_p = FALSE, theme = NULL, ...) } \arguments{ \item{x}{An object of class \code{ggeffects}, as returned by the functions @@ -86,6 +67,14 @@ of rows is printed, depending on the number of subgroups.} them are also passed down further to \code{\link[insight:format_table]{insight::format_table()}} or \code{\link[insight:format_value]{insight::format_value()}}.} +\item{verbose}{Toggle messages.} + +\item{theme}{The theme to apply to the table. One of \code{"grid"}, \code{"striped"}, +\code{"bootstrap"}, or \code{"darklines"}.} + +\item{engine}{The engine to use for printing. One of \code{"tt"} (default) or \code{"gt"}. +\code{"tt"} uses the \emph{tinytable} package, \code{"gt"} uses the \emph{gt} package.} + \item{collapse_p}{Logical, if \code{TRUE}, the columns with predicted values and p-values are collapsed into one column, where significant p-values are indicated as asterisks.} @@ -95,14 +84,6 @@ of each focal term against the second are combined into one column. This is useful when comparing multiple focal terms, e.g. \code{education = low-high} and \code{gender = male-female} are combined into \code{first = low-male} and \code{second = high-female}.} - -\item{verbose}{Toggle messages.} - -\item{theme}{The theme to apply to the table. One of \code{"grid"}, \code{"striped"}, -\code{"bootstrap"}, or \code{"darklines"}.} - -\item{engine}{The engine to use for printing. One of \code{"tt"} (default) or \code{"gt"}. -\code{"tt"} uses the \emph{tinytable} package, \code{"gt"} uses the \emph{gt} package.} } \value{ \code{format()} return a formatted data frame, \code{print()} prints a diff --git a/man/test_predictions.Rd b/man/test_predictions.Rd index 53a8a080..c530b176 100644 --- a/man/test_predictions.Rd +++ b/man/test_predictions.Rd @@ -374,7 +374,7 @@ Use \verb{options( = NULL)} to remove the option. } \examples{ -\dontshow{if (requireNamespace("marginaleffects") && requireNamespace("parameters") && interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (all(insight::check_if_installed(c("parameters", "marginaleffects", "modelbased"), quietly = TRUE)) && interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ data(efc) efc$c172code <- as.factor(efc$c172code) From a50987787a6231448c4f82bd9163c77b5fa555e8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 12:26:38 +0100 Subject: [PATCH 11/51] update --- R/test_predictions.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/test_predictions.R b/R/test_predictions.R index 14203812..be824a5f 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -470,7 +470,7 @@ test_predictions.default <- function(object, predict = scale, ci = ci_level, comparison = test, - marginalize = marginalize, + estimate = marginalize, p_adjust = p_adjust, equivalence = equivalence, ... From 894512a69c59c37edbcee7df1178d9a8c0bee8ec Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 12:27:33 +0100 Subject: [PATCH 12/51] update --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index dc5a3027..8dded03c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -109,4 +109,4 @@ Config/testthat/edition: 3 Roxygen: list(markdown = TRUE) License: MIT + file LICENSE LazyData: true -Remotes: vincentarelbundock/marginaleffects, easystats/modelbased +Remotes: vincentarelbundock/marginaleffects, easystats/modelbased#369 From e79d6f9c23928e25988b65437b16e60a93743075 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 12:34:41 +0100 Subject: [PATCH 13/51] fix --- .gitignore | 1 + R/test_predictions.R | 1 + man/test_predictions.Rd | 9 +++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index f1c0294e..fc4c1f09 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ $RECYCLE.BIN/ *.msi *.msm *.msp +ggeffects.Rproj .Rproj.user inst/doc revdep diff --git a/R/test_predictions.R b/R/test_predictions.R index be824a5f..a200f8ae 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -394,6 +394,7 @@ test_predictions.default <- function(object, ci_level = 0.95, margin = "mean_reference", condition = NULL, + collapse_levels = FALSE, engine = "marginaleffects", verbose = TRUE, ...) { diff --git a/man/test_predictions.Rd b/man/test_predictions.Rd index c530b176..7c7fd15f 100644 --- a/man/test_predictions.Rd +++ b/man/test_predictions.Rd @@ -24,6 +24,7 @@ hypothesis_test(object, ...) ci_level = 0.95, margin = "mean_reference", condition = NULL, + collapse_levels = FALSE, engine = "marginaleffects", verbose = TRUE, ... @@ -194,6 +195,10 @@ predictions, i.e. \code{margin} can be ignored.} should be held constant at specific values, for instance \code{condition = c(covariate1 = 20, covariate2 = 5)}.} +\item{collapse_levels}{Logical, if \code{TRUE}, term labels that refer to identical +levels are no longer separated by "-", but instead collapsed into a unique +term label (e.g., \code{"level a-level a"} becomes \code{"level a"}). See 'Examples'.} + \item{engine}{Character string, indicates the package to use for computing contrasts and comparisons. Usually, this argument can be ignored, unless you want to explicitly use another package than \emph{marginaleffects} to calculate @@ -214,10 +219,6 @@ automatically. If this package is not installed as well, \code{engine = "ggeffec is used.} \item{verbose}{Toggle messages and warnings.} - -\item{collapse_levels}{Logical, if \code{TRUE}, term labels that refer to identical -levels are no longer separated by "-", but instead collapsed into a unique -term label (e.g., \code{"level a-level a"} becomes \code{"level a"}). See 'Examples'.} } \value{ A data frame containing predictions (e.g. for \code{test = NULL}), From fc778c2c7de68b48e7535b3effb6f00cef668ebb Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 12:36:49 +0100 Subject: [PATCH 14/51] update tests --- tests/testthat/_snaps/brglm.md | 14 ++++++++------ tests/testthat/test-betareg.R | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/testthat/_snaps/brglm.md b/tests/testthat/_snaps/brglm.md index de123fd0..54ec7ce2 100644 --- a/tests/testthat/_snaps/brglm.md +++ b/tests/testthat/_snaps/brglm.md @@ -3,12 +3,14 @@ Code print(comp) Output - # Pairwise comparisons + Model-based Contrasts Analysis - height | Contrast | 95% CI | p - -------------------------------------------- - <5ft->=5ft | -0.08 | -0.14, -0.03 | 0.003 - Message + Level1 | Level2 | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------- + >=5ft | <5ft | 0.08 | 0.03 | [0.03, 0.14] | 3.01 | 0.003 - Contrasts are presented as probabilities (in %-points). + Variable predicted: cbind(grahami, opalinus) + Predictors contrasted: height + Predictors averaged: grahami (19), opalinus (5.8), diameter, light, time + Contrasts are on the response-scale. diff --git a/tests/testthat/test-betareg.R b/tests/testthat/test-betareg.R index 029636d3..6dd17954 100644 --- a/tests/testthat/test-betareg.R +++ b/tests/testthat/test-betareg.R @@ -49,5 +49,5 @@ test_that("ggpredict", { skip_if_not_installed("marginaleffects") out <- test_predictions(p) - expect_equal(out$Contrast, -0.00123838580671709, tolerance = 1e-4) + expect_equal(out$Difference , -0.00123838580671709, tolerance = 1e-4) }) From 4f107afdff0d77d15bd6dc23e90cfaccfd9bb7b3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 12:38:13 +0100 Subject: [PATCH 15/51] update snapshots --- .../_snaps/print_test_predictions.new.md | 840 ++++++++++++++++++ 1 file changed, 840 insertions(+) create mode 100644 tests/testthat/_snaps/print_test_predictions.new.md diff --git a/tests/testthat/_snaps/print_test_predictions.new.md b/tests/testthat/_snaps/print_test_predictions.new.md new file mode 100644 index 00000000..7787b644 --- /dev/null +++ b/tests/testthat/_snaps/print_test_predictions.new.md @@ -0,0 +1,840 @@ +# print hypothesis_test simple contrast link scale + + Code + print(out) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------ + 1 | 0 | 0.07 | 0.57 | [-1.05, 1.19] | 0.12 | 0.901 + + Variable predicted: outcome + Predictors contrasted: var_binom + Predictors averaged: var_cont (9.2), groups + Contrasts are on the link-scale. + +# print hypothesis_test simple predictions link scale + + Code + print(out) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------ + 1 | 0 | 0.07 | 0.57 | [-1.05, 1.19] | 0.12 | 0.901 + + Variable predicted: outcome + Predictors contrasted: var_binom + Predictors averaged: var_cont (9.2), groups + Contrasts are on the link-scale. + +# print hypothesis_test simple contrast response scale + + Code + print(out) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------ + 1 | 0 | 0.02 | 0.14 | [-0.26, 0.30] | 0.12 | 0.901 + + Variable predicted: outcome + Predictors contrasted: var_binom + Predictors averaged: var_cont (9.2), groups + Contrasts are on the response-scale. + +# print hypothesis_test contrasts link scale + + Code + print(out) + Output + Model-based Contrasts Analysis + + Parameter | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------------- + 0 -0.2549517 - 0 -4.3727306 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 3.8628272 - 0 -4.3727306 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 7.9806061 - 0 -4.3727306 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 12.0983850 - 0 -4.3727306 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 16.2161639 - 0 -4.3727306 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 20.3339428 - 0 -4.3727306 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 24.4517217 - 0 -4.3727306 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 0 28.5695006 - 0 -4.3727306 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 + 0 32.6872795 - 0 -4.3727306 | 0.67 | 1.32 | [-1.91, 3.26] | 0.51 | 0.610 + 1 -4.3727306 - 0 -4.3727306 | 0.66 | 1.33 | [-1.94, 3.27] | 0.50 | 0.618 + 1 -0.2549517 - 0 -4.3727306 | 0.56 | 1.05 | [-1.51, 2.62] | 0.53 | 0.596 + 1 3.8628272 - 0 -4.3727306 | 0.45 | 0.84 | [-1.20, 2.11] | 0.54 | 0.590 + 1 7.9806061 - 0 -4.3727306 | 0.35 | 0.76 | [-1.14, 1.84] | 0.46 | 0.644 + 1 12.0983850 - 0 -4.3727306 | 0.25 | 0.84 | [-1.40, 1.89] | 0.29 | 0.768 + 1 16.2161639 - 0 -4.3727306 | 0.14 | 1.05 | [-1.91, 2.19] | 0.14 | 0.891 + 1 20.3339428 - 0 -4.3727306 | 0.04 | 1.32 | [-2.55, 2.63] | 0.03 | 0.976 + 1 24.4517217 - 0 -4.3727306 | -0.06 | 1.63 | [-3.26, 3.13] | -0.04 | 0.968 + 1 28.5695006 - 0 -4.3727306 | -0.17 | 1.96 | [-4.01, 3.67] | -0.09 | 0.931 + 1 32.6872795 - 0 -4.3727306 | -0.27 | 2.30 | [-4.77, 4.23] | -0.12 | 0.906 + 0 3.8628272 - 0 -0.2549517 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 7.9806061 - 0 -0.2549517 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 12.0983850 - 0 -0.2549517 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 16.2161639 - 0 -0.2549517 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 20.3339428 - 0 -0.2549517 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 24.4517217 - 0 -0.2549517 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 28.5695006 - 0 -0.2549517 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 0 32.6872795 - 0 -0.2549517 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 + 1 -4.3727306 - 0 -0.2549517 | 0.59 | 1.28 | [-1.92, 3.10] | 0.46 | 0.646 + 1 -0.2549517 - 0 -0.2549517 | 0.48 | 0.99 | [-1.46, 2.42] | 0.49 | 0.625 + 1 3.8628272 - 0 -0.2549517 | 0.38 | 0.76 | [-1.12, 1.88] | 0.50 | 0.619 + 1 7.9806061 - 0 -0.2549517 | 0.28 | 0.67 | [-1.04, 1.59] | 0.41 | 0.680 + 1 12.0983850 - 0 -0.2549517 | 0.17 | 0.76 | [-1.31, 1.66] | 0.23 | 0.820 + 1 16.2161639 - 0 -0.2549517 | 0.07 | 0.98 | [-1.86, 1.99] | 0.07 | 0.945 + 1 20.3339428 - 0 -0.2549517 | -0.04 | 1.27 | [-2.53, 2.46] | -0.03 | 0.978 + 1 24.4517217 - 0 -0.2549517 | -0.14 | 1.59 | [-3.26, 2.98] | -0.09 | 0.930 + 1 28.5695006 - 0 -0.2549517 | -0.24 | 1.93 | [-4.02, 3.53] | -0.13 | 0.899 + 1 32.6872795 - 0 -0.2549517 | -0.35 | 2.27 | [-4.79, 4.10] | -0.15 | 0.878 + 0 7.9806061 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 12.0983850 - 0 3.8628272 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 16.2161639 - 0 3.8628272 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 20.3339428 - 0 3.8628272 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 24.4517217 - 0 3.8628272 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 28.5695006 - 0 3.8628272 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 32.6872795 - 0 3.8628272 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 1 -4.3727306 - 0 3.8628272 | 0.51 | 1.25 | [-1.93, 2.95] | 0.41 | 0.680 + 1 -0.2549517 - 0 3.8628272 | 0.41 | 0.94 | [-1.44, 2.26] | 0.43 | 0.665 + 1 3.8628272 - 0 3.8628272 | 0.30 | 0.70 | [-1.07, 1.68] | 0.43 | 0.665 + 1 7.9806061 - 0 3.8628272 | 0.20 | 0.60 | [-0.98, 1.38] | 0.33 | 0.738 + 1 12.0983850 - 0 3.8628272 | 0.10 | 0.70 | [-1.28, 1.47] | 0.14 | 0.890 + 1 16.2161639 - 0 3.8628272 | -6.65e-03 | 0.94 | [-1.85, 1.83] | -7.09e-03 | 0.994 + 1 20.3339428 - 0 3.8628272 | -0.11 | 1.24 | [-2.54, 2.32] | -0.09 | 0.929 + 1 24.4517217 - 0 3.8628272 | -0.21 | 1.56 | [-3.28, 2.85] | -0.14 | 0.891 + 1 28.5695006 - 0 3.8628272 | -0.32 | 1.90 | [-4.05, 3.41] | -0.17 | 0.867 + 1 32.6872795 - 0 3.8628272 | -0.42 | 2.25 | [-4.83, 3.99] | -0.19 | 0.851 + 0 12.0983850 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 16.2161639 - 0 7.9806061 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 20.3339428 - 0 7.9806061 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 24.4517217 - 0 7.9806061 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 28.5695006 - 0 7.9806061 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 32.6872795 - 0 7.9806061 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 1 -4.3727306 - 0 7.9806061 | 0.44 | 1.23 | [-1.97, 2.84] | 0.36 | 0.721 + 1 -0.2549517 - 0 7.9806061 | 0.33 | 0.92 | [-1.47, 2.14] | 0.36 | 0.717 + 1 3.8628272 - 0 7.9806061 | 0.23 | 0.67 | [-1.09, 1.55] | 0.34 | 0.732 + 1 7.9806061 - 0 7.9806061 | 0.13 | 0.56 | [-0.98, 1.23] | 0.22 | 0.823 + 1 12.0983850 - 0 7.9806061 | 0.02 | 0.67 | [-1.29, 1.33] | 0.03 | 0.973 + 1 16.2161639 - 0 7.9806061 | -0.08 | 0.92 | [-1.88, 1.71] | -0.09 | 0.929 + 1 20.3339428 - 0 7.9806061 | -0.19 | 1.22 | [-2.58, 2.21] | -0.15 | 0.879 + 1 24.4517217 - 0 7.9806061 | -0.29 | 1.55 | [-3.33, 2.75] | -0.19 | 0.852 + 1 28.5695006 - 0 7.9806061 | -0.39 | 1.89 | [-4.11, 3.32] | -0.21 | 0.836 + 1 32.6872795 - 0 7.9806061 | -0.50 | 2.24 | [-4.89, 3.90] | -0.22 | 0.825 + 0 16.2161639 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 20.3339428 - 0 12.0983850 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 24.4517217 - 0 12.0983850 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 28.5695006 - 0 12.0983850 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 32.6872795 - 0 12.0983850 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 1 -4.3727306 - 0 12.0983850 | 0.36 | 1.23 | [-2.04, 2.77] | 0.30 | 0.767 + 1 -0.2549517 - 0 12.0983850 | 0.26 | 0.92 | [-1.54, 2.06] | 0.28 | 0.778 + 1 3.8628272 - 0 12.0983850 | 0.16 | 0.67 | [-1.16, 1.47] | 0.23 | 0.818 + 1 7.9806061 - 0 12.0983850 | 0.05 | 0.57 | [-1.06, 1.16] | 0.09 | 0.928 + 1 12.0983850 - 0 12.0983850 | -0.05 | 0.67 | [-1.37, 1.26] | -0.08 | 0.937 + 1 16.2161639 - 0 12.0983850 | -0.16 | 0.92 | [-1.96, 1.64] | -0.17 | 0.864 + 1 20.3339428 - 0 12.0983850 | -0.26 | 1.22 | [-2.66, 2.14] | -0.21 | 0.831 + 1 24.4517217 - 0 12.0983850 | -0.36 | 1.55 | [-3.41, 2.68] | -0.23 | 0.815 + 1 28.5695006 - 0 12.0983850 | -0.47 | 1.90 | [-4.18, 3.25] | -0.25 | 0.805 + 1 32.6872795 - 0 12.0983850 | -0.57 | 2.24 | [-4.97, 3.83] | -0.25 | 0.799 + 0 20.3339428 - 0 16.2161639 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 24.4517217 - 0 16.2161639 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 28.5695006 - 0 16.2161639 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 32.6872795 - 0 16.2161639 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 1 -4.3727306 - 0 16.2161639 | 0.29 | 1.24 | [-2.15, 2.72] | 0.23 | 0.817 + 1 -0.2549517 - 0 16.2161639 | 0.18 | 0.94 | [-1.66, 2.03] | 0.20 | 0.845 + 1 3.8628272 - 0 16.2161639 | 0.08 | 0.70 | [-1.30, 1.46] | 0.11 | 0.909 + 1 7.9806061 - 0 16.2161639 | -0.02 | 0.60 | [-1.20, 1.16] | -0.04 | 0.968 + 1 12.0983850 - 0 16.2161639 | -0.13 | 0.70 | [-1.51, 1.25] | -0.18 | 0.856 + 1 16.2161639 - 0 16.2161639 | -0.23 | 0.94 | [-2.08, 1.61] | -0.25 | 0.806 + 1 20.3339428 - 0 16.2161639 | -0.34 | 1.24 | [-2.77, 2.10] | -0.27 | 0.787 + 1 24.4517217 - 0 16.2161639 | -0.44 | 1.57 | [-3.51, 2.63] | -0.28 | 0.779 + 1 28.5695006 - 0 16.2161639 | -0.54 | 1.91 | [-4.28, 3.20] | -0.28 | 0.776 + 1 32.6872795 - 0 16.2161639 | -0.65 | 2.25 | [-5.07, 3.77] | -0.29 | 0.774 + 0 24.4517217 - 0 20.3339428 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 28.5695006 - 0 20.3339428 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 32.6872795 - 0 20.3339428 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 1 -4.3727306 - 0 20.3339428 | 0.21 | 1.28 | [-2.29, 2.71] | 0.17 | 0.868 + 1 -0.2549517 - 0 20.3339428 | 0.11 | 0.99 | [-1.82, 2.04] | 0.11 | 0.912 + 1 3.8628272 - 0 20.3339428 | 5.09e-03 | 0.76 | [-1.49, 1.50] | 6.68e-03 | 0.995 + 1 7.9806061 - 0 20.3339428 | -0.10 | 0.67 | [-1.41, 1.22] | -0.15 | 0.883 + 1 12.0983850 - 0 20.3339428 | -0.20 | 0.76 | [-1.70, 1.29] | -0.27 | 0.790 + 1 16.2161639 - 0 20.3339428 | -0.31 | 0.99 | [-2.24, 1.63] | -0.31 | 0.756 + 1 20.3339428 - 0 20.3339428 | -0.41 | 1.28 | [-2.91, 2.09] | -0.32 | 0.748 + 1 24.4517217 - 0 20.3339428 | -0.51 | 1.60 | [-3.64, 2.62] | -0.32 | 0.747 + 1 28.5695006 - 0 20.3339428 | -0.62 | 1.93 | [-4.40, 3.17] | -0.32 | 0.749 + 1 32.6872795 - 0 20.3339428 | -0.72 | 2.27 | [-5.18, 3.74] | -0.32 | 0.751 + 0 28.5695006 - 0 24.4517217 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 32.6872795 - 0 24.4517217 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 1 -4.3727306 - 0 24.4517217 | 0.14 | 1.32 | [-2.46, 2.73] | 0.10 | 0.917 + 1 -0.2549517 - 0 24.4517217 | 0.03 | 1.05 | [-2.02, 2.09] | 0.03 | 0.974 + 1 3.8628272 - 0 24.4517217 | -0.07 | 0.84 | [-1.72, 1.58] | -0.08 | 0.934 + 1 7.9806061 - 0 24.4517217 | -0.17 | 0.76 | [-1.67, 1.32] | -0.23 | 0.819 + 1 12.0983850 - 0 24.4517217 | -0.28 | 0.84 | [-1.93, 1.38] | -0.33 | 0.742 + 1 16.2161639 - 0 24.4517217 | -0.38 | 1.05 | [-2.44, 1.68] | -0.36 | 0.717 + 1 20.3339428 - 0 24.4517217 | -0.49 | 1.33 | [-3.09, 2.12] | -0.37 | 0.715 + 1 24.4517217 - 0 24.4517217 | -0.59 | 1.64 | [-3.80, 2.62] | -0.36 | 0.719 + 1 28.5695006 - 0 24.4517217 | -0.69 | 1.97 | [-4.55, 3.16] | -0.35 | 0.724 + 1 32.6872795 - 0 24.4517217 | -0.80 | 2.30 | [-5.31, 3.72] | -0.35 | 0.729 + 0 32.6872795 - 0 28.5695006 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 1 -4.3727306 - 0 28.5695006 | 0.06 | 1.39 | [-2.66, 2.78] | 0.05 | 0.964 + 1 -0.2549517 - 0 28.5695006 | -0.04 | 1.13 | [-2.25, 2.17] | -0.04 | 0.971 + 1 3.8628272 - 0 28.5695006 | -0.14 | 0.94 | [-1.98, 1.69] | -0.15 | 0.877 + 1 7.9806061 - 0 28.5695006 | -0.25 | 0.87 | [-1.95, 1.45] | -0.29 | 0.774 + 1 12.0983850 - 0 28.5695006 | -0.35 | 0.94 | [-2.20, 1.49] | -0.37 | 0.708 + 1 16.2161639 - 0 28.5695006 | -0.46 | 1.13 | [-2.67, 1.76] | -0.40 | 0.687 + 1 20.3339428 - 0 28.5695006 | -0.56 | 1.39 | [-3.29, 2.17] | -0.40 | 0.687 + 1 24.4517217 - 0 28.5695006 | -0.66 | 1.69 | [-3.98, 2.65] | -0.39 | 0.694 + 1 28.5695006 - 0 28.5695006 | -0.77 | 2.01 | [-4.71, 3.17] | -0.38 | 0.702 + 1 32.6872795 - 0 28.5695006 | -0.87 | 2.34 | [-5.46, 3.72] | -0.37 | 0.710 + 1 -4.3727306 - 0 32.6872795 | -0.01 | 1.46 | [-2.88, 2.85] | -8.26e-03 | 0.993 + 1 -0.2549517 - 0 32.6872795 | -0.12 | 1.22 | [-2.51, 2.27] | -0.10 | 0.924 + 1 3.8628272 - 0 32.6872795 | -0.22 | 1.05 | [-2.27, 1.83] | -0.21 | 0.834 + 1 7.9806061 - 0 32.6872795 | -0.32 | 0.98 | [-2.25, 1.60] | -0.33 | 0.742 + 1 12.0983850 - 0 32.6872795 | -0.43 | 1.05 | [-2.49, 1.63] | -0.41 | 0.684 + 1 16.2161639 - 0 32.6872795 | -0.53 | 1.22 | [-2.93, 1.87] | -0.43 | 0.664 + 1 20.3339428 - 0 32.6872795 | -0.64 | 1.47 | [-3.51, 2.24] | -0.43 | 0.665 + 1 24.4517217 - 0 32.6872795 | -0.74 | 1.75 | [-4.18, 2.70] | -0.42 | 0.674 + 1 28.5695006 - 0 32.6872795 | -0.84 | 2.06 | [-4.89, 3.20] | -0.41 | 0.683 + 1 32.6872795 - 0 32.6872795 | -0.95 | 2.39 | [-5.63, 3.74] | -0.40 | 0.692 + 1 -0.2549517 - 1 -4.3727306 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 3.8628272 - 1 -4.3727306 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 7.9806061 - 1 -4.3727306 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 12.0983850 - 1 -4.3727306 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 16.2161639 - 1 -4.3727306 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 20.3339428 - 1 -4.3727306 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 24.4517217 - 1 -4.3727306 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 28.5695006 - 1 -4.3727306 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 + 1 32.6872795 - 1 -4.3727306 | -0.93 | 3.26 | [-7.32, 5.45] | -0.29 | 0.774 + 1 3.8628272 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 7.9806061 - 1 -0.2549517 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 12.0983850 - 1 -0.2549517 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 16.2161639 - 1 -0.2549517 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 20.3339428 - 1 -0.2549517 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 24.4517217 - 1 -0.2549517 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 28.5695006 - 1 -0.2549517 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 32.6872795 - 1 -0.2549517 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 + 1 7.9806061 - 1 3.8628272 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 12.0983850 - 1 3.8628272 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 16.2161639 - 1 3.8628272 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 20.3339428 - 1 3.8628272 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 24.4517217 - 1 3.8628272 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 28.5695006 - 1 3.8628272 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 32.6872795 - 1 3.8628272 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 12.0983850 - 1 7.9806061 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 16.2161639 - 1 7.9806061 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 20.3339428 - 1 7.9806061 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 24.4517217 - 1 7.9806061 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 28.5695006 - 1 7.9806061 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 32.6872795 - 1 7.9806061 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 16.2161639 - 1 12.0983850 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 20.3339428 - 1 12.0983850 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 24.4517217 - 1 12.0983850 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 28.5695006 - 1 12.0983850 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 32.6872795 - 1 12.0983850 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 20.3339428 - 1 16.2161639 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 24.4517217 - 1 16.2161639 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 28.5695006 - 1 16.2161639 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 32.6872795 - 1 16.2161639 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 24.4517217 - 1 20.3339428 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 28.5695006 - 1 20.3339428 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 32.6872795 - 1 20.3339428 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 28.5695006 - 1 24.4517217 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 32.6872795 - 1 24.4517217 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 32.6872795 - 1 28.5695006 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + + Variable predicted: outcome + Predictors contrasted: var_binom, var_cont + Predictors averaged: groups + Contrasts are on the link-scale. + +# print hypothesis_test predictions link scale + + Code + print(out) + Output + Model-based Contrasts Analysis + + Parameter | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------------- + 0 -0.2549517 - 0 -4.3727306 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 3.8628272 - 0 -4.3727306 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 7.9806061 - 0 -4.3727306 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 12.0983850 - 0 -4.3727306 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 16.2161639 - 0 -4.3727306 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 20.3339428 - 0 -4.3727306 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 24.4517217 - 0 -4.3727306 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 0 28.5695006 - 0 -4.3727306 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 + 0 32.6872795 - 0 -4.3727306 | 0.67 | 1.32 | [-1.91, 3.26] | 0.51 | 0.610 + 1 -4.3727306 - 0 -4.3727306 | 0.66 | 1.33 | [-1.94, 3.27] | 0.50 | 0.618 + 1 -0.2549517 - 0 -4.3727306 | 0.56 | 1.05 | [-1.51, 2.62] | 0.53 | 0.596 + 1 3.8628272 - 0 -4.3727306 | 0.45 | 0.84 | [-1.20, 2.11] | 0.54 | 0.590 + 1 7.9806061 - 0 -4.3727306 | 0.35 | 0.76 | [-1.14, 1.84] | 0.46 | 0.644 + 1 12.0983850 - 0 -4.3727306 | 0.25 | 0.84 | [-1.40, 1.89] | 0.29 | 0.768 + 1 16.2161639 - 0 -4.3727306 | 0.14 | 1.05 | [-1.91, 2.19] | 0.14 | 0.891 + 1 20.3339428 - 0 -4.3727306 | 0.04 | 1.32 | [-2.55, 2.63] | 0.03 | 0.976 + 1 24.4517217 - 0 -4.3727306 | -0.06 | 1.63 | [-3.26, 3.13] | -0.04 | 0.968 + 1 28.5695006 - 0 -4.3727306 | -0.17 | 1.96 | [-4.01, 3.67] | -0.09 | 0.931 + 1 32.6872795 - 0 -4.3727306 | -0.27 | 2.30 | [-4.77, 4.23] | -0.12 | 0.906 + 0 3.8628272 - 0 -0.2549517 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 7.9806061 - 0 -0.2549517 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 12.0983850 - 0 -0.2549517 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 16.2161639 - 0 -0.2549517 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 20.3339428 - 0 -0.2549517 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 24.4517217 - 0 -0.2549517 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 28.5695006 - 0 -0.2549517 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 0 32.6872795 - 0 -0.2549517 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 + 1 -4.3727306 - 0 -0.2549517 | 0.59 | 1.28 | [-1.92, 3.10] | 0.46 | 0.646 + 1 -0.2549517 - 0 -0.2549517 | 0.48 | 0.99 | [-1.46, 2.42] | 0.49 | 0.625 + 1 3.8628272 - 0 -0.2549517 | 0.38 | 0.76 | [-1.12, 1.88] | 0.50 | 0.619 + 1 7.9806061 - 0 -0.2549517 | 0.28 | 0.67 | [-1.04, 1.59] | 0.41 | 0.680 + 1 12.0983850 - 0 -0.2549517 | 0.17 | 0.76 | [-1.31, 1.66] | 0.23 | 0.820 + 1 16.2161639 - 0 -0.2549517 | 0.07 | 0.98 | [-1.86, 1.99] | 0.07 | 0.945 + 1 20.3339428 - 0 -0.2549517 | -0.04 | 1.27 | [-2.53, 2.46] | -0.03 | 0.978 + 1 24.4517217 - 0 -0.2549517 | -0.14 | 1.59 | [-3.26, 2.98] | -0.09 | 0.930 + 1 28.5695006 - 0 -0.2549517 | -0.24 | 1.93 | [-4.02, 3.53] | -0.13 | 0.899 + 1 32.6872795 - 0 -0.2549517 | -0.35 | 2.27 | [-4.79, 4.10] | -0.15 | 0.878 + 0 7.9806061 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 12.0983850 - 0 3.8628272 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 16.2161639 - 0 3.8628272 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 20.3339428 - 0 3.8628272 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 24.4517217 - 0 3.8628272 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 28.5695006 - 0 3.8628272 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 32.6872795 - 0 3.8628272 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 1 -4.3727306 - 0 3.8628272 | 0.51 | 1.25 | [-1.93, 2.95] | 0.41 | 0.680 + 1 -0.2549517 - 0 3.8628272 | 0.41 | 0.94 | [-1.44, 2.26] | 0.43 | 0.665 + 1 3.8628272 - 0 3.8628272 | 0.30 | 0.70 | [-1.07, 1.68] | 0.43 | 0.665 + 1 7.9806061 - 0 3.8628272 | 0.20 | 0.60 | [-0.98, 1.38] | 0.33 | 0.738 + 1 12.0983850 - 0 3.8628272 | 0.10 | 0.70 | [-1.28, 1.47] | 0.14 | 0.890 + 1 16.2161639 - 0 3.8628272 | -6.65e-03 | 0.94 | [-1.85, 1.83] | -7.09e-03 | 0.994 + 1 20.3339428 - 0 3.8628272 | -0.11 | 1.24 | [-2.54, 2.32] | -0.09 | 0.929 + 1 24.4517217 - 0 3.8628272 | -0.21 | 1.56 | [-3.28, 2.85] | -0.14 | 0.891 + 1 28.5695006 - 0 3.8628272 | -0.32 | 1.90 | [-4.05, 3.41] | -0.17 | 0.867 + 1 32.6872795 - 0 3.8628272 | -0.42 | 2.25 | [-4.83, 3.99] | -0.19 | 0.851 + 0 12.0983850 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 16.2161639 - 0 7.9806061 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 20.3339428 - 0 7.9806061 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 24.4517217 - 0 7.9806061 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 28.5695006 - 0 7.9806061 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 32.6872795 - 0 7.9806061 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 1 -4.3727306 - 0 7.9806061 | 0.44 | 1.23 | [-1.97, 2.84] | 0.36 | 0.721 + 1 -0.2549517 - 0 7.9806061 | 0.33 | 0.92 | [-1.47, 2.14] | 0.36 | 0.717 + 1 3.8628272 - 0 7.9806061 | 0.23 | 0.67 | [-1.09, 1.55] | 0.34 | 0.732 + 1 7.9806061 - 0 7.9806061 | 0.13 | 0.56 | [-0.98, 1.23] | 0.22 | 0.823 + 1 12.0983850 - 0 7.9806061 | 0.02 | 0.67 | [-1.29, 1.33] | 0.03 | 0.973 + 1 16.2161639 - 0 7.9806061 | -0.08 | 0.92 | [-1.88, 1.71] | -0.09 | 0.929 + 1 20.3339428 - 0 7.9806061 | -0.19 | 1.22 | [-2.58, 2.21] | -0.15 | 0.879 + 1 24.4517217 - 0 7.9806061 | -0.29 | 1.55 | [-3.33, 2.75] | -0.19 | 0.852 + 1 28.5695006 - 0 7.9806061 | -0.39 | 1.89 | [-4.11, 3.32] | -0.21 | 0.836 + 1 32.6872795 - 0 7.9806061 | -0.50 | 2.24 | [-4.89, 3.90] | -0.22 | 0.825 + 0 16.2161639 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 20.3339428 - 0 12.0983850 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 24.4517217 - 0 12.0983850 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 28.5695006 - 0 12.0983850 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 32.6872795 - 0 12.0983850 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 1 -4.3727306 - 0 12.0983850 | 0.36 | 1.23 | [-2.04, 2.77] | 0.30 | 0.767 + 1 -0.2549517 - 0 12.0983850 | 0.26 | 0.92 | [-1.54, 2.06] | 0.28 | 0.778 + 1 3.8628272 - 0 12.0983850 | 0.16 | 0.67 | [-1.16, 1.47] | 0.23 | 0.818 + 1 7.9806061 - 0 12.0983850 | 0.05 | 0.57 | [-1.06, 1.16] | 0.09 | 0.928 + 1 12.0983850 - 0 12.0983850 | -0.05 | 0.67 | [-1.37, 1.26] | -0.08 | 0.937 + 1 16.2161639 - 0 12.0983850 | -0.16 | 0.92 | [-1.96, 1.64] | -0.17 | 0.864 + 1 20.3339428 - 0 12.0983850 | -0.26 | 1.22 | [-2.66, 2.14] | -0.21 | 0.831 + 1 24.4517217 - 0 12.0983850 | -0.36 | 1.55 | [-3.41, 2.68] | -0.23 | 0.815 + 1 28.5695006 - 0 12.0983850 | -0.47 | 1.90 | [-4.18, 3.25] | -0.25 | 0.805 + 1 32.6872795 - 0 12.0983850 | -0.57 | 2.24 | [-4.97, 3.83] | -0.25 | 0.799 + 0 20.3339428 - 0 16.2161639 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 24.4517217 - 0 16.2161639 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 28.5695006 - 0 16.2161639 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 32.6872795 - 0 16.2161639 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 1 -4.3727306 - 0 16.2161639 | 0.29 | 1.24 | [-2.15, 2.72] | 0.23 | 0.817 + 1 -0.2549517 - 0 16.2161639 | 0.18 | 0.94 | [-1.66, 2.03] | 0.20 | 0.845 + 1 3.8628272 - 0 16.2161639 | 0.08 | 0.70 | [-1.30, 1.46] | 0.11 | 0.909 + 1 7.9806061 - 0 16.2161639 | -0.02 | 0.60 | [-1.20, 1.16] | -0.04 | 0.968 + 1 12.0983850 - 0 16.2161639 | -0.13 | 0.70 | [-1.51, 1.25] | -0.18 | 0.856 + 1 16.2161639 - 0 16.2161639 | -0.23 | 0.94 | [-2.08, 1.61] | -0.25 | 0.806 + 1 20.3339428 - 0 16.2161639 | -0.34 | 1.24 | [-2.77, 2.10] | -0.27 | 0.787 + 1 24.4517217 - 0 16.2161639 | -0.44 | 1.57 | [-3.51, 2.63] | -0.28 | 0.779 + 1 28.5695006 - 0 16.2161639 | -0.54 | 1.91 | [-4.28, 3.20] | -0.28 | 0.776 + 1 32.6872795 - 0 16.2161639 | -0.65 | 2.25 | [-5.07, 3.77] | -0.29 | 0.774 + 0 24.4517217 - 0 20.3339428 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 28.5695006 - 0 20.3339428 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 32.6872795 - 0 20.3339428 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 1 -4.3727306 - 0 20.3339428 | 0.21 | 1.28 | [-2.29, 2.71] | 0.17 | 0.868 + 1 -0.2549517 - 0 20.3339428 | 0.11 | 0.99 | [-1.82, 2.04] | 0.11 | 0.912 + 1 3.8628272 - 0 20.3339428 | 5.09e-03 | 0.76 | [-1.49, 1.50] | 6.68e-03 | 0.995 + 1 7.9806061 - 0 20.3339428 | -0.10 | 0.67 | [-1.41, 1.22] | -0.15 | 0.883 + 1 12.0983850 - 0 20.3339428 | -0.20 | 0.76 | [-1.70, 1.29] | -0.27 | 0.790 + 1 16.2161639 - 0 20.3339428 | -0.31 | 0.99 | [-2.24, 1.63] | -0.31 | 0.756 + 1 20.3339428 - 0 20.3339428 | -0.41 | 1.28 | [-2.91, 2.09] | -0.32 | 0.748 + 1 24.4517217 - 0 20.3339428 | -0.51 | 1.60 | [-3.64, 2.62] | -0.32 | 0.747 + 1 28.5695006 - 0 20.3339428 | -0.62 | 1.93 | [-4.40, 3.17] | -0.32 | 0.749 + 1 32.6872795 - 0 20.3339428 | -0.72 | 2.27 | [-5.18, 3.74] | -0.32 | 0.751 + 0 28.5695006 - 0 24.4517217 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 32.6872795 - 0 24.4517217 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 1 -4.3727306 - 0 24.4517217 | 0.14 | 1.32 | [-2.46, 2.73] | 0.10 | 0.917 + 1 -0.2549517 - 0 24.4517217 | 0.03 | 1.05 | [-2.02, 2.09] | 0.03 | 0.974 + 1 3.8628272 - 0 24.4517217 | -0.07 | 0.84 | [-1.72, 1.58] | -0.08 | 0.934 + 1 7.9806061 - 0 24.4517217 | -0.17 | 0.76 | [-1.67, 1.32] | -0.23 | 0.819 + 1 12.0983850 - 0 24.4517217 | -0.28 | 0.84 | [-1.93, 1.38] | -0.33 | 0.742 + 1 16.2161639 - 0 24.4517217 | -0.38 | 1.05 | [-2.44, 1.68] | -0.36 | 0.717 + 1 20.3339428 - 0 24.4517217 | -0.49 | 1.33 | [-3.09, 2.12] | -0.37 | 0.715 + 1 24.4517217 - 0 24.4517217 | -0.59 | 1.64 | [-3.80, 2.62] | -0.36 | 0.719 + 1 28.5695006 - 0 24.4517217 | -0.69 | 1.97 | [-4.55, 3.16] | -0.35 | 0.724 + 1 32.6872795 - 0 24.4517217 | -0.80 | 2.30 | [-5.31, 3.72] | -0.35 | 0.729 + 0 32.6872795 - 0 28.5695006 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 1 -4.3727306 - 0 28.5695006 | 0.06 | 1.39 | [-2.66, 2.78] | 0.05 | 0.964 + 1 -0.2549517 - 0 28.5695006 | -0.04 | 1.13 | [-2.25, 2.17] | -0.04 | 0.971 + 1 3.8628272 - 0 28.5695006 | -0.14 | 0.94 | [-1.98, 1.69] | -0.15 | 0.877 + 1 7.9806061 - 0 28.5695006 | -0.25 | 0.87 | [-1.95, 1.45] | -0.29 | 0.774 + 1 12.0983850 - 0 28.5695006 | -0.35 | 0.94 | [-2.20, 1.49] | -0.37 | 0.708 + 1 16.2161639 - 0 28.5695006 | -0.46 | 1.13 | [-2.67, 1.76] | -0.40 | 0.687 + 1 20.3339428 - 0 28.5695006 | -0.56 | 1.39 | [-3.29, 2.17] | -0.40 | 0.687 + 1 24.4517217 - 0 28.5695006 | -0.66 | 1.69 | [-3.98, 2.65] | -0.39 | 0.694 + 1 28.5695006 - 0 28.5695006 | -0.77 | 2.01 | [-4.71, 3.17] | -0.38 | 0.702 + 1 32.6872795 - 0 28.5695006 | -0.87 | 2.34 | [-5.46, 3.72] | -0.37 | 0.710 + 1 -4.3727306 - 0 32.6872795 | -0.01 | 1.46 | [-2.88, 2.85] | -8.26e-03 | 0.993 + 1 -0.2549517 - 0 32.6872795 | -0.12 | 1.22 | [-2.51, 2.27] | -0.10 | 0.924 + 1 3.8628272 - 0 32.6872795 | -0.22 | 1.05 | [-2.27, 1.83] | -0.21 | 0.834 + 1 7.9806061 - 0 32.6872795 | -0.32 | 0.98 | [-2.25, 1.60] | -0.33 | 0.742 + 1 12.0983850 - 0 32.6872795 | -0.43 | 1.05 | [-2.49, 1.63] | -0.41 | 0.684 + 1 16.2161639 - 0 32.6872795 | -0.53 | 1.22 | [-2.93, 1.87] | -0.43 | 0.664 + 1 20.3339428 - 0 32.6872795 | -0.64 | 1.47 | [-3.51, 2.24] | -0.43 | 0.665 + 1 24.4517217 - 0 32.6872795 | -0.74 | 1.75 | [-4.18, 2.70] | -0.42 | 0.674 + 1 28.5695006 - 0 32.6872795 | -0.84 | 2.06 | [-4.89, 3.20] | -0.41 | 0.683 + 1 32.6872795 - 0 32.6872795 | -0.95 | 2.39 | [-5.63, 3.74] | -0.40 | 0.692 + 1 -0.2549517 - 1 -4.3727306 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 3.8628272 - 1 -4.3727306 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 7.9806061 - 1 -4.3727306 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 12.0983850 - 1 -4.3727306 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 16.2161639 - 1 -4.3727306 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 20.3339428 - 1 -4.3727306 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 24.4517217 - 1 -4.3727306 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 28.5695006 - 1 -4.3727306 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 + 1 32.6872795 - 1 -4.3727306 | -0.93 | 3.26 | [-7.32, 5.45] | -0.29 | 0.774 + 1 3.8628272 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 7.9806061 - 1 -0.2549517 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 12.0983850 - 1 -0.2549517 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 16.2161639 - 1 -0.2549517 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 20.3339428 - 1 -0.2549517 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 24.4517217 - 1 -0.2549517 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 28.5695006 - 1 -0.2549517 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 32.6872795 - 1 -0.2549517 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 + 1 7.9806061 - 1 3.8628272 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 12.0983850 - 1 3.8628272 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 16.2161639 - 1 3.8628272 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 20.3339428 - 1 3.8628272 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 24.4517217 - 1 3.8628272 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 28.5695006 - 1 3.8628272 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 32.6872795 - 1 3.8628272 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 12.0983850 - 1 7.9806061 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 16.2161639 - 1 7.9806061 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 20.3339428 - 1 7.9806061 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 24.4517217 - 1 7.9806061 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 28.5695006 - 1 7.9806061 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 32.6872795 - 1 7.9806061 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 16.2161639 - 1 12.0983850 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 20.3339428 - 1 12.0983850 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 24.4517217 - 1 12.0983850 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 28.5695006 - 1 12.0983850 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 32.6872795 - 1 12.0983850 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 20.3339428 - 1 16.2161639 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 24.4517217 - 1 16.2161639 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 28.5695006 - 1 16.2161639 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 32.6872795 - 1 16.2161639 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 24.4517217 - 1 20.3339428 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 28.5695006 - 1 20.3339428 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 32.6872795 - 1 20.3339428 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 28.5695006 - 1 24.4517217 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 32.6872795 - 1 24.4517217 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 32.6872795 - 1 28.5695006 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + + Variable predicted: outcome + Predictors contrasted: var_binom, var_cont + Predictors averaged: groups + Contrasts are on the link-scale. + +# print hypothesis_test contrasts response scale + + Code + print(out) + Output + Model-based Contrasts Analysis + + Parameter | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------------- + 0 -0.2549517 - 0 -4.3727306 | 0.02 | 0.03 | [-0.05, 0.09] | 0.53 | 0.597 + 0 3.8628272 - 0 -4.3727306 | 0.04 | 0.07 | [-0.10, 0.17] | 0.52 | 0.601 + 0 7.9806061 - 0 -4.3727306 | 0.06 | 0.11 | [-0.15, 0.26] | 0.52 | 0.603 + 0 12.0983850 - 0 -4.3727306 | 0.07 | 0.14 | [-0.21, 0.35] | 0.52 | 0.605 + 0 16.2161639 - 0 -4.3727306 | 0.09 | 0.18 | [-0.26, 0.44] | 0.52 | 0.606 + 0 20.3339428 - 0 -4.3727306 | 0.11 | 0.22 | [-0.31, 0.53] | 0.51 | 0.607 + 0 24.4517217 - 0 -4.3727306 | 0.13 | 0.25 | [-0.36, 0.62] | 0.52 | 0.606 + 0 28.5695006 - 0 -4.3727306 | 0.15 | 0.29 | [-0.41, 0.71] | 0.52 | 0.606 + 0 32.6872795 - 0 -4.3727306 | 0.17 | 0.32 | [-0.46, 0.80] | 0.52 | 0.604 + 1 -4.3727306 - 0 -4.3727306 | 0.16 | 0.33 | [-0.47, 0.80] | 0.50 | 0.615 + 1 -0.2549517 - 0 -4.3727306 | 0.14 | 0.26 | [-0.37, 0.65] | 0.53 | 0.594 + 1 3.8628272 - 0 -4.3727306 | 0.11 | 0.21 | [-0.30, 0.52] | 0.54 | 0.589 + 1 7.9806061 - 0 -4.3727306 | 0.09 | 0.19 | [-0.28, 0.45] | 0.46 | 0.643 + 1 12.0983850 - 0 -4.3727306 | 0.06 | 0.21 | [-0.34, 0.46] | 0.29 | 0.769 + 1 16.2161639 - 0 -4.3727306 | 0.03 | 0.26 | [-0.47, 0.54] | 0.14 | 0.892 + 1 20.3339428 - 0 -4.3727306 | 9.51e-03 | 0.32 | [-0.62, 0.64] | 0.03 | 0.976 + 1 24.4517217 - 0 -4.3727306 | -0.02 | 0.39 | [-0.77, 0.74] | -0.04 | 0.968 + 1 28.5695006 - 0 -4.3727306 | -0.04 | 0.45 | [-0.93, 0.85] | -0.09 | 0.930 + 1 32.6872795 - 0 -4.3727306 | -0.06 | 0.52 | [-1.07, 0.95] | -0.12 | 0.902 + 0 3.8628272 - 0 -0.2549517 | 0.02 | 0.04 | [-0.05, 0.09] | 0.52 | 0.604 + 0 7.9806061 - 0 -0.2549517 | 0.04 | 0.07 | [-0.10, 0.18] | 0.52 | 0.606 + 0 12.0983850 - 0 -0.2549517 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.607 + 0 16.2161639 - 0 -0.2549517 | 0.07 | 0.14 | [-0.21, 0.36] | 0.51 | 0.608 + 0 20.3339428 - 0 -0.2549517 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.608 + 0 24.4517217 - 0 -0.2549517 | 0.11 | 0.22 | [-0.32, 0.54] | 0.51 | 0.608 + 0 28.5695006 - 0 -0.2549517 | 0.13 | 0.25 | [-0.37, 0.63] | 0.51 | 0.607 + 0 32.6872795 - 0 -0.2549517 | 0.15 | 0.29 | [-0.41, 0.71] | 0.52 | 0.605 + 1 -4.3727306 - 0 -0.2549517 | 0.15 | 0.31 | [-0.47, 0.76] | 0.46 | 0.643 + 1 -0.2549517 - 0 -0.2549517 | 0.12 | 0.25 | [-0.36, 0.60] | 0.49 | 0.624 + 1 3.8628272 - 0 -0.2549517 | 0.09 | 0.19 | [-0.28, 0.47] | 0.50 | 0.619 + 1 7.9806061 - 0 -0.2549517 | 0.07 | 0.17 | [-0.26, 0.39] | 0.41 | 0.681 + 1 12.0983850 - 0 -0.2549517 | 0.04 | 0.19 | [-0.33, 0.41] | 0.23 | 0.821 + 1 16.2161639 - 0 -0.2549517 | 0.02 | 0.24 | [-0.46, 0.49] | 0.07 | 0.945 + 1 20.3339428 - 0 -0.2549517 | -8.63e-03 | 0.31 | [-0.61, 0.59] | -0.03 | 0.978 + 1 24.4517217 - 0 -0.2549517 | -0.03 | 0.38 | [-0.77, 0.71] | -0.09 | 0.929 + 1 28.5695006 - 0 -0.2549517 | -0.06 | 0.45 | [-0.93, 0.82] | -0.13 | 0.897 + 1 32.6872795 - 0 -0.2549517 | -0.08 | 0.51 | [-1.08, 0.92] | -0.16 | 0.873 + 0 7.9806061 - 0 3.8628272 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.608 + 0 12.0983850 - 0 3.8628272 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.609 + 0 16.2161639 - 0 3.8628272 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 + 0 20.3339428 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 24.4517217 - 0 3.8628272 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.609 + 0 28.5695006 - 0 3.8628272 | 0.11 | 0.22 | [-0.31, 0.54] | 0.51 | 0.607 + 0 32.6872795 - 0 3.8628272 | 0.13 | 0.25 | [-0.36, 0.62] | 0.52 | 0.605 + 1 -4.3727306 - 0 3.8628272 | 0.13 | 0.31 | [-0.47, 0.73] | 0.42 | 0.677 + 1 -0.2549517 - 0 3.8628272 | 0.10 | 0.23 | [-0.36, 0.56] | 0.43 | 0.664 + 1 3.8628272 - 0 3.8628272 | 0.08 | 0.18 | [-0.27, 0.42] | 0.43 | 0.665 + 1 7.9806061 - 0 3.8628272 | 0.05 | 0.15 | [-0.24, 0.34] | 0.33 | 0.739 + 1 12.0983850 - 0 3.8628272 | 0.02 | 0.17 | [-0.32, 0.36] | 0.14 | 0.890 + 1 16.2161639 - 0 3.8628272 | -1.64e-03 | 0.23 | [-0.45, 0.45] | -7.09e-03 | 0.994 + 1 20.3339428 - 0 3.8628272 | -0.03 | 0.30 | [-0.61, 0.56] | -0.09 | 0.928 + 1 24.4517217 - 0 3.8628272 | -0.05 | 0.37 | [-0.78, 0.68] | -0.14 | 0.889 + 1 28.5695006 - 0 3.8628272 | -0.08 | 0.44 | [-0.94, 0.79] | -0.17 | 0.863 + 1 32.6872795 - 0 3.8628272 | -0.10 | 0.50 | [-1.09, 0.89] | -0.20 | 0.843 + 0 12.0983850 - 0 7.9806061 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.610 + 0 16.2161639 - 0 7.9806061 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.611 + 0 20.3339428 - 0 7.9806061 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 + 0 24.4517217 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.609 + 0 28.5695006 - 0 7.9806061 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.607 + 0 32.6872795 - 0 7.9806061 | 0.11 | 0.22 | [-0.31, 0.54] | 0.52 | 0.605 + 1 -4.3727306 - 0 7.9806061 | 0.11 | 0.30 | [-0.48, 0.70] | 0.36 | 0.718 + 1 -0.2549517 - 0 7.9806061 | 0.08 | 0.23 | [-0.36, 0.53] | 0.36 | 0.716 + 1 3.8628272 - 0 7.9806061 | 0.06 | 0.17 | [-0.27, 0.39] | 0.34 | 0.733 + 1 7.9806061 - 0 7.9806061 | 0.03 | 0.14 | [-0.25, 0.31] | 0.22 | 0.824 + 1 12.0983850 - 0 7.9806061 | 5.53e-03 | 0.17 | [-0.32, 0.33] | 0.03 | 0.974 + 1 16.2161639 - 0 7.9806061 | -0.02 | 0.23 | [-0.46, 0.42] | -0.09 | 0.929 + 1 20.3339428 - 0 7.9806061 | -0.05 | 0.30 | [-0.63, 0.53] | -0.15 | 0.878 + 1 24.4517217 - 0 7.9806061 | -0.07 | 0.37 | [-0.79, 0.65] | -0.19 | 0.848 + 1 28.5695006 - 0 7.9806061 | -0.09 | 0.44 | [-0.95, 0.76] | -0.22 | 0.829 + 1 32.6872795 - 0 7.9806061 | -0.12 | 0.50 | [-1.10, 0.87] | -0.24 | 0.814 + 0 16.2161639 - 0 12.0983850 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.611 + 0 20.3339428 - 0 12.0983850 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.610 + 0 24.4517217 - 0 12.0983850 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.608 + 0 28.5695006 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.52 | 0.606 + 0 32.6872795 - 0 12.0983850 | 0.09 | 0.18 | [-0.26, 0.45] | 0.52 | 0.603 + 1 -4.3727306 - 0 12.0983850 | 0.09 | 0.30 | [-0.50, 0.68] | 0.30 | 0.764 + 1 -0.2549517 - 0 12.0983850 | 0.06 | 0.23 | [-0.38, 0.51] | 0.28 | 0.777 + 1 3.8628272 - 0 12.0983850 | 0.04 | 0.17 | [-0.29, 0.37] | 0.23 | 0.818 + 1 7.9806061 - 0 12.0983850 | 0.01 | 0.14 | [-0.26, 0.29] | 0.09 | 0.928 + 1 12.0983850 - 0 12.0983850 | -0.01 | 0.17 | [-0.34, 0.31] | -0.08 | 0.937 + 1 16.2161639 - 0 12.0983850 | -0.04 | 0.23 | [-0.48, 0.40] | -0.17 | 0.864 + 1 20.3339428 - 0 12.0983850 | -0.06 | 0.30 | [-0.64, 0.52] | -0.22 | 0.829 + 1 24.4517217 - 0 12.0983850 | -0.09 | 0.37 | [-0.81, 0.63] | -0.24 | 0.809 + 1 28.5695006 - 0 12.0983850 | -0.11 | 0.44 | [-0.97, 0.75] | -0.26 | 0.796 + 1 32.6872795 - 0 12.0983850 | -0.14 | 0.50 | [-1.12, 0.85] | -0.27 | 0.785 + 0 20.3339428 - 0 16.2161639 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.609 + 0 24.4517217 - 0 16.2161639 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.607 + 0 28.5695006 - 0 16.2161639 | 0.06 | 0.11 | [-0.16, 0.27] | 0.52 | 0.605 + 0 32.6872795 - 0 16.2161639 | 0.07 | 0.14 | [-0.21, 0.35] | 0.52 | 0.601 + 1 -4.3727306 - 0 16.2161639 | 0.07 | 0.31 | [-0.53, 0.67] | 0.23 | 0.815 + 1 -0.2549517 - 0 16.2161639 | 0.05 | 0.23 | [-0.41, 0.51] | 0.20 | 0.845 + 1 3.8628272 - 0 16.2161639 | 0.02 | 0.18 | [-0.32, 0.36] | 0.11 | 0.909 + 1 7.9806061 - 0 16.2161639 | -5.95e-03 | 0.15 | [-0.30, 0.29] | -0.04 | 0.968 + 1 12.0983850 - 0 16.2161639 | -0.03 | 0.17 | [-0.37, 0.31] | -0.18 | 0.855 + 1 16.2161639 - 0 16.2161639 | -0.06 | 0.23 | [-0.51, 0.40] | -0.25 | 0.804 + 1 20.3339428 - 0 16.2161639 | -0.08 | 0.30 | [-0.67, 0.51] | -0.28 | 0.783 + 1 24.4517217 - 0 16.2161639 | -0.11 | 0.37 | [-0.84, 0.62] | -0.29 | 0.772 + 1 28.5695006 - 0 16.2161639 | -0.13 | 0.44 | [-1.00, 0.73] | -0.30 | 0.765 + 1 32.6872795 - 0 16.2161639 | -0.16 | 0.51 | [-1.15, 0.84] | -0.31 | 0.758 + 0 24.4517217 - 0 20.3339428 | 0.02 | 0.04 | [-0.05, 0.09] | 0.52 | 0.605 + 0 28.5695006 - 0 20.3339428 | 0.04 | 0.07 | [-0.10, 0.18] | 0.52 | 0.602 + 0 32.6872795 - 0 20.3339428 | 0.06 | 0.11 | [-0.15, 0.26] | 0.53 | 0.599 + 1 -4.3727306 - 0 20.3339428 | 0.05 | 0.31 | [-0.56, 0.67] | 0.17 | 0.866 + 1 -0.2549517 - 0 20.3339428 | 0.03 | 0.25 | [-0.45, 0.51] | 0.11 | 0.912 + 1 3.8628272 - 0 20.3339428 | 1.27e-03 | 0.19 | [-0.37, 0.37] | 6.68e-03 | 0.995 + 1 7.9806061 - 0 20.3339428 | -0.02 | 0.17 | [-0.35, 0.30] | -0.15 | 0.883 + 1 12.0983850 - 0 20.3339428 | -0.05 | 0.19 | [-0.42, 0.32] | -0.27 | 0.790 + 1 16.2161639 - 0 20.3339428 | -0.08 | 0.24 | [-0.55, 0.40] | -0.31 | 0.754 + 1 20.3339428 - 0 20.3339428 | -0.10 | 0.31 | [-0.71, 0.51] | -0.33 | 0.743 + 1 24.4517217 - 0 20.3339428 | -0.13 | 0.38 | [-0.87, 0.62] | -0.33 | 0.739 + 1 28.5695006 - 0 20.3339428 | -0.15 | 0.45 | [-1.03, 0.73] | -0.34 | 0.736 + 1 32.6872795 - 0 20.3339428 | -0.17 | 0.51 | [-1.18, 0.83] | -0.34 | 0.733 + 0 28.5695006 - 0 24.4517217 | 0.02 | 0.04 | [-0.05, 0.09] | 0.53 | 0.599 + 0 32.6872795 - 0 24.4517217 | 0.04 | 0.07 | [-0.10, 0.17] | 0.53 | 0.595 + 1 -4.3727306 - 0 24.4517217 | 0.03 | 0.33 | [-0.61, 0.67] | 0.10 | 0.917 + 1 -0.2549517 - 0 24.4517217 | 8.46e-03 | 0.26 | [-0.50, 0.52] | 0.03 | 0.974 + 1 3.8628272 - 0 24.4517217 | -0.02 | 0.21 | [-0.43, 0.39] | -0.08 | 0.934 + 1 7.9806061 - 0 24.4517217 | -0.04 | 0.19 | [-0.42, 0.33] | -0.23 | 0.819 + 1 12.0983850 - 0 24.4517217 | -0.07 | 0.21 | [-0.48, 0.34] | -0.33 | 0.741 + 1 16.2161639 - 0 24.4517217 | -0.09 | 0.26 | [-0.60, 0.41] | -0.37 | 0.715 + 1 20.3339428 - 0 24.4517217 | -0.12 | 0.32 | [-0.75, 0.51] | -0.37 | 0.710 + 1 24.4517217 - 0 24.4517217 | -0.15 | 0.39 | [-0.91, 0.62] | -0.37 | 0.710 + 1 28.5695006 - 0 24.4517217 | -0.17 | 0.46 | [-1.07, 0.73] | -0.37 | 0.711 + 1 32.6872795 - 0 24.4517217 | -0.19 | 0.52 | [-1.21, 0.82] | -0.37 | 0.710 + 0 32.6872795 - 0 28.5695006 | 0.02 | 0.03 | [-0.05, 0.09] | 0.54 | 0.591 + 1 -4.3727306 - 0 28.5695006 | 0.02 | 0.34 | [-0.65, 0.69] | 0.05 | 0.964 + 1 -0.2549517 - 0 28.5695006 | -0.01 | 0.28 | [-0.56, 0.54] | -0.04 | 0.971 + 1 3.8628272 - 0 28.5695006 | -0.04 | 0.23 | [-0.49, 0.42] | -0.15 | 0.877 + 1 7.9806061 - 0 28.5695006 | -0.06 | 0.22 | [-0.48, 0.36] | -0.29 | 0.773 + 1 12.0983850 - 0 28.5695006 | -0.09 | 0.23 | [-0.55, 0.37] | -0.38 | 0.706 + 1 16.2161639 - 0 28.5695006 | -0.11 | 0.28 | [-0.66, 0.43] | -0.41 | 0.684 + 1 20.3339428 - 0 28.5695006 | -0.14 | 0.34 | [-0.80, 0.53] | -0.41 | 0.682 + 1 24.4517217 - 0 28.5695006 | -0.16 | 0.40 | [-0.96, 0.63] | -0.41 | 0.685 + 1 28.5695006 - 0 28.5695006 | -0.19 | 0.47 | [-1.11, 0.73] | -0.40 | 0.688 + 1 32.6872795 - 0 28.5695006 | -0.21 | 0.53 | [-1.25, 0.83] | -0.40 | 0.689 + 1 -4.3727306 - 0 32.6872795 | -2.96e-03 | 0.36 | [-0.71, 0.70] | -8.25e-03 | 0.993 + 1 -0.2549517 - 0 32.6872795 | -0.03 | 0.30 | [-0.62, 0.56] | -0.10 | 0.924 + 1 3.8628272 - 0 32.6872795 | -0.05 | 0.26 | [-0.56, 0.45] | -0.21 | 0.833 + 1 7.9806061 - 0 32.6872795 | -0.08 | 0.24 | [-0.56, 0.39] | -0.33 | 0.740 + 1 12.0983850 - 0 32.6872795 | -0.11 | 0.26 | [-0.61, 0.40] | -0.41 | 0.681 + 1 16.2161639 - 0 32.6872795 | -0.13 | 0.30 | [-0.72, 0.46] | -0.44 | 0.660 + 1 20.3339428 - 0 32.6872795 | -0.16 | 0.36 | [-0.86, 0.54] | -0.44 | 0.659 + 1 24.4517217 - 0 32.6872795 | -0.18 | 0.42 | [-1.00, 0.64] | -0.43 | 0.664 + 1 28.5695006 - 0 32.6872795 | -0.21 | 0.48 | [-1.15, 0.74] | -0.43 | 0.668 + 1 32.6872795 - 0 32.6872795 | -0.23 | 0.54 | [-1.29, 0.83] | -0.43 | 0.671 + 1 -0.2549517 - 1 -4.3727306 | -0.03 | 0.09 | [-0.20, 0.14] | -0.29 | 0.768 + 1 3.8628272 - 1 -4.3727306 | -0.05 | 0.18 | [-0.40, 0.29] | -0.29 | 0.770 + 1 7.9806061 - 1 -4.3727306 | -0.08 | 0.27 | [-0.60, 0.45] | -0.29 | 0.772 + 1 12.0983850 - 1 -4.3727306 | -0.10 | 0.36 | [-0.80, 0.60] | -0.29 | 0.772 + 1 16.2161639 - 1 -4.3727306 | -0.13 | 0.45 | [-1.00, 0.74] | -0.29 | 0.772 + 1 20.3339428 - 1 -4.3727306 | -0.15 | 0.53 | [-1.19, 0.88] | -0.29 | 0.771 + 1 24.4517217 - 1 -4.3727306 | -0.18 | 0.61 | [-1.38, 1.02] | -0.29 | 0.769 + 1 28.5695006 - 1 -4.3727306 | -0.20 | 0.68 | [-1.55, 1.14] | -0.30 | 0.766 + 1 32.6872795 - 1 -4.3727306 | -0.23 | 0.75 | [-1.70, 1.25] | -0.30 | 0.763 + 1 3.8628272 - 1 -0.2549517 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.772 + 1 7.9806061 - 1 -0.2549517 | -0.05 | 0.18 | [-0.40, 0.30] | -0.29 | 0.773 + 1 12.0983850 - 1 -0.2549517 | -0.08 | 0.27 | [-0.61, 0.45] | -0.29 | 0.773 + 1 16.2161639 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.60] | -0.29 | 0.773 + 1 20.3339428 - 1 -0.2549517 | -0.13 | 0.44 | [-1.00, 0.74] | -0.29 | 0.771 + 1 24.4517217 - 1 -0.2549517 | -0.15 | 0.52 | [-1.18, 0.87] | -0.29 | 0.769 + 1 28.5695006 - 1 -0.2549517 | -0.18 | 0.60 | [-1.35, 0.99] | -0.30 | 0.766 + 1 32.6872795 - 1 -0.2549517 | -0.20 | 0.67 | [-1.51, 1.10] | -0.30 | 0.762 + 1 7.9806061 - 1 3.8628272 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.774 + 1 12.0983850 - 1 3.8628272 | -0.05 | 0.18 | [-0.41, 0.30] | -0.29 | 0.774 + 1 16.2161639 - 1 3.8628272 | -0.08 | 0.27 | [-0.60, 0.45] | -0.29 | 0.773 + 1 20.3339428 - 1 3.8628272 | -0.10 | 0.35 | [-0.80, 0.59] | -0.29 | 0.771 + 1 24.4517217 - 1 3.8628272 | -0.13 | 0.43 | [-0.98, 0.72] | -0.29 | 0.768 + 1 28.5695006 - 1 3.8628272 | -0.15 | 0.51 | [-1.15, 0.84] | -0.30 | 0.765 + 1 32.6872795 - 1 3.8628272 | -0.18 | 0.58 | [-1.31, 0.95] | -0.30 | 0.761 + 1 12.0983850 - 1 7.9806061 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.774 + 1 16.2161639 - 1 7.9806061 | -0.05 | 0.18 | [-0.40, 0.30] | -0.29 | 0.772 + 1 20.3339428 - 1 7.9806061 | -0.08 | 0.26 | [-0.59, 0.44] | -0.29 | 0.770 + 1 24.4517217 - 1 7.9806061 | -0.10 | 0.34 | [-0.77, 0.57] | -0.30 | 0.767 + 1 28.5695006 - 1 7.9806061 | -0.13 | 0.42 | [-0.95, 0.69] | -0.30 | 0.763 + 1 32.6872795 - 1 7.9806061 | -0.15 | 0.49 | [-1.10, 0.80] | -0.31 | 0.758 + 1 16.2161639 - 1 12.0983850 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.771 + 1 20.3339428 - 1 12.0983850 | -0.05 | 0.17 | [-0.39, 0.29] | -0.30 | 0.768 + 1 24.4517217 - 1 12.0983850 | -0.08 | 0.25 | [-0.57, 0.42] | -0.30 | 0.764 + 1 28.5695006 - 1 12.0983850 | -0.10 | 0.33 | [-0.74, 0.54] | -0.31 | 0.760 + 1 32.6872795 - 1 12.0983850 | -0.12 | 0.40 | [-0.90, 0.65] | -0.31 | 0.755 + 1 20.3339428 - 1 16.2161639 | -0.03 | 0.08 | [-0.19, 0.14] | -0.30 | 0.765 + 1 24.4517217 - 1 16.2161639 | -0.05 | 0.17 | [-0.37, 0.27] | -0.30 | 0.761 + 1 28.5695006 - 1 16.2161639 | -0.07 | 0.24 | [-0.55, 0.40] | -0.31 | 0.756 + 1 32.6872795 - 1 16.2161639 | -0.10 | 0.31 | [-0.70, 0.51] | -0.32 | 0.750 + 1 24.4517217 - 1 20.3339428 | -0.02 | 0.08 | [-0.18, 0.13] | -0.31 | 0.757 + 1 28.5695006 - 1 20.3339428 | -0.05 | 0.16 | [-0.35, 0.25] | -0.32 | 0.751 + 1 32.6872795 - 1 20.3339428 | -0.07 | 0.22 | [-0.51, 0.37] | -0.33 | 0.745 + 1 28.5695006 - 1 24.4517217 | -0.02 | 0.07 | [-0.17, 0.12] | -0.32 | 0.745 + 1 32.6872795 - 1 24.4517217 | -0.05 | 0.14 | [-0.33, 0.23] | -0.33 | 0.738 + 1 32.6872795 - 1 28.5695006 | -0.02 | 0.07 | [-0.16, 0.11] | -0.35 | 0.730 + + Variable predicted: outcome + Predictors contrasted: var_binom, var_cont + Predictors averaged: groups + Contrasts are on the response-scale. + +# print hypothesis_test comma and dash levels + + Code + print(ht) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE + ------------------------------------------------------------------- + and, another, comma, b | and, another, comma, a | -0.02 | 0.07 + no comma, a | and, another, comma, a | 0.15 | 0.09 + no comma, b | and, another, comma, a | 0.13 | 0.12 + with, comma, a | and, another, comma, a | 0.07 | 0.08 + with, comma, b | and, another, comma, a | 0.06 | 0.11 + no comma, a | and, another, comma, b | 0.17 | 0.12 + no comma, b | and, another, comma, b | 0.15 | 0.09 + with, comma, a | and, another, comma, b | 0.09 | 0.11 + with, comma, b | and, another, comma, b | 0.07 | 0.08 + no comma, b | no comma, a | -0.02 | 0.07 + with, comma, a | no comma, a | -0.08 | 0.09 + with, comma, b | no comma, a | -0.10 | 0.11 + with, comma, a | no comma, b | -0.06 | 0.12 + with, comma, b | no comma, b | -0.08 | 0.09 + with, comma, b | with, comma, a | -0.02 | 0.07 + + Level1 | 95% CI | t(143) | p + ------------------------------------------------------- + and, another, comma, b | [-0.16, 0.12] | -0.26 | 0.796 + no comma, a | [-0.03, 0.33] | 1.66 | 0.099 + no comma, b | [-0.10, 0.36] | 1.14 | 0.255 + with, comma, a | [-0.09, 0.24] | 0.88 | 0.380 + with, comma, b | [-0.16, 0.27] | 0.51 | 0.610 + no comma, a | [-0.06, 0.40] | 1.46 | 0.147 + no comma, b | [-0.03, 0.33] | 1.66 | 0.099 + with, comma, a | [-0.13, 0.32] | 0.82 | 0.412 + with, comma, b | [-0.09, 0.24] | 0.88 | 0.380 + no comma, b | [-0.16, 0.12] | -0.26 | 0.796 + with, comma, a | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, b | [-0.32, 0.13] | -0.83 | 0.407 + with, comma, a | [-0.29, 0.18] | -0.49 | 0.625 + with, comma, b | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, b | [-0.16, 0.12] | -0.26 | 0.796 + + Variable predicted: Sepal.Length + Predictors contrasted: f1, f2 + Predictors averaged: Sepal.Width (3.1), Species + +--- + + Code + print(ht, table_width = Inf) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | t(143) | p + -------------------------------------------------------------------------------------------------------------------- + and, another, comma, nothere | and, another, comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 + no comma, comma, here | and, another, comma, comma, here | 0.15 | 0.09 | [-0.03, 0.33] | 1.66 | 0.099 + no comma, nothere | and, another, comma, comma, here | 0.13 | 0.12 | [-0.10, 0.36] | 1.14 | 0.255 + with, comma, comma, here | and, another, comma, comma, here | 0.07 | 0.08 | [-0.09, 0.24] | 0.88 | 0.380 + with, comma, nothere | and, another, comma, comma, here | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 + no comma, comma, here | and, another, comma, nothere | 0.17 | 0.12 | [-0.06, 0.40] | 1.46 | 0.147 + no comma, nothere | and, another, comma, nothere | 0.15 | 0.09 | [-0.03, 0.33] | 1.66 | 0.099 + with, comma, comma, here | and, another, comma, nothere | 0.09 | 0.11 | [-0.13, 0.32] | 0.82 | 0.412 + with, comma, nothere | and, another, comma, nothere | 0.07 | 0.08 | [-0.09, 0.24] | 0.88 | 0.380 + no comma, nothere | no comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 + with, comma, comma, here | no comma, comma, here | -0.08 | 0.09 | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, nothere | no comma, comma, here | -0.10 | 0.11 | [-0.32, 0.13] | -0.83 | 0.407 + with, comma, comma, here | no comma, nothere | -0.06 | 0.12 | [-0.29, 0.18] | -0.49 | 0.625 + with, comma, nothere | no comma, nothere | -0.08 | 0.09 | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, nothere | with, comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 + + Variable predicted: Sepal.Length + Predictors contrasted: f1, f2 + Predictors averaged: Sepal.Width (3.1), Species + +# print hypothesis_test collapse levels + + Code + print(out) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | t(807) | p + ---------------------------------------------------------------------------- + 1, female | 1, male | 0.95 | 4.30 | [ -7.50, 9.39] | 0.22 | 0.825 + 2, male | 1, male | 3.89 | 4.41 | [ -4.77, 12.55] | 0.88 | 0.378 + 2, female | 1, male | 3.56 | 3.95 | [ -4.20, 11.32] | 0.90 | 0.368 + 3, male | 1, male | -0.86 | 5.16 | [-10.99, 9.28] | -0.17 | 0.868 + 3, female | 1, male | 3.12 | 4.45 | [ -5.62, 11.85] | 0.70 | 0.484 + 2, male | 1, female | 2.94 | 3.14 | [ -3.21, 9.10] | 0.94 | 0.348 + 2, female | 1, female | 2.61 | 2.42 | [ -2.15, 7.37] | 1.08 | 0.282 + 3, male | 1, female | -1.81 | 4.12 | [ -9.89, 6.28] | -0.44 | 0.661 + 3, female | 1, female | 2.17 | 3.17 | [ -4.05, 8.39] | 0.68 | 0.494 + 2, female | 2, male | -0.33 | 2.63 | [ -5.49, 4.83] | -0.13 | 0.899 + 3, male | 2, male | -4.75 | 4.23 | [-13.06, 3.56] | -1.12 | 0.262 + 3, female | 2, male | -0.78 | 3.32 | [ -7.29, 5.74] | -0.23 | 0.815 + 3, male | 2, female | -4.42 | 3.75 | [-11.78, 2.95] | -1.18 | 0.239 + 3, female | 2, female | -0.44 | 2.67 | [ -5.69, 4.80] | -0.17 | 0.869 + 3, female | 3, male | 3.97 | 4.26 | [ -4.40, 12.34] | 0.93 | 0.352 + + Variable predicted: barthtot + Predictors contrasted: c172code, c161sex + Predictors averaged: c12hour (42), neg_c_7 (12) + +# hypothesis_test, ci-level + + Code + print(out) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | t(147) | p + ---------------------------------------------------------------------------- + versicolor | setosa | 0.93 | 0.10 | [0.73, 1.13] | 9.03 | < .001 + virginica | setosa | 1.58 | 0.10 | [1.38, 1.79] | 15.37 | < .001 + virginica | versicolor | 0.65 | 0.10 | [0.45, 0.86] | 6.33 | < .001 + + Variable predicted: Sepal.Length + Predictors contrasted: Species + +--- + + Code + print(out) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 80% CI | t(147) | p + ---------------------------------------------------------------------------- + versicolor | setosa | 0.93 | 0.10 | [0.80, 1.06] | 9.03 | < .001 + virginica | setosa | 1.58 | 0.10 | [1.45, 1.71] | 15.37 | < .001 + virginica | versicolor | 0.65 | 0.10 | [0.52, 0.78] | 6.33 | < .001 + + Variable predicted: Sepal.Length + Predictors contrasted: Species + +# print hypothesis_test collapse CI + + Code + print(out) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | t(876) | p + ------------------------------------------------------------------------ + 2 | 1 | -8.67 | 2.52 | [-13.61, -3.72] | -3.44 | < .001 + 3 | 1 | -21.19 | 2.45 | [-25.99, -16.38] | -8.66 | < .001 + 4 | 1 | -61.19 | 2.47 | [-66.05, -56.34] | -24.75 | < .001 + 3 | 2 | -12.52 | 1.59 | [-15.64, -9.40] | -7.87 | < .001 + 4 | 2 | -52.53 | 1.63 | [-55.73, -49.32] | -32.16 | < .001 + 4 | 3 | -40.01 | 1.48 | [-42.92, -37.10] | -26.98 | < .001 + + Variable predicted: barthtot + Predictors contrasted: e42dep + Predictors averaged: c160age (53) + +--- + + Code + print(out, collapse_ci = TRUE) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | t(876) | p + ------------------------------------------------------------------------ + 2 | 1 | -8.67 | 2.52 | [-13.61, -3.72] | -3.44 | < .001 + 3 | 1 | -21.19 | 2.45 | [-25.99, -16.38] | -8.66 | < .001 + 4 | 1 | -61.19 | 2.47 | [-66.05, -56.34] | -24.75 | < .001 + 3 | 2 | -12.52 | 1.59 | [-15.64, -9.40] | -7.87 | < .001 + 4 | 2 | -52.53 | 1.63 | [-55.73, -49.32] | -32.16 | < .001 + 4 | 3 | -40.01 | 1.48 | [-42.92, -37.10] | -26.98 | < .001 + + Variable predicted: barthtot + Predictors contrasted: e42dep + Predictors averaged: c160age (53) + From 5c43ce045e8adc1d9abd5999c0e90f7640b170c3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 12:38:53 +0100 Subject: [PATCH 16/51] update snaps --- .../testthat/_snaps/print_test_predictions.md | 1029 ++++++++++++----- .../_snaps/print_test_predictions.new.md | 840 -------------- 2 files changed, 741 insertions(+), 1128 deletions(-) delete mode 100644 tests/testthat/_snaps/print_test_predictions.new.md diff --git a/tests/testthat/_snaps/print_test_predictions.md b/tests/testthat/_snaps/print_test_predictions.md index 1627db50..7787b644 100644 --- a/tests/testthat/_snaps/print_test_predictions.md +++ b/tests/testthat/_snaps/print_test_predictions.md @@ -3,385 +3,838 @@ Code print(out) Output - # Pairwise comparisons + Model-based Contrasts Analysis - var_binom | Contrast | 95% CI | p - ------------------------------------------ - 0-1 | -0.07 | -1.19, 1.05 | 0.901 - Message + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------ + 1 | 0 | 0.07 | 0.57 | [-1.05, 1.19] | 0.12 | 0.901 - Contrasts are presented as log-odds. + Variable predicted: outcome + Predictors contrasted: var_binom + Predictors averaged: var_cont (9.2), groups + Contrasts are on the link-scale. # print hypothesis_test simple predictions link scale Code print(out) Output - var_binom | Predicted | 95% CI | p - -------------------------------------------- - 0 | -1.14 | -2.06, -0.22 | 0.015 - 1 | -1.07 | -2.24, 0.11 | 0.076 - Message + Model-based Contrasts Analysis - Predictions are presented as log-odds. - -# print hypothesis_test simple contrast exp scale - - Code - print(out) - Output - # Pairwise comparisons - - var_binom | Contrast | 95% CI | p - ----------------------------------------- - 0-1 | 0.99 | 0.80, 1.22 | 0.902 - Message + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------ + 1 | 0 | 0.07 | 0.57 | [-1.05, 1.19] | 0.12 | 0.901 - Contrasts are presented on the exponentiated scale. - -# print hypothesis_test simple contrast odds ratio scale - - Code - print(out) - Output - # Pairwise comparisons - - var_binom | Contrast | 95% CI | p - ----------------------------------------- - 0-1 | 0.93 | 0.30, 2.86 | 0.901 - Message - - Contrasts are presented as odds ratios. + Variable predicted: outcome + Predictors contrasted: var_binom + Predictors averaged: var_cont (9.2), groups + Contrasts are on the link-scale. # print hypothesis_test simple contrast response scale Code print(out) Output - # Pairwise comparisons - - var_binom | Contrast | 95% CI | p - ------------------------------------------ - 0-1 | -0.01 | -0.22, 0.20 | 0.902 - Message - - Contrasts are presented as probabilities (in %-points). - -# print hypothesis_test simple predictions exp scale - - Code - print(out) - Output - var_binom | Predicted | 95% CI | p - ------------------------------------------ - 0 | 1.27 | 1.08, 1.51 | 0.005 - 1 | 1.29 | 1.03, 1.62 | 0.025 - Message + Model-based Contrasts Analysis - Predictions are presented on the exponentiated scale. - -# print hypothesis_test simple predictions odds ratio scale - - Code - print(out) - Output - var_binom | Predicted | 95% CI | p - ------------------------------------------ - 0 | 0.32 | 0.13, 0.80 | 0.015 - 1 | 0.34 | 0.11, 1.12 | 0.076 - Message + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------ + 1 | 0 | 0.02 | 0.14 | [-0.26, 0.30] | 0.12 | 0.901 - Predictions are presented as odds ratios. + Variable predicted: outcome + Predictors contrasted: var_binom + Predictors averaged: var_cont (9.2), groups + Contrasts are on the response-scale. # print hypothesis_test contrasts link scale Code print(out) Output - # Pairwise comparisons + Model-based Contrasts Analysis - var_binom | var_cont | Contrast | 95% CI | p - -------------------------------------------------------- - 0-1 | 2.48-2.48 | -0.37 | -1.91, 1.18 | 0.644 - 0-0 | 2.48-9.25 | -0.12 | -0.60, 0.35 | 0.610 - 0-1 | 2.48-9.25 | -0.19 | -1.43, 1.04 | 0.758 - 0-0 | 2.48-16.02 | -0.25 | -1.19, 0.70 | 0.610 - 0-1 | 2.48-16.02 | -0.02 | -1.86, 1.82 | 0.980 - 1-0 | 2.48-9.25 | 0.24 | -1.21, 1.70 | 0.745 - 1-1 | 2.48-9.25 | 0.17 | -1.00, 1.34 | 0.774 - 1-0 | 2.48-16.02 | 0.12 | -1.39, 1.63 | 0.878 - 1-1 | 2.48-16.02 | 0.34 | -1.99, 2.68 | 0.774 - 0-1 | 9.25-9.25 | -0.07 | -1.19, 1.05 | 0.901 - 0-0 | 9.25-16.02 | -0.12 | -0.60, 0.35 | 0.610 - 0-1 | 9.25-16.02 | 0.10 | -1.67, 1.87 | 0.912 - 1-0 | 9.25-16.02 | -0.05 | -1.25, 1.14 | 0.932 - 1-1 | 9.25-16.02 | 0.17 | -1.00, 1.34 | 0.774 - 0-1 | 16.02-16.02 | 0.22 | -1.59, 2.04 | 0.810 - Message + Parameter | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------------- + 0 -0.2549517 - 0 -4.3727306 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 3.8628272 - 0 -4.3727306 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 7.9806061 - 0 -4.3727306 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 12.0983850 - 0 -4.3727306 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 16.2161639 - 0 -4.3727306 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 20.3339428 - 0 -4.3727306 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 24.4517217 - 0 -4.3727306 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 0 28.5695006 - 0 -4.3727306 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 + 0 32.6872795 - 0 -4.3727306 | 0.67 | 1.32 | [-1.91, 3.26] | 0.51 | 0.610 + 1 -4.3727306 - 0 -4.3727306 | 0.66 | 1.33 | [-1.94, 3.27] | 0.50 | 0.618 + 1 -0.2549517 - 0 -4.3727306 | 0.56 | 1.05 | [-1.51, 2.62] | 0.53 | 0.596 + 1 3.8628272 - 0 -4.3727306 | 0.45 | 0.84 | [-1.20, 2.11] | 0.54 | 0.590 + 1 7.9806061 - 0 -4.3727306 | 0.35 | 0.76 | [-1.14, 1.84] | 0.46 | 0.644 + 1 12.0983850 - 0 -4.3727306 | 0.25 | 0.84 | [-1.40, 1.89] | 0.29 | 0.768 + 1 16.2161639 - 0 -4.3727306 | 0.14 | 1.05 | [-1.91, 2.19] | 0.14 | 0.891 + 1 20.3339428 - 0 -4.3727306 | 0.04 | 1.32 | [-2.55, 2.63] | 0.03 | 0.976 + 1 24.4517217 - 0 -4.3727306 | -0.06 | 1.63 | [-3.26, 3.13] | -0.04 | 0.968 + 1 28.5695006 - 0 -4.3727306 | -0.17 | 1.96 | [-4.01, 3.67] | -0.09 | 0.931 + 1 32.6872795 - 0 -4.3727306 | -0.27 | 2.30 | [-4.77, 4.23] | -0.12 | 0.906 + 0 3.8628272 - 0 -0.2549517 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 7.9806061 - 0 -0.2549517 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 12.0983850 - 0 -0.2549517 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 16.2161639 - 0 -0.2549517 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 20.3339428 - 0 -0.2549517 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 24.4517217 - 0 -0.2549517 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 28.5695006 - 0 -0.2549517 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 0 32.6872795 - 0 -0.2549517 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 + 1 -4.3727306 - 0 -0.2549517 | 0.59 | 1.28 | [-1.92, 3.10] | 0.46 | 0.646 + 1 -0.2549517 - 0 -0.2549517 | 0.48 | 0.99 | [-1.46, 2.42] | 0.49 | 0.625 + 1 3.8628272 - 0 -0.2549517 | 0.38 | 0.76 | [-1.12, 1.88] | 0.50 | 0.619 + 1 7.9806061 - 0 -0.2549517 | 0.28 | 0.67 | [-1.04, 1.59] | 0.41 | 0.680 + 1 12.0983850 - 0 -0.2549517 | 0.17 | 0.76 | [-1.31, 1.66] | 0.23 | 0.820 + 1 16.2161639 - 0 -0.2549517 | 0.07 | 0.98 | [-1.86, 1.99] | 0.07 | 0.945 + 1 20.3339428 - 0 -0.2549517 | -0.04 | 1.27 | [-2.53, 2.46] | -0.03 | 0.978 + 1 24.4517217 - 0 -0.2549517 | -0.14 | 1.59 | [-3.26, 2.98] | -0.09 | 0.930 + 1 28.5695006 - 0 -0.2549517 | -0.24 | 1.93 | [-4.02, 3.53] | -0.13 | 0.899 + 1 32.6872795 - 0 -0.2549517 | -0.35 | 2.27 | [-4.79, 4.10] | -0.15 | 0.878 + 0 7.9806061 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 12.0983850 - 0 3.8628272 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 16.2161639 - 0 3.8628272 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 20.3339428 - 0 3.8628272 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 24.4517217 - 0 3.8628272 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 28.5695006 - 0 3.8628272 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 32.6872795 - 0 3.8628272 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 1 -4.3727306 - 0 3.8628272 | 0.51 | 1.25 | [-1.93, 2.95] | 0.41 | 0.680 + 1 -0.2549517 - 0 3.8628272 | 0.41 | 0.94 | [-1.44, 2.26] | 0.43 | 0.665 + 1 3.8628272 - 0 3.8628272 | 0.30 | 0.70 | [-1.07, 1.68] | 0.43 | 0.665 + 1 7.9806061 - 0 3.8628272 | 0.20 | 0.60 | [-0.98, 1.38] | 0.33 | 0.738 + 1 12.0983850 - 0 3.8628272 | 0.10 | 0.70 | [-1.28, 1.47] | 0.14 | 0.890 + 1 16.2161639 - 0 3.8628272 | -6.65e-03 | 0.94 | [-1.85, 1.83] | -7.09e-03 | 0.994 + 1 20.3339428 - 0 3.8628272 | -0.11 | 1.24 | [-2.54, 2.32] | -0.09 | 0.929 + 1 24.4517217 - 0 3.8628272 | -0.21 | 1.56 | [-3.28, 2.85] | -0.14 | 0.891 + 1 28.5695006 - 0 3.8628272 | -0.32 | 1.90 | [-4.05, 3.41] | -0.17 | 0.867 + 1 32.6872795 - 0 3.8628272 | -0.42 | 2.25 | [-4.83, 3.99] | -0.19 | 0.851 + 0 12.0983850 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 16.2161639 - 0 7.9806061 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 20.3339428 - 0 7.9806061 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 24.4517217 - 0 7.9806061 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 28.5695006 - 0 7.9806061 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 32.6872795 - 0 7.9806061 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 1 -4.3727306 - 0 7.9806061 | 0.44 | 1.23 | [-1.97, 2.84] | 0.36 | 0.721 + 1 -0.2549517 - 0 7.9806061 | 0.33 | 0.92 | [-1.47, 2.14] | 0.36 | 0.717 + 1 3.8628272 - 0 7.9806061 | 0.23 | 0.67 | [-1.09, 1.55] | 0.34 | 0.732 + 1 7.9806061 - 0 7.9806061 | 0.13 | 0.56 | [-0.98, 1.23] | 0.22 | 0.823 + 1 12.0983850 - 0 7.9806061 | 0.02 | 0.67 | [-1.29, 1.33] | 0.03 | 0.973 + 1 16.2161639 - 0 7.9806061 | -0.08 | 0.92 | [-1.88, 1.71] | -0.09 | 0.929 + 1 20.3339428 - 0 7.9806061 | -0.19 | 1.22 | [-2.58, 2.21] | -0.15 | 0.879 + 1 24.4517217 - 0 7.9806061 | -0.29 | 1.55 | [-3.33, 2.75] | -0.19 | 0.852 + 1 28.5695006 - 0 7.9806061 | -0.39 | 1.89 | [-4.11, 3.32] | -0.21 | 0.836 + 1 32.6872795 - 0 7.9806061 | -0.50 | 2.24 | [-4.89, 3.90] | -0.22 | 0.825 + 0 16.2161639 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 20.3339428 - 0 12.0983850 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 24.4517217 - 0 12.0983850 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 28.5695006 - 0 12.0983850 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 32.6872795 - 0 12.0983850 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 1 -4.3727306 - 0 12.0983850 | 0.36 | 1.23 | [-2.04, 2.77] | 0.30 | 0.767 + 1 -0.2549517 - 0 12.0983850 | 0.26 | 0.92 | [-1.54, 2.06] | 0.28 | 0.778 + 1 3.8628272 - 0 12.0983850 | 0.16 | 0.67 | [-1.16, 1.47] | 0.23 | 0.818 + 1 7.9806061 - 0 12.0983850 | 0.05 | 0.57 | [-1.06, 1.16] | 0.09 | 0.928 + 1 12.0983850 - 0 12.0983850 | -0.05 | 0.67 | [-1.37, 1.26] | -0.08 | 0.937 + 1 16.2161639 - 0 12.0983850 | -0.16 | 0.92 | [-1.96, 1.64] | -0.17 | 0.864 + 1 20.3339428 - 0 12.0983850 | -0.26 | 1.22 | [-2.66, 2.14] | -0.21 | 0.831 + 1 24.4517217 - 0 12.0983850 | -0.36 | 1.55 | [-3.41, 2.68] | -0.23 | 0.815 + 1 28.5695006 - 0 12.0983850 | -0.47 | 1.90 | [-4.18, 3.25] | -0.25 | 0.805 + 1 32.6872795 - 0 12.0983850 | -0.57 | 2.24 | [-4.97, 3.83] | -0.25 | 0.799 + 0 20.3339428 - 0 16.2161639 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 24.4517217 - 0 16.2161639 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 28.5695006 - 0 16.2161639 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 32.6872795 - 0 16.2161639 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 1 -4.3727306 - 0 16.2161639 | 0.29 | 1.24 | [-2.15, 2.72] | 0.23 | 0.817 + 1 -0.2549517 - 0 16.2161639 | 0.18 | 0.94 | [-1.66, 2.03] | 0.20 | 0.845 + 1 3.8628272 - 0 16.2161639 | 0.08 | 0.70 | [-1.30, 1.46] | 0.11 | 0.909 + 1 7.9806061 - 0 16.2161639 | -0.02 | 0.60 | [-1.20, 1.16] | -0.04 | 0.968 + 1 12.0983850 - 0 16.2161639 | -0.13 | 0.70 | [-1.51, 1.25] | -0.18 | 0.856 + 1 16.2161639 - 0 16.2161639 | -0.23 | 0.94 | [-2.08, 1.61] | -0.25 | 0.806 + 1 20.3339428 - 0 16.2161639 | -0.34 | 1.24 | [-2.77, 2.10] | -0.27 | 0.787 + 1 24.4517217 - 0 16.2161639 | -0.44 | 1.57 | [-3.51, 2.63] | -0.28 | 0.779 + 1 28.5695006 - 0 16.2161639 | -0.54 | 1.91 | [-4.28, 3.20] | -0.28 | 0.776 + 1 32.6872795 - 0 16.2161639 | -0.65 | 2.25 | [-5.07, 3.77] | -0.29 | 0.774 + 0 24.4517217 - 0 20.3339428 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 28.5695006 - 0 20.3339428 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 32.6872795 - 0 20.3339428 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 1 -4.3727306 - 0 20.3339428 | 0.21 | 1.28 | [-2.29, 2.71] | 0.17 | 0.868 + 1 -0.2549517 - 0 20.3339428 | 0.11 | 0.99 | [-1.82, 2.04] | 0.11 | 0.912 + 1 3.8628272 - 0 20.3339428 | 5.09e-03 | 0.76 | [-1.49, 1.50] | 6.68e-03 | 0.995 + 1 7.9806061 - 0 20.3339428 | -0.10 | 0.67 | [-1.41, 1.22] | -0.15 | 0.883 + 1 12.0983850 - 0 20.3339428 | -0.20 | 0.76 | [-1.70, 1.29] | -0.27 | 0.790 + 1 16.2161639 - 0 20.3339428 | -0.31 | 0.99 | [-2.24, 1.63] | -0.31 | 0.756 + 1 20.3339428 - 0 20.3339428 | -0.41 | 1.28 | [-2.91, 2.09] | -0.32 | 0.748 + 1 24.4517217 - 0 20.3339428 | -0.51 | 1.60 | [-3.64, 2.62] | -0.32 | 0.747 + 1 28.5695006 - 0 20.3339428 | -0.62 | 1.93 | [-4.40, 3.17] | -0.32 | 0.749 + 1 32.6872795 - 0 20.3339428 | -0.72 | 2.27 | [-5.18, 3.74] | -0.32 | 0.751 + 0 28.5695006 - 0 24.4517217 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 32.6872795 - 0 24.4517217 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 1 -4.3727306 - 0 24.4517217 | 0.14 | 1.32 | [-2.46, 2.73] | 0.10 | 0.917 + 1 -0.2549517 - 0 24.4517217 | 0.03 | 1.05 | [-2.02, 2.09] | 0.03 | 0.974 + 1 3.8628272 - 0 24.4517217 | -0.07 | 0.84 | [-1.72, 1.58] | -0.08 | 0.934 + 1 7.9806061 - 0 24.4517217 | -0.17 | 0.76 | [-1.67, 1.32] | -0.23 | 0.819 + 1 12.0983850 - 0 24.4517217 | -0.28 | 0.84 | [-1.93, 1.38] | -0.33 | 0.742 + 1 16.2161639 - 0 24.4517217 | -0.38 | 1.05 | [-2.44, 1.68] | -0.36 | 0.717 + 1 20.3339428 - 0 24.4517217 | -0.49 | 1.33 | [-3.09, 2.12] | -0.37 | 0.715 + 1 24.4517217 - 0 24.4517217 | -0.59 | 1.64 | [-3.80, 2.62] | -0.36 | 0.719 + 1 28.5695006 - 0 24.4517217 | -0.69 | 1.97 | [-4.55, 3.16] | -0.35 | 0.724 + 1 32.6872795 - 0 24.4517217 | -0.80 | 2.30 | [-5.31, 3.72] | -0.35 | 0.729 + 0 32.6872795 - 0 28.5695006 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 1 -4.3727306 - 0 28.5695006 | 0.06 | 1.39 | [-2.66, 2.78] | 0.05 | 0.964 + 1 -0.2549517 - 0 28.5695006 | -0.04 | 1.13 | [-2.25, 2.17] | -0.04 | 0.971 + 1 3.8628272 - 0 28.5695006 | -0.14 | 0.94 | [-1.98, 1.69] | -0.15 | 0.877 + 1 7.9806061 - 0 28.5695006 | -0.25 | 0.87 | [-1.95, 1.45] | -0.29 | 0.774 + 1 12.0983850 - 0 28.5695006 | -0.35 | 0.94 | [-2.20, 1.49] | -0.37 | 0.708 + 1 16.2161639 - 0 28.5695006 | -0.46 | 1.13 | [-2.67, 1.76] | -0.40 | 0.687 + 1 20.3339428 - 0 28.5695006 | -0.56 | 1.39 | [-3.29, 2.17] | -0.40 | 0.687 + 1 24.4517217 - 0 28.5695006 | -0.66 | 1.69 | [-3.98, 2.65] | -0.39 | 0.694 + 1 28.5695006 - 0 28.5695006 | -0.77 | 2.01 | [-4.71, 3.17] | -0.38 | 0.702 + 1 32.6872795 - 0 28.5695006 | -0.87 | 2.34 | [-5.46, 3.72] | -0.37 | 0.710 + 1 -4.3727306 - 0 32.6872795 | -0.01 | 1.46 | [-2.88, 2.85] | -8.26e-03 | 0.993 + 1 -0.2549517 - 0 32.6872795 | -0.12 | 1.22 | [-2.51, 2.27] | -0.10 | 0.924 + 1 3.8628272 - 0 32.6872795 | -0.22 | 1.05 | [-2.27, 1.83] | -0.21 | 0.834 + 1 7.9806061 - 0 32.6872795 | -0.32 | 0.98 | [-2.25, 1.60] | -0.33 | 0.742 + 1 12.0983850 - 0 32.6872795 | -0.43 | 1.05 | [-2.49, 1.63] | -0.41 | 0.684 + 1 16.2161639 - 0 32.6872795 | -0.53 | 1.22 | [-2.93, 1.87] | -0.43 | 0.664 + 1 20.3339428 - 0 32.6872795 | -0.64 | 1.47 | [-3.51, 2.24] | -0.43 | 0.665 + 1 24.4517217 - 0 32.6872795 | -0.74 | 1.75 | [-4.18, 2.70] | -0.42 | 0.674 + 1 28.5695006 - 0 32.6872795 | -0.84 | 2.06 | [-4.89, 3.20] | -0.41 | 0.683 + 1 32.6872795 - 0 32.6872795 | -0.95 | 2.39 | [-5.63, 3.74] | -0.40 | 0.692 + 1 -0.2549517 - 1 -4.3727306 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 3.8628272 - 1 -4.3727306 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 7.9806061 - 1 -4.3727306 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 12.0983850 - 1 -4.3727306 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 16.2161639 - 1 -4.3727306 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 20.3339428 - 1 -4.3727306 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 24.4517217 - 1 -4.3727306 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 28.5695006 - 1 -4.3727306 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 + 1 32.6872795 - 1 -4.3727306 | -0.93 | 3.26 | [-7.32, 5.45] | -0.29 | 0.774 + 1 3.8628272 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 7.9806061 - 1 -0.2549517 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 12.0983850 - 1 -0.2549517 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 16.2161639 - 1 -0.2549517 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 20.3339428 - 1 -0.2549517 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 24.4517217 - 1 -0.2549517 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 28.5695006 - 1 -0.2549517 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 32.6872795 - 1 -0.2549517 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 + 1 7.9806061 - 1 3.8628272 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 12.0983850 - 1 3.8628272 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 16.2161639 - 1 3.8628272 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 20.3339428 - 1 3.8628272 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 24.4517217 - 1 3.8628272 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 28.5695006 - 1 3.8628272 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 32.6872795 - 1 3.8628272 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 12.0983850 - 1 7.9806061 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 16.2161639 - 1 7.9806061 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 20.3339428 - 1 7.9806061 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 24.4517217 - 1 7.9806061 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 28.5695006 - 1 7.9806061 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 32.6872795 - 1 7.9806061 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 16.2161639 - 1 12.0983850 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 20.3339428 - 1 12.0983850 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 24.4517217 - 1 12.0983850 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 28.5695006 - 1 12.0983850 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 32.6872795 - 1 12.0983850 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 20.3339428 - 1 16.2161639 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 24.4517217 - 1 16.2161639 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 28.5695006 - 1 16.2161639 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 32.6872795 - 1 16.2161639 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 24.4517217 - 1 20.3339428 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 28.5695006 - 1 20.3339428 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 32.6872795 - 1 20.3339428 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 28.5695006 - 1 24.4517217 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 32.6872795 - 1 24.4517217 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 32.6872795 - 1 28.5695006 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - Contrasts are presented as log-odds. + Variable predicted: outcome + Predictors contrasted: var_binom, var_cont + Predictors averaged: groups + Contrasts are on the link-scale. # print hypothesis_test predictions link scale Code print(out) Output - var_binom | var_cont | Predicted | 95% CI | p - ------------------------------------------------------- - 0 | 2.48 | -1.26 | -2.33, -0.19 | 0.021 - 1 | 2.48 | -0.90 | -2.39, 0.60 | 0.240 - 0 | 9.25 | -1.14 | -2.06, -0.22 | 0.015 - 1 | 9.25 | -1.07 | -2.25, 0.11 | 0.076 - 0 | 16.02 | -1.02 | -2.01, -0.02 | 0.046 - 1 | 16.02 | -1.24 | -3.04, 0.57 | 0.179 - Message + Model-based Contrasts Analysis - Predictions are presented as log-odds. - -# print hypothesis_test contrasts exp scale - - Code - print(out) - Output - # Pairwise comparisons - - var_binom | var_cont | Contrast | 95% CI | p - ------------------------------------------------------- - 0-1 | 2.48-2.48 | 0.93 | 0.69, 1.27 | 0.658 - 0-0 | 2.48-9.25 | 0.98 | 0.90, 1.06 | 0.596 - 0-1 | 2.48-9.25 | 0.97 | 0.77, 1.21 | 0.760 - 0-0 | 2.48-16.02 | 0.96 | 0.80, 1.14 | 0.608 - 0-1 | 2.48-16.02 | 1.00 | 0.72, 1.37 | 0.980 - 1-0 | 2.48-9.25 | 1.05 | 0.78, 1.41 | 0.754 - 1-1 | 2.48-9.25 | 1.03 | 0.82, 1.31 | 0.780 - 1-0 | 2.48-16.02 | 1.02 | 0.75, 1.39 | 0.880 - 1-1 | 2.48-16.02 | 1.07 | 0.69, 1.65 | 0.771 - 0-1 | 9.25-9.25 | 0.99 | 0.80, 1.22 | 0.902 - 0-0 | 9.25-16.02 | 0.98 | 0.89, 1.07 | 0.619 - 0-1 | 9.25-16.02 | 1.02 | 0.75, 1.39 | 0.910 - 1-0 | 9.25-16.02 | 0.99 | 0.79, 1.25 | 0.932 - 1-1 | 9.25-16.02 | 1.03 | 0.84, 1.26 | 0.761 - 0-1 | 16.02-16.02 | 1.04 | 0.75, 1.44 | 0.803 - Message + Parameter | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------------- + 0 -0.2549517 - 0 -4.3727306 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 3.8628272 - 0 -4.3727306 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 7.9806061 - 0 -4.3727306 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 12.0983850 - 0 -4.3727306 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 16.2161639 - 0 -4.3727306 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 20.3339428 - 0 -4.3727306 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 24.4517217 - 0 -4.3727306 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 0 28.5695006 - 0 -4.3727306 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 + 0 32.6872795 - 0 -4.3727306 | 0.67 | 1.32 | [-1.91, 3.26] | 0.51 | 0.610 + 1 -4.3727306 - 0 -4.3727306 | 0.66 | 1.33 | [-1.94, 3.27] | 0.50 | 0.618 + 1 -0.2549517 - 0 -4.3727306 | 0.56 | 1.05 | [-1.51, 2.62] | 0.53 | 0.596 + 1 3.8628272 - 0 -4.3727306 | 0.45 | 0.84 | [-1.20, 2.11] | 0.54 | 0.590 + 1 7.9806061 - 0 -4.3727306 | 0.35 | 0.76 | [-1.14, 1.84] | 0.46 | 0.644 + 1 12.0983850 - 0 -4.3727306 | 0.25 | 0.84 | [-1.40, 1.89] | 0.29 | 0.768 + 1 16.2161639 - 0 -4.3727306 | 0.14 | 1.05 | [-1.91, 2.19] | 0.14 | 0.891 + 1 20.3339428 - 0 -4.3727306 | 0.04 | 1.32 | [-2.55, 2.63] | 0.03 | 0.976 + 1 24.4517217 - 0 -4.3727306 | -0.06 | 1.63 | [-3.26, 3.13] | -0.04 | 0.968 + 1 28.5695006 - 0 -4.3727306 | -0.17 | 1.96 | [-4.01, 3.67] | -0.09 | 0.931 + 1 32.6872795 - 0 -4.3727306 | -0.27 | 2.30 | [-4.77, 4.23] | -0.12 | 0.906 + 0 3.8628272 - 0 -0.2549517 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 7.9806061 - 0 -0.2549517 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 12.0983850 - 0 -0.2549517 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 16.2161639 - 0 -0.2549517 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 20.3339428 - 0 -0.2549517 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 24.4517217 - 0 -0.2549517 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 28.5695006 - 0 -0.2549517 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 0 32.6872795 - 0 -0.2549517 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 + 1 -4.3727306 - 0 -0.2549517 | 0.59 | 1.28 | [-1.92, 3.10] | 0.46 | 0.646 + 1 -0.2549517 - 0 -0.2549517 | 0.48 | 0.99 | [-1.46, 2.42] | 0.49 | 0.625 + 1 3.8628272 - 0 -0.2549517 | 0.38 | 0.76 | [-1.12, 1.88] | 0.50 | 0.619 + 1 7.9806061 - 0 -0.2549517 | 0.28 | 0.67 | [-1.04, 1.59] | 0.41 | 0.680 + 1 12.0983850 - 0 -0.2549517 | 0.17 | 0.76 | [-1.31, 1.66] | 0.23 | 0.820 + 1 16.2161639 - 0 -0.2549517 | 0.07 | 0.98 | [-1.86, 1.99] | 0.07 | 0.945 + 1 20.3339428 - 0 -0.2549517 | -0.04 | 1.27 | [-2.53, 2.46] | -0.03 | 0.978 + 1 24.4517217 - 0 -0.2549517 | -0.14 | 1.59 | [-3.26, 2.98] | -0.09 | 0.930 + 1 28.5695006 - 0 -0.2549517 | -0.24 | 1.93 | [-4.02, 3.53] | -0.13 | 0.899 + 1 32.6872795 - 0 -0.2549517 | -0.35 | 2.27 | [-4.79, 4.10] | -0.15 | 0.878 + 0 7.9806061 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 12.0983850 - 0 3.8628272 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 16.2161639 - 0 3.8628272 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 20.3339428 - 0 3.8628272 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 24.4517217 - 0 3.8628272 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 28.5695006 - 0 3.8628272 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 0 32.6872795 - 0 3.8628272 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 + 1 -4.3727306 - 0 3.8628272 | 0.51 | 1.25 | [-1.93, 2.95] | 0.41 | 0.680 + 1 -0.2549517 - 0 3.8628272 | 0.41 | 0.94 | [-1.44, 2.26] | 0.43 | 0.665 + 1 3.8628272 - 0 3.8628272 | 0.30 | 0.70 | [-1.07, 1.68] | 0.43 | 0.665 + 1 7.9806061 - 0 3.8628272 | 0.20 | 0.60 | [-0.98, 1.38] | 0.33 | 0.738 + 1 12.0983850 - 0 3.8628272 | 0.10 | 0.70 | [-1.28, 1.47] | 0.14 | 0.890 + 1 16.2161639 - 0 3.8628272 | -6.65e-03 | 0.94 | [-1.85, 1.83] | -7.09e-03 | 0.994 + 1 20.3339428 - 0 3.8628272 | -0.11 | 1.24 | [-2.54, 2.32] | -0.09 | 0.929 + 1 24.4517217 - 0 3.8628272 | -0.21 | 1.56 | [-3.28, 2.85] | -0.14 | 0.891 + 1 28.5695006 - 0 3.8628272 | -0.32 | 1.90 | [-4.05, 3.41] | -0.17 | 0.867 + 1 32.6872795 - 0 3.8628272 | -0.42 | 2.25 | [-4.83, 3.99] | -0.19 | 0.851 + 0 12.0983850 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 16.2161639 - 0 7.9806061 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 20.3339428 - 0 7.9806061 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 24.4517217 - 0 7.9806061 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 28.5695006 - 0 7.9806061 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 0 32.6872795 - 0 7.9806061 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 + 1 -4.3727306 - 0 7.9806061 | 0.44 | 1.23 | [-1.97, 2.84] | 0.36 | 0.721 + 1 -0.2549517 - 0 7.9806061 | 0.33 | 0.92 | [-1.47, 2.14] | 0.36 | 0.717 + 1 3.8628272 - 0 7.9806061 | 0.23 | 0.67 | [-1.09, 1.55] | 0.34 | 0.732 + 1 7.9806061 - 0 7.9806061 | 0.13 | 0.56 | [-0.98, 1.23] | 0.22 | 0.823 + 1 12.0983850 - 0 7.9806061 | 0.02 | 0.67 | [-1.29, 1.33] | 0.03 | 0.973 + 1 16.2161639 - 0 7.9806061 | -0.08 | 0.92 | [-1.88, 1.71] | -0.09 | 0.929 + 1 20.3339428 - 0 7.9806061 | -0.19 | 1.22 | [-2.58, 2.21] | -0.15 | 0.879 + 1 24.4517217 - 0 7.9806061 | -0.29 | 1.55 | [-3.33, 2.75] | -0.19 | 0.852 + 1 28.5695006 - 0 7.9806061 | -0.39 | 1.89 | [-4.11, 3.32] | -0.21 | 0.836 + 1 32.6872795 - 0 7.9806061 | -0.50 | 2.24 | [-4.89, 3.90] | -0.22 | 0.825 + 0 16.2161639 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 20.3339428 - 0 12.0983850 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 24.4517217 - 0 12.0983850 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 28.5695006 - 0 12.0983850 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 0 32.6872795 - 0 12.0983850 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 + 1 -4.3727306 - 0 12.0983850 | 0.36 | 1.23 | [-2.04, 2.77] | 0.30 | 0.767 + 1 -0.2549517 - 0 12.0983850 | 0.26 | 0.92 | [-1.54, 2.06] | 0.28 | 0.778 + 1 3.8628272 - 0 12.0983850 | 0.16 | 0.67 | [-1.16, 1.47] | 0.23 | 0.818 + 1 7.9806061 - 0 12.0983850 | 0.05 | 0.57 | [-1.06, 1.16] | 0.09 | 0.928 + 1 12.0983850 - 0 12.0983850 | -0.05 | 0.67 | [-1.37, 1.26] | -0.08 | 0.937 + 1 16.2161639 - 0 12.0983850 | -0.16 | 0.92 | [-1.96, 1.64] | -0.17 | 0.864 + 1 20.3339428 - 0 12.0983850 | -0.26 | 1.22 | [-2.66, 2.14] | -0.21 | 0.831 + 1 24.4517217 - 0 12.0983850 | -0.36 | 1.55 | [-3.41, 2.68] | -0.23 | 0.815 + 1 28.5695006 - 0 12.0983850 | -0.47 | 1.90 | [-4.18, 3.25] | -0.25 | 0.805 + 1 32.6872795 - 0 12.0983850 | -0.57 | 2.24 | [-4.97, 3.83] | -0.25 | 0.799 + 0 20.3339428 - 0 16.2161639 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 24.4517217 - 0 16.2161639 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 28.5695006 - 0 16.2161639 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 0 32.6872795 - 0 16.2161639 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 + 1 -4.3727306 - 0 16.2161639 | 0.29 | 1.24 | [-2.15, 2.72] | 0.23 | 0.817 + 1 -0.2549517 - 0 16.2161639 | 0.18 | 0.94 | [-1.66, 2.03] | 0.20 | 0.845 + 1 3.8628272 - 0 16.2161639 | 0.08 | 0.70 | [-1.30, 1.46] | 0.11 | 0.909 + 1 7.9806061 - 0 16.2161639 | -0.02 | 0.60 | [-1.20, 1.16] | -0.04 | 0.968 + 1 12.0983850 - 0 16.2161639 | -0.13 | 0.70 | [-1.51, 1.25] | -0.18 | 0.856 + 1 16.2161639 - 0 16.2161639 | -0.23 | 0.94 | [-2.08, 1.61] | -0.25 | 0.806 + 1 20.3339428 - 0 16.2161639 | -0.34 | 1.24 | [-2.77, 2.10] | -0.27 | 0.787 + 1 24.4517217 - 0 16.2161639 | -0.44 | 1.57 | [-3.51, 2.63] | -0.28 | 0.779 + 1 28.5695006 - 0 16.2161639 | -0.54 | 1.91 | [-4.28, 3.20] | -0.28 | 0.776 + 1 32.6872795 - 0 16.2161639 | -0.65 | 2.25 | [-5.07, 3.77] | -0.29 | 0.774 + 0 24.4517217 - 0 20.3339428 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 28.5695006 - 0 20.3339428 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 0 32.6872795 - 0 20.3339428 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 + 1 -4.3727306 - 0 20.3339428 | 0.21 | 1.28 | [-2.29, 2.71] | 0.17 | 0.868 + 1 -0.2549517 - 0 20.3339428 | 0.11 | 0.99 | [-1.82, 2.04] | 0.11 | 0.912 + 1 3.8628272 - 0 20.3339428 | 5.09e-03 | 0.76 | [-1.49, 1.50] | 6.68e-03 | 0.995 + 1 7.9806061 - 0 20.3339428 | -0.10 | 0.67 | [-1.41, 1.22] | -0.15 | 0.883 + 1 12.0983850 - 0 20.3339428 | -0.20 | 0.76 | [-1.70, 1.29] | -0.27 | 0.790 + 1 16.2161639 - 0 20.3339428 | -0.31 | 0.99 | [-2.24, 1.63] | -0.31 | 0.756 + 1 20.3339428 - 0 20.3339428 | -0.41 | 1.28 | [-2.91, 2.09] | -0.32 | 0.748 + 1 24.4517217 - 0 20.3339428 | -0.51 | 1.60 | [-3.64, 2.62] | -0.32 | 0.747 + 1 28.5695006 - 0 20.3339428 | -0.62 | 1.93 | [-4.40, 3.17] | -0.32 | 0.749 + 1 32.6872795 - 0 20.3339428 | -0.72 | 2.27 | [-5.18, 3.74] | -0.32 | 0.751 + 0 28.5695006 - 0 24.4517217 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 32.6872795 - 0 24.4517217 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 + 1 -4.3727306 - 0 24.4517217 | 0.14 | 1.32 | [-2.46, 2.73] | 0.10 | 0.917 + 1 -0.2549517 - 0 24.4517217 | 0.03 | 1.05 | [-2.02, 2.09] | 0.03 | 0.974 + 1 3.8628272 - 0 24.4517217 | -0.07 | 0.84 | [-1.72, 1.58] | -0.08 | 0.934 + 1 7.9806061 - 0 24.4517217 | -0.17 | 0.76 | [-1.67, 1.32] | -0.23 | 0.819 + 1 12.0983850 - 0 24.4517217 | -0.28 | 0.84 | [-1.93, 1.38] | -0.33 | 0.742 + 1 16.2161639 - 0 24.4517217 | -0.38 | 1.05 | [-2.44, 1.68] | -0.36 | 0.717 + 1 20.3339428 - 0 24.4517217 | -0.49 | 1.33 | [-3.09, 2.12] | -0.37 | 0.715 + 1 24.4517217 - 0 24.4517217 | -0.59 | 1.64 | [-3.80, 2.62] | -0.36 | 0.719 + 1 28.5695006 - 0 24.4517217 | -0.69 | 1.97 | [-4.55, 3.16] | -0.35 | 0.724 + 1 32.6872795 - 0 24.4517217 | -0.80 | 2.30 | [-5.31, 3.72] | -0.35 | 0.729 + 0 32.6872795 - 0 28.5695006 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 1 -4.3727306 - 0 28.5695006 | 0.06 | 1.39 | [-2.66, 2.78] | 0.05 | 0.964 + 1 -0.2549517 - 0 28.5695006 | -0.04 | 1.13 | [-2.25, 2.17] | -0.04 | 0.971 + 1 3.8628272 - 0 28.5695006 | -0.14 | 0.94 | [-1.98, 1.69] | -0.15 | 0.877 + 1 7.9806061 - 0 28.5695006 | -0.25 | 0.87 | [-1.95, 1.45] | -0.29 | 0.774 + 1 12.0983850 - 0 28.5695006 | -0.35 | 0.94 | [-2.20, 1.49] | -0.37 | 0.708 + 1 16.2161639 - 0 28.5695006 | -0.46 | 1.13 | [-2.67, 1.76] | -0.40 | 0.687 + 1 20.3339428 - 0 28.5695006 | -0.56 | 1.39 | [-3.29, 2.17] | -0.40 | 0.687 + 1 24.4517217 - 0 28.5695006 | -0.66 | 1.69 | [-3.98, 2.65] | -0.39 | 0.694 + 1 28.5695006 - 0 28.5695006 | -0.77 | 2.01 | [-4.71, 3.17] | -0.38 | 0.702 + 1 32.6872795 - 0 28.5695006 | -0.87 | 2.34 | [-5.46, 3.72] | -0.37 | 0.710 + 1 -4.3727306 - 0 32.6872795 | -0.01 | 1.46 | [-2.88, 2.85] | -8.26e-03 | 0.993 + 1 -0.2549517 - 0 32.6872795 | -0.12 | 1.22 | [-2.51, 2.27] | -0.10 | 0.924 + 1 3.8628272 - 0 32.6872795 | -0.22 | 1.05 | [-2.27, 1.83] | -0.21 | 0.834 + 1 7.9806061 - 0 32.6872795 | -0.32 | 0.98 | [-2.25, 1.60] | -0.33 | 0.742 + 1 12.0983850 - 0 32.6872795 | -0.43 | 1.05 | [-2.49, 1.63] | -0.41 | 0.684 + 1 16.2161639 - 0 32.6872795 | -0.53 | 1.22 | [-2.93, 1.87] | -0.43 | 0.664 + 1 20.3339428 - 0 32.6872795 | -0.64 | 1.47 | [-3.51, 2.24] | -0.43 | 0.665 + 1 24.4517217 - 0 32.6872795 | -0.74 | 1.75 | [-4.18, 2.70] | -0.42 | 0.674 + 1 28.5695006 - 0 32.6872795 | -0.84 | 2.06 | [-4.89, 3.20] | -0.41 | 0.683 + 1 32.6872795 - 0 32.6872795 | -0.95 | 2.39 | [-5.63, 3.74] | -0.40 | 0.692 + 1 -0.2549517 - 1 -4.3727306 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 3.8628272 - 1 -4.3727306 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 7.9806061 - 1 -4.3727306 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 12.0983850 - 1 -4.3727306 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 16.2161639 - 1 -4.3727306 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 20.3339428 - 1 -4.3727306 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 24.4517217 - 1 -4.3727306 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 28.5695006 - 1 -4.3727306 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 + 1 32.6872795 - 1 -4.3727306 | -0.93 | 3.26 | [-7.32, 5.45] | -0.29 | 0.774 + 1 3.8628272 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 7.9806061 - 1 -0.2549517 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 12.0983850 - 1 -0.2549517 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 16.2161639 - 1 -0.2549517 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 20.3339428 - 1 -0.2549517 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 24.4517217 - 1 -0.2549517 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 28.5695006 - 1 -0.2549517 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 32.6872795 - 1 -0.2549517 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 + 1 7.9806061 - 1 3.8628272 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 12.0983850 - 1 3.8628272 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 16.2161639 - 1 3.8628272 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 20.3339428 - 1 3.8628272 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 24.4517217 - 1 3.8628272 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 28.5695006 - 1 3.8628272 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 32.6872795 - 1 3.8628272 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 + 1 12.0983850 - 1 7.9806061 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 16.2161639 - 1 7.9806061 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 20.3339428 - 1 7.9806061 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 24.4517217 - 1 7.9806061 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 28.5695006 - 1 7.9806061 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 32.6872795 - 1 7.9806061 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 + 1 16.2161639 - 1 12.0983850 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 20.3339428 - 1 12.0983850 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 24.4517217 - 1 12.0983850 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 28.5695006 - 1 12.0983850 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 32.6872795 - 1 12.0983850 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 + 1 20.3339428 - 1 16.2161639 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 24.4517217 - 1 16.2161639 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 28.5695006 - 1 16.2161639 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 32.6872795 - 1 16.2161639 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 + 1 24.4517217 - 1 20.3339428 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 28.5695006 - 1 20.3339428 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 32.6872795 - 1 20.3339428 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 + 1 28.5695006 - 1 24.4517217 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 + 1 32.6872795 - 1 24.4517217 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 + 1 32.6872795 - 1 28.5695006 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - Contrasts are presented on the exponentiated scale. + Variable predicted: outcome + Predictors contrasted: var_binom, var_cont + Predictors averaged: groups + Contrasts are on the link-scale. # print hypothesis_test contrasts response scale Code print(out) Output - # Pairwise comparisons + Model-based Contrasts Analysis - var_binom | var_cont | Contrast | 95% CI | p - -------------------------------------------------------- - 0-1 | 2.48-2.48 | -0.07 | -0.38, 0.24 | 0.658 - 0-0 | 2.48-9.25 | -0.02 | -0.10, 0.06 | 0.596 - 0-1 | 2.48-9.25 | -0.04 | -0.26, 0.19 | 0.760 - 0-0 | 2.48-16.02 | -0.05 | -0.22, 0.13 | 0.608 - 0-1 | 2.48-16.02 | 0.00 | -0.32, 0.32 | 0.980 - 1-0 | 2.48-9.25 | 0.05 | -0.25, 0.34 | 0.754 - 1-1 | 2.48-9.25 | 0.03 | -0.20, 0.27 | 0.780 - 1-0 | 2.48-16.02 | 0.02 | -0.28, 0.33 | 0.880 - 1-1 | 2.48-16.02 | 0.06 | -0.37, 0.50 | 0.771 - 0-1 | 9.25-9.25 | -0.01 | -0.22, 0.20 | 0.902 - 0-0 | 9.25-16.02 | -0.02 | -0.12, 0.07 | 0.619 - 0-1 | 9.25-16.02 | 0.02 | -0.29, 0.33 | 0.910 - 1-0 | 9.25-16.02 | -0.01 | -0.24, 0.22 | 0.932 - 1-1 | 9.25-16.02 | 0.03 | -0.17, 0.23 | 0.761 - 0-1 | 16.02-16.02 | 0.04 | -0.28, 0.36 | 0.803 - Message + Parameter | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------------- + 0 -0.2549517 - 0 -4.3727306 | 0.02 | 0.03 | [-0.05, 0.09] | 0.53 | 0.597 + 0 3.8628272 - 0 -4.3727306 | 0.04 | 0.07 | [-0.10, 0.17] | 0.52 | 0.601 + 0 7.9806061 - 0 -4.3727306 | 0.06 | 0.11 | [-0.15, 0.26] | 0.52 | 0.603 + 0 12.0983850 - 0 -4.3727306 | 0.07 | 0.14 | [-0.21, 0.35] | 0.52 | 0.605 + 0 16.2161639 - 0 -4.3727306 | 0.09 | 0.18 | [-0.26, 0.44] | 0.52 | 0.606 + 0 20.3339428 - 0 -4.3727306 | 0.11 | 0.22 | [-0.31, 0.53] | 0.51 | 0.607 + 0 24.4517217 - 0 -4.3727306 | 0.13 | 0.25 | [-0.36, 0.62] | 0.52 | 0.606 + 0 28.5695006 - 0 -4.3727306 | 0.15 | 0.29 | [-0.41, 0.71] | 0.52 | 0.606 + 0 32.6872795 - 0 -4.3727306 | 0.17 | 0.32 | [-0.46, 0.80] | 0.52 | 0.604 + 1 -4.3727306 - 0 -4.3727306 | 0.16 | 0.33 | [-0.47, 0.80] | 0.50 | 0.615 + 1 -0.2549517 - 0 -4.3727306 | 0.14 | 0.26 | [-0.37, 0.65] | 0.53 | 0.594 + 1 3.8628272 - 0 -4.3727306 | 0.11 | 0.21 | [-0.30, 0.52] | 0.54 | 0.589 + 1 7.9806061 - 0 -4.3727306 | 0.09 | 0.19 | [-0.28, 0.45] | 0.46 | 0.643 + 1 12.0983850 - 0 -4.3727306 | 0.06 | 0.21 | [-0.34, 0.46] | 0.29 | 0.769 + 1 16.2161639 - 0 -4.3727306 | 0.03 | 0.26 | [-0.47, 0.54] | 0.14 | 0.892 + 1 20.3339428 - 0 -4.3727306 | 9.51e-03 | 0.32 | [-0.62, 0.64] | 0.03 | 0.976 + 1 24.4517217 - 0 -4.3727306 | -0.02 | 0.39 | [-0.77, 0.74] | -0.04 | 0.968 + 1 28.5695006 - 0 -4.3727306 | -0.04 | 0.45 | [-0.93, 0.85] | -0.09 | 0.930 + 1 32.6872795 - 0 -4.3727306 | -0.06 | 0.52 | [-1.07, 0.95] | -0.12 | 0.902 + 0 3.8628272 - 0 -0.2549517 | 0.02 | 0.04 | [-0.05, 0.09] | 0.52 | 0.604 + 0 7.9806061 - 0 -0.2549517 | 0.04 | 0.07 | [-0.10, 0.18] | 0.52 | 0.606 + 0 12.0983850 - 0 -0.2549517 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.607 + 0 16.2161639 - 0 -0.2549517 | 0.07 | 0.14 | [-0.21, 0.36] | 0.51 | 0.608 + 0 20.3339428 - 0 -0.2549517 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.608 + 0 24.4517217 - 0 -0.2549517 | 0.11 | 0.22 | [-0.32, 0.54] | 0.51 | 0.608 + 0 28.5695006 - 0 -0.2549517 | 0.13 | 0.25 | [-0.37, 0.63] | 0.51 | 0.607 + 0 32.6872795 - 0 -0.2549517 | 0.15 | 0.29 | [-0.41, 0.71] | 0.52 | 0.605 + 1 -4.3727306 - 0 -0.2549517 | 0.15 | 0.31 | [-0.47, 0.76] | 0.46 | 0.643 + 1 -0.2549517 - 0 -0.2549517 | 0.12 | 0.25 | [-0.36, 0.60] | 0.49 | 0.624 + 1 3.8628272 - 0 -0.2549517 | 0.09 | 0.19 | [-0.28, 0.47] | 0.50 | 0.619 + 1 7.9806061 - 0 -0.2549517 | 0.07 | 0.17 | [-0.26, 0.39] | 0.41 | 0.681 + 1 12.0983850 - 0 -0.2549517 | 0.04 | 0.19 | [-0.33, 0.41] | 0.23 | 0.821 + 1 16.2161639 - 0 -0.2549517 | 0.02 | 0.24 | [-0.46, 0.49] | 0.07 | 0.945 + 1 20.3339428 - 0 -0.2549517 | -8.63e-03 | 0.31 | [-0.61, 0.59] | -0.03 | 0.978 + 1 24.4517217 - 0 -0.2549517 | -0.03 | 0.38 | [-0.77, 0.71] | -0.09 | 0.929 + 1 28.5695006 - 0 -0.2549517 | -0.06 | 0.45 | [-0.93, 0.82] | -0.13 | 0.897 + 1 32.6872795 - 0 -0.2549517 | -0.08 | 0.51 | [-1.08, 0.92] | -0.16 | 0.873 + 0 7.9806061 - 0 3.8628272 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.608 + 0 12.0983850 - 0 3.8628272 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.609 + 0 16.2161639 - 0 3.8628272 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 + 0 20.3339428 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 + 0 24.4517217 - 0 3.8628272 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.609 + 0 28.5695006 - 0 3.8628272 | 0.11 | 0.22 | [-0.31, 0.54] | 0.51 | 0.607 + 0 32.6872795 - 0 3.8628272 | 0.13 | 0.25 | [-0.36, 0.62] | 0.52 | 0.605 + 1 -4.3727306 - 0 3.8628272 | 0.13 | 0.31 | [-0.47, 0.73] | 0.42 | 0.677 + 1 -0.2549517 - 0 3.8628272 | 0.10 | 0.23 | [-0.36, 0.56] | 0.43 | 0.664 + 1 3.8628272 - 0 3.8628272 | 0.08 | 0.18 | [-0.27, 0.42] | 0.43 | 0.665 + 1 7.9806061 - 0 3.8628272 | 0.05 | 0.15 | [-0.24, 0.34] | 0.33 | 0.739 + 1 12.0983850 - 0 3.8628272 | 0.02 | 0.17 | [-0.32, 0.36] | 0.14 | 0.890 + 1 16.2161639 - 0 3.8628272 | -1.64e-03 | 0.23 | [-0.45, 0.45] | -7.09e-03 | 0.994 + 1 20.3339428 - 0 3.8628272 | -0.03 | 0.30 | [-0.61, 0.56] | -0.09 | 0.928 + 1 24.4517217 - 0 3.8628272 | -0.05 | 0.37 | [-0.78, 0.68] | -0.14 | 0.889 + 1 28.5695006 - 0 3.8628272 | -0.08 | 0.44 | [-0.94, 0.79] | -0.17 | 0.863 + 1 32.6872795 - 0 3.8628272 | -0.10 | 0.50 | [-1.09, 0.89] | -0.20 | 0.843 + 0 12.0983850 - 0 7.9806061 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.610 + 0 16.2161639 - 0 7.9806061 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.611 + 0 20.3339428 - 0 7.9806061 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 + 0 24.4517217 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.609 + 0 28.5695006 - 0 7.9806061 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.607 + 0 32.6872795 - 0 7.9806061 | 0.11 | 0.22 | [-0.31, 0.54] | 0.52 | 0.605 + 1 -4.3727306 - 0 7.9806061 | 0.11 | 0.30 | [-0.48, 0.70] | 0.36 | 0.718 + 1 -0.2549517 - 0 7.9806061 | 0.08 | 0.23 | [-0.36, 0.53] | 0.36 | 0.716 + 1 3.8628272 - 0 7.9806061 | 0.06 | 0.17 | [-0.27, 0.39] | 0.34 | 0.733 + 1 7.9806061 - 0 7.9806061 | 0.03 | 0.14 | [-0.25, 0.31] | 0.22 | 0.824 + 1 12.0983850 - 0 7.9806061 | 5.53e-03 | 0.17 | [-0.32, 0.33] | 0.03 | 0.974 + 1 16.2161639 - 0 7.9806061 | -0.02 | 0.23 | [-0.46, 0.42] | -0.09 | 0.929 + 1 20.3339428 - 0 7.9806061 | -0.05 | 0.30 | [-0.63, 0.53] | -0.15 | 0.878 + 1 24.4517217 - 0 7.9806061 | -0.07 | 0.37 | [-0.79, 0.65] | -0.19 | 0.848 + 1 28.5695006 - 0 7.9806061 | -0.09 | 0.44 | [-0.95, 0.76] | -0.22 | 0.829 + 1 32.6872795 - 0 7.9806061 | -0.12 | 0.50 | [-1.10, 0.87] | -0.24 | 0.814 + 0 16.2161639 - 0 12.0983850 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.611 + 0 20.3339428 - 0 12.0983850 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.610 + 0 24.4517217 - 0 12.0983850 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.608 + 0 28.5695006 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.52 | 0.606 + 0 32.6872795 - 0 12.0983850 | 0.09 | 0.18 | [-0.26, 0.45] | 0.52 | 0.603 + 1 -4.3727306 - 0 12.0983850 | 0.09 | 0.30 | [-0.50, 0.68] | 0.30 | 0.764 + 1 -0.2549517 - 0 12.0983850 | 0.06 | 0.23 | [-0.38, 0.51] | 0.28 | 0.777 + 1 3.8628272 - 0 12.0983850 | 0.04 | 0.17 | [-0.29, 0.37] | 0.23 | 0.818 + 1 7.9806061 - 0 12.0983850 | 0.01 | 0.14 | [-0.26, 0.29] | 0.09 | 0.928 + 1 12.0983850 - 0 12.0983850 | -0.01 | 0.17 | [-0.34, 0.31] | -0.08 | 0.937 + 1 16.2161639 - 0 12.0983850 | -0.04 | 0.23 | [-0.48, 0.40] | -0.17 | 0.864 + 1 20.3339428 - 0 12.0983850 | -0.06 | 0.30 | [-0.64, 0.52] | -0.22 | 0.829 + 1 24.4517217 - 0 12.0983850 | -0.09 | 0.37 | [-0.81, 0.63] | -0.24 | 0.809 + 1 28.5695006 - 0 12.0983850 | -0.11 | 0.44 | [-0.97, 0.75] | -0.26 | 0.796 + 1 32.6872795 - 0 12.0983850 | -0.14 | 0.50 | [-1.12, 0.85] | -0.27 | 0.785 + 0 20.3339428 - 0 16.2161639 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.609 + 0 24.4517217 - 0 16.2161639 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.607 + 0 28.5695006 - 0 16.2161639 | 0.06 | 0.11 | [-0.16, 0.27] | 0.52 | 0.605 + 0 32.6872795 - 0 16.2161639 | 0.07 | 0.14 | [-0.21, 0.35] | 0.52 | 0.601 + 1 -4.3727306 - 0 16.2161639 | 0.07 | 0.31 | [-0.53, 0.67] | 0.23 | 0.815 + 1 -0.2549517 - 0 16.2161639 | 0.05 | 0.23 | [-0.41, 0.51] | 0.20 | 0.845 + 1 3.8628272 - 0 16.2161639 | 0.02 | 0.18 | [-0.32, 0.36] | 0.11 | 0.909 + 1 7.9806061 - 0 16.2161639 | -5.95e-03 | 0.15 | [-0.30, 0.29] | -0.04 | 0.968 + 1 12.0983850 - 0 16.2161639 | -0.03 | 0.17 | [-0.37, 0.31] | -0.18 | 0.855 + 1 16.2161639 - 0 16.2161639 | -0.06 | 0.23 | [-0.51, 0.40] | -0.25 | 0.804 + 1 20.3339428 - 0 16.2161639 | -0.08 | 0.30 | [-0.67, 0.51] | -0.28 | 0.783 + 1 24.4517217 - 0 16.2161639 | -0.11 | 0.37 | [-0.84, 0.62] | -0.29 | 0.772 + 1 28.5695006 - 0 16.2161639 | -0.13 | 0.44 | [-1.00, 0.73] | -0.30 | 0.765 + 1 32.6872795 - 0 16.2161639 | -0.16 | 0.51 | [-1.15, 0.84] | -0.31 | 0.758 + 0 24.4517217 - 0 20.3339428 | 0.02 | 0.04 | [-0.05, 0.09] | 0.52 | 0.605 + 0 28.5695006 - 0 20.3339428 | 0.04 | 0.07 | [-0.10, 0.18] | 0.52 | 0.602 + 0 32.6872795 - 0 20.3339428 | 0.06 | 0.11 | [-0.15, 0.26] | 0.53 | 0.599 + 1 -4.3727306 - 0 20.3339428 | 0.05 | 0.31 | [-0.56, 0.67] | 0.17 | 0.866 + 1 -0.2549517 - 0 20.3339428 | 0.03 | 0.25 | [-0.45, 0.51] | 0.11 | 0.912 + 1 3.8628272 - 0 20.3339428 | 1.27e-03 | 0.19 | [-0.37, 0.37] | 6.68e-03 | 0.995 + 1 7.9806061 - 0 20.3339428 | -0.02 | 0.17 | [-0.35, 0.30] | -0.15 | 0.883 + 1 12.0983850 - 0 20.3339428 | -0.05 | 0.19 | [-0.42, 0.32] | -0.27 | 0.790 + 1 16.2161639 - 0 20.3339428 | -0.08 | 0.24 | [-0.55, 0.40] | -0.31 | 0.754 + 1 20.3339428 - 0 20.3339428 | -0.10 | 0.31 | [-0.71, 0.51] | -0.33 | 0.743 + 1 24.4517217 - 0 20.3339428 | -0.13 | 0.38 | [-0.87, 0.62] | -0.33 | 0.739 + 1 28.5695006 - 0 20.3339428 | -0.15 | 0.45 | [-1.03, 0.73] | -0.34 | 0.736 + 1 32.6872795 - 0 20.3339428 | -0.17 | 0.51 | [-1.18, 0.83] | -0.34 | 0.733 + 0 28.5695006 - 0 24.4517217 | 0.02 | 0.04 | [-0.05, 0.09] | 0.53 | 0.599 + 0 32.6872795 - 0 24.4517217 | 0.04 | 0.07 | [-0.10, 0.17] | 0.53 | 0.595 + 1 -4.3727306 - 0 24.4517217 | 0.03 | 0.33 | [-0.61, 0.67] | 0.10 | 0.917 + 1 -0.2549517 - 0 24.4517217 | 8.46e-03 | 0.26 | [-0.50, 0.52] | 0.03 | 0.974 + 1 3.8628272 - 0 24.4517217 | -0.02 | 0.21 | [-0.43, 0.39] | -0.08 | 0.934 + 1 7.9806061 - 0 24.4517217 | -0.04 | 0.19 | [-0.42, 0.33] | -0.23 | 0.819 + 1 12.0983850 - 0 24.4517217 | -0.07 | 0.21 | [-0.48, 0.34] | -0.33 | 0.741 + 1 16.2161639 - 0 24.4517217 | -0.09 | 0.26 | [-0.60, 0.41] | -0.37 | 0.715 + 1 20.3339428 - 0 24.4517217 | -0.12 | 0.32 | [-0.75, 0.51] | -0.37 | 0.710 + 1 24.4517217 - 0 24.4517217 | -0.15 | 0.39 | [-0.91, 0.62] | -0.37 | 0.710 + 1 28.5695006 - 0 24.4517217 | -0.17 | 0.46 | [-1.07, 0.73] | -0.37 | 0.711 + 1 32.6872795 - 0 24.4517217 | -0.19 | 0.52 | [-1.21, 0.82] | -0.37 | 0.710 + 0 32.6872795 - 0 28.5695006 | 0.02 | 0.03 | [-0.05, 0.09] | 0.54 | 0.591 + 1 -4.3727306 - 0 28.5695006 | 0.02 | 0.34 | [-0.65, 0.69] | 0.05 | 0.964 + 1 -0.2549517 - 0 28.5695006 | -0.01 | 0.28 | [-0.56, 0.54] | -0.04 | 0.971 + 1 3.8628272 - 0 28.5695006 | -0.04 | 0.23 | [-0.49, 0.42] | -0.15 | 0.877 + 1 7.9806061 - 0 28.5695006 | -0.06 | 0.22 | [-0.48, 0.36] | -0.29 | 0.773 + 1 12.0983850 - 0 28.5695006 | -0.09 | 0.23 | [-0.55, 0.37] | -0.38 | 0.706 + 1 16.2161639 - 0 28.5695006 | -0.11 | 0.28 | [-0.66, 0.43] | -0.41 | 0.684 + 1 20.3339428 - 0 28.5695006 | -0.14 | 0.34 | [-0.80, 0.53] | -0.41 | 0.682 + 1 24.4517217 - 0 28.5695006 | -0.16 | 0.40 | [-0.96, 0.63] | -0.41 | 0.685 + 1 28.5695006 - 0 28.5695006 | -0.19 | 0.47 | [-1.11, 0.73] | -0.40 | 0.688 + 1 32.6872795 - 0 28.5695006 | -0.21 | 0.53 | [-1.25, 0.83] | -0.40 | 0.689 + 1 -4.3727306 - 0 32.6872795 | -2.96e-03 | 0.36 | [-0.71, 0.70] | -8.25e-03 | 0.993 + 1 -0.2549517 - 0 32.6872795 | -0.03 | 0.30 | [-0.62, 0.56] | -0.10 | 0.924 + 1 3.8628272 - 0 32.6872795 | -0.05 | 0.26 | [-0.56, 0.45] | -0.21 | 0.833 + 1 7.9806061 - 0 32.6872795 | -0.08 | 0.24 | [-0.56, 0.39] | -0.33 | 0.740 + 1 12.0983850 - 0 32.6872795 | -0.11 | 0.26 | [-0.61, 0.40] | -0.41 | 0.681 + 1 16.2161639 - 0 32.6872795 | -0.13 | 0.30 | [-0.72, 0.46] | -0.44 | 0.660 + 1 20.3339428 - 0 32.6872795 | -0.16 | 0.36 | [-0.86, 0.54] | -0.44 | 0.659 + 1 24.4517217 - 0 32.6872795 | -0.18 | 0.42 | [-1.00, 0.64] | -0.43 | 0.664 + 1 28.5695006 - 0 32.6872795 | -0.21 | 0.48 | [-1.15, 0.74] | -0.43 | 0.668 + 1 32.6872795 - 0 32.6872795 | -0.23 | 0.54 | [-1.29, 0.83] | -0.43 | 0.671 + 1 -0.2549517 - 1 -4.3727306 | -0.03 | 0.09 | [-0.20, 0.14] | -0.29 | 0.768 + 1 3.8628272 - 1 -4.3727306 | -0.05 | 0.18 | [-0.40, 0.29] | -0.29 | 0.770 + 1 7.9806061 - 1 -4.3727306 | -0.08 | 0.27 | [-0.60, 0.45] | -0.29 | 0.772 + 1 12.0983850 - 1 -4.3727306 | -0.10 | 0.36 | [-0.80, 0.60] | -0.29 | 0.772 + 1 16.2161639 - 1 -4.3727306 | -0.13 | 0.45 | [-1.00, 0.74] | -0.29 | 0.772 + 1 20.3339428 - 1 -4.3727306 | -0.15 | 0.53 | [-1.19, 0.88] | -0.29 | 0.771 + 1 24.4517217 - 1 -4.3727306 | -0.18 | 0.61 | [-1.38, 1.02] | -0.29 | 0.769 + 1 28.5695006 - 1 -4.3727306 | -0.20 | 0.68 | [-1.55, 1.14] | -0.30 | 0.766 + 1 32.6872795 - 1 -4.3727306 | -0.23 | 0.75 | [-1.70, 1.25] | -0.30 | 0.763 + 1 3.8628272 - 1 -0.2549517 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.772 + 1 7.9806061 - 1 -0.2549517 | -0.05 | 0.18 | [-0.40, 0.30] | -0.29 | 0.773 + 1 12.0983850 - 1 -0.2549517 | -0.08 | 0.27 | [-0.61, 0.45] | -0.29 | 0.773 + 1 16.2161639 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.60] | -0.29 | 0.773 + 1 20.3339428 - 1 -0.2549517 | -0.13 | 0.44 | [-1.00, 0.74] | -0.29 | 0.771 + 1 24.4517217 - 1 -0.2549517 | -0.15 | 0.52 | [-1.18, 0.87] | -0.29 | 0.769 + 1 28.5695006 - 1 -0.2549517 | -0.18 | 0.60 | [-1.35, 0.99] | -0.30 | 0.766 + 1 32.6872795 - 1 -0.2549517 | -0.20 | 0.67 | [-1.51, 1.10] | -0.30 | 0.762 + 1 7.9806061 - 1 3.8628272 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.774 + 1 12.0983850 - 1 3.8628272 | -0.05 | 0.18 | [-0.41, 0.30] | -0.29 | 0.774 + 1 16.2161639 - 1 3.8628272 | -0.08 | 0.27 | [-0.60, 0.45] | -0.29 | 0.773 + 1 20.3339428 - 1 3.8628272 | -0.10 | 0.35 | [-0.80, 0.59] | -0.29 | 0.771 + 1 24.4517217 - 1 3.8628272 | -0.13 | 0.43 | [-0.98, 0.72] | -0.29 | 0.768 + 1 28.5695006 - 1 3.8628272 | -0.15 | 0.51 | [-1.15, 0.84] | -0.30 | 0.765 + 1 32.6872795 - 1 3.8628272 | -0.18 | 0.58 | [-1.31, 0.95] | -0.30 | 0.761 + 1 12.0983850 - 1 7.9806061 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.774 + 1 16.2161639 - 1 7.9806061 | -0.05 | 0.18 | [-0.40, 0.30] | -0.29 | 0.772 + 1 20.3339428 - 1 7.9806061 | -0.08 | 0.26 | [-0.59, 0.44] | -0.29 | 0.770 + 1 24.4517217 - 1 7.9806061 | -0.10 | 0.34 | [-0.77, 0.57] | -0.30 | 0.767 + 1 28.5695006 - 1 7.9806061 | -0.13 | 0.42 | [-0.95, 0.69] | -0.30 | 0.763 + 1 32.6872795 - 1 7.9806061 | -0.15 | 0.49 | [-1.10, 0.80] | -0.31 | 0.758 + 1 16.2161639 - 1 12.0983850 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.771 + 1 20.3339428 - 1 12.0983850 | -0.05 | 0.17 | [-0.39, 0.29] | -0.30 | 0.768 + 1 24.4517217 - 1 12.0983850 | -0.08 | 0.25 | [-0.57, 0.42] | -0.30 | 0.764 + 1 28.5695006 - 1 12.0983850 | -0.10 | 0.33 | [-0.74, 0.54] | -0.31 | 0.760 + 1 32.6872795 - 1 12.0983850 | -0.12 | 0.40 | [-0.90, 0.65] | -0.31 | 0.755 + 1 20.3339428 - 1 16.2161639 | -0.03 | 0.08 | [-0.19, 0.14] | -0.30 | 0.765 + 1 24.4517217 - 1 16.2161639 | -0.05 | 0.17 | [-0.37, 0.27] | -0.30 | 0.761 + 1 28.5695006 - 1 16.2161639 | -0.07 | 0.24 | [-0.55, 0.40] | -0.31 | 0.756 + 1 32.6872795 - 1 16.2161639 | -0.10 | 0.31 | [-0.70, 0.51] | -0.32 | 0.750 + 1 24.4517217 - 1 20.3339428 | -0.02 | 0.08 | [-0.18, 0.13] | -0.31 | 0.757 + 1 28.5695006 - 1 20.3339428 | -0.05 | 0.16 | [-0.35, 0.25] | -0.32 | 0.751 + 1 32.6872795 - 1 20.3339428 | -0.07 | 0.22 | [-0.51, 0.37] | -0.33 | 0.745 + 1 28.5695006 - 1 24.4517217 | -0.02 | 0.07 | [-0.17, 0.12] | -0.32 | 0.745 + 1 32.6872795 - 1 24.4517217 | -0.05 | 0.14 | [-0.33, 0.23] | -0.33 | 0.738 + 1 32.6872795 - 1 28.5695006 | -0.02 | 0.07 | [-0.16, 0.11] | -0.35 | 0.730 - Contrasts are presented as probabilities (in %-points). - -# print hypothesis_test predictions exp scale - - Code - print(out) - Output - var_binom | var_cont | Predicted | 95% CI | p - ----------------------------------------------------- - 0 | 2.48 | 1.25 | 1.04, 1.50 | 0.019 - 1 | 2.48 | 1.34 | 0.98, 1.82 | 0.065 - 0 | 9.25 | 1.27 | 1.08, 1.51 | 0.005 - 1 | 9.25 | 1.29 | 1.03, 1.62 | 0.025 - 0 | 16.02 | 1.30 | 1.07, 1.59 | 0.007 - 1 | 16.02 | 1.25 | 0.91, 1.71 | 0.161 - Message - - Predictions are presented on the exponentiated scale. + Variable predicted: outcome + Predictors contrasted: var_binom, var_cont + Predictors averaged: groups + Contrasts are on the response-scale. # print hypothesis_test comma and dash levels Code print(ht) Output - # Pairwise comparisons + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE + ------------------------------------------------------------------- + and, another, comma, b | and, another, comma, a | -0.02 | 0.07 + no comma, a | and, another, comma, a | 0.15 | 0.09 + no comma, b | and, another, comma, a | 0.13 | 0.12 + with, comma, a | and, another, comma, a | 0.07 | 0.08 + with, comma, b | and, another, comma, a | 0.06 | 0.11 + no comma, a | and, another, comma, b | 0.17 | 0.12 + no comma, b | and, another, comma, b | 0.15 | 0.09 + with, comma, a | and, another, comma, b | 0.09 | 0.11 + with, comma, b | and, another, comma, b | 0.07 | 0.08 + no comma, b | no comma, a | -0.02 | 0.07 + with, comma, a | no comma, a | -0.08 | 0.09 + with, comma, b | no comma, a | -0.10 | 0.11 + with, comma, a | no comma, b | -0.06 | 0.12 + with, comma, b | no comma, b | -0.08 | 0.09 + with, comma, b | with, comma, a | -0.02 | 0.07 + + Level1 | 95% CI | t(143) | p + ------------------------------------------------------- + and, another, comma, b | [-0.16, 0.12] | -0.26 | 0.796 + no comma, a | [-0.03, 0.33] | 1.66 | 0.099 + no comma, b | [-0.10, 0.36] | 1.14 | 0.255 + with, comma, a | [-0.09, 0.24] | 0.88 | 0.380 + with, comma, b | [-0.16, 0.27] | 0.51 | 0.610 + no comma, a | [-0.06, 0.40] | 1.46 | 0.147 + no comma, b | [-0.03, 0.33] | 1.66 | 0.099 + with, comma, a | [-0.13, 0.32] | 0.82 | 0.412 + with, comma, b | [-0.09, 0.24] | 0.88 | 0.380 + no comma, b | [-0.16, 0.12] | -0.26 | 0.796 + with, comma, a | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, b | [-0.32, 0.13] | -0.83 | 0.407 + with, comma, a | [-0.29, 0.18] | -0.49 | 0.625 + with, comma, b | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, b | [-0.16, 0.12] | -0.26 | 0.796 - f1 | f2 | Contrast | 95% CI | p - ------------------------------------------------------------------------------ - and, another, comma-and, another, comma | a-b | 0.02 | -0.12, 0.16 | 0.796 - and, another, comma-no comma | a-a | -0.15 | -0.33, 0.03 | 0.099 - and, another, comma-no comma | a-b | -0.13 | -0.36, 0.10 | 0.255 - and, another, comma-with, comma | a-a | -0.07 | -0.24, 0.09 | 0.380 - and, another, comma-with, comma | a-b | -0.06 | -0.27, 0.16 | 0.610 - and, another, comma-no comma | b-a | -0.17 | -0.40, 0.06 | 0.147 - and, another, comma-no comma | b-b | -0.15 | -0.33, 0.03 | 0.099 - and, another, comma-with, comma | b-a | -0.09 | -0.32, 0.13 | 0.412 - and, another, comma-with, comma | b-b | -0.07 | -0.24, 0.09 | 0.380 - no comma-no comma | a-b | 0.02 | -0.12, 0.16 | 0.796 - no comma-with, comma | a-a | 0.08 | -0.10, 0.26 | 0.402 - no comma-with, comma | a-b | 0.10 | -0.13, 0.32 | 0.407 - no comma-with, comma | b-a | 0.06 | -0.18, 0.29 | 0.625 - no comma-with, comma | b-b | 0.08 | -0.10, 0.26 | 0.402 - with, comma-with, comma | a-b | 0.02 | -0.12, 0.16 | 0.796 + Variable predicted: Sepal.Length + Predictors contrasted: f1, f2 + Predictors averaged: Sepal.Width (3.1), Species --- Code print(ht, table_width = Inf) Output - # Pairwise comparisons + Model-based Contrasts Analysis - f1 | f2 | Contrast | 95% CI | p - -------------------------------------------------------------------------------------------------- - and, another, comma-and, another, comma | comma, here-nothere | 0.02 | -0.12, 0.16 | 0.796 - and, another, comma-no comma | comma, here-comma, here | -0.15 | -0.33, 0.03 | 0.099 - and, another, comma-no comma | comma, here-nothere | -0.13 | -0.36, 0.10 | 0.255 - and, another, comma-with, comma | comma, here-comma, here | -0.07 | -0.24, 0.09 | 0.380 - and, another, comma-with, comma | comma, here-nothere | -0.06 | -0.27, 0.16 | 0.610 - and, another, comma-no comma | nothere-comma, here | -0.17 | -0.40, 0.06 | 0.147 - and, another, comma-no comma | nothere-nothere | -0.15 | -0.33, 0.03 | 0.099 - and, another, comma-with, comma | nothere-comma, here | -0.09 | -0.32, 0.13 | 0.412 - and, another, comma-with, comma | nothere-nothere | -0.07 | -0.24, 0.09 | 0.380 - no comma-no comma | comma, here-nothere | 0.02 | -0.12, 0.16 | 0.796 - no comma-with, comma | comma, here-comma, here | 0.08 | -0.10, 0.26 | 0.402 - no comma-with, comma | comma, here-nothere | 0.10 | -0.13, 0.32 | 0.407 - no comma-with, comma | nothere-comma, here | 0.06 | -0.18, 0.29 | 0.625 - no comma-with, comma | nothere-nothere | 0.08 | -0.10, 0.26 | 0.402 - with, comma-with, comma | comma, here-nothere | 0.02 | -0.12, 0.16 | 0.796 - ---- - - Code - print(ht) - Output - # Pairwise comparisons + Level1 | Level2 | Difference | SE | 95% CI | t(143) | p + -------------------------------------------------------------------------------------------------------------------- + and, another, comma, nothere | and, another, comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 + no comma, comma, here | and, another, comma, comma, here | 0.15 | 0.09 | [-0.03, 0.33] | 1.66 | 0.099 + no comma, nothere | and, another, comma, comma, here | 0.13 | 0.12 | [-0.10, 0.36] | 1.14 | 0.255 + with, comma, comma, here | and, another, comma, comma, here | 0.07 | 0.08 | [-0.09, 0.24] | 0.88 | 0.380 + with, comma, nothere | and, another, comma, comma, here | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 + no comma, comma, here | and, another, comma, nothere | 0.17 | 0.12 | [-0.06, 0.40] | 1.46 | 0.147 + no comma, nothere | and, another, comma, nothere | 0.15 | 0.09 | [-0.03, 0.33] | 1.66 | 0.099 + with, comma, comma, here | and, another, comma, nothere | 0.09 | 0.11 | [-0.13, 0.32] | 0.82 | 0.412 + with, comma, nothere | and, another, comma, nothere | 0.07 | 0.08 | [-0.09, 0.24] | 0.88 | 0.380 + no comma, nothere | no comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 + with, comma, comma, here | no comma, comma, here | -0.08 | 0.09 | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, nothere | no comma, comma, here | -0.10 | 0.11 | [-0.32, 0.13] | -0.83 | 0.407 + with, comma, comma, here | no comma, nothere | -0.06 | 0.12 | [-0.29, 0.18] | -0.49 | 0.625 + with, comma, nothere | no comma, nothere | -0.08 | 0.09 | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, nothere | with, comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 - f1 | f2 | Contrast | 95% CI | p - ------------------------------------------------------------------------------ - and-dash | comma, here-dash-there | 0.02 | -0.12, 0.16 | 0.796 - and-dash-no dash | comma, here | -0.15 | -0.33, 0.03 | 0.099 - and-dash-no dash | comma, here-dash-there | -0.13 | -0.36, 0.10 | 0.255 - and-dash-with, comma | comma, here | -0.07 | -0.24, 0.09 | 0.380 - and-dash-with, comma | comma, here-dash-there | -0.06 | -0.27, 0.16 | 0.610 - and-dash-no dash | dash-there-comma, here | -0.17 | -0.40, 0.06 | 0.147 - and-dash-no dash | dash-there | -0.15 | -0.33, 0.03 | 0.099 - and-dash-with, comma | dash-there-comma, here | -0.09 | -0.32, 0.13 | 0.412 - and-dash-with, comma | dash-there | -0.07 | -0.24, 0.09 | 0.380 - no dash | comma, here-dash-there | 0.02 | -0.12, 0.16 | 0.796 - no dash-with, comma | comma, here | 0.08 | -0.10, 0.26 | 0.402 - no dash-with, comma | comma, here-dash-there | 0.10 | -0.13, 0.32 | 0.407 - no dash-with, comma | dash-there-comma, here | 0.06 | -0.18, 0.29 | 0.625 - no dash-with, comma | dash-there | 0.08 | -0.10, 0.26 | 0.402 - with, comma | comma, here-dash-there | 0.02 | -0.12, 0.16 | 0.796 + Variable predicted: Sepal.Length + Predictors contrasted: f1, f2 + Predictors averaged: Sepal.Width (3.1), Species # print hypothesis_test collapse levels Code print(out) Output - # Pairwise comparisons + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | t(807) | p + ---------------------------------------------------------------------------- + 1, female | 1, male | 0.95 | 4.30 | [ -7.50, 9.39] | 0.22 | 0.825 + 2, male | 1, male | 3.89 | 4.41 | [ -4.77, 12.55] | 0.88 | 0.378 + 2, female | 1, male | 3.56 | 3.95 | [ -4.20, 11.32] | 0.90 | 0.368 + 3, male | 1, male | -0.86 | 5.16 | [-10.99, 9.28] | -0.17 | 0.868 + 3, female | 1, male | 3.12 | 4.45 | [ -5.62, 11.85] | 0.70 | 0.484 + 2, male | 1, female | 2.94 | 3.14 | [ -3.21, 9.10] | 0.94 | 0.348 + 2, female | 1, female | 2.61 | 2.42 | [ -2.15, 7.37] | 1.08 | 0.282 + 3, male | 1, female | -1.81 | 4.12 | [ -9.89, 6.28] | -0.44 | 0.661 + 3, female | 1, female | 2.17 | 3.17 | [ -4.05, 8.39] | 0.68 | 0.494 + 2, female | 2, male | -0.33 | 2.63 | [ -5.49, 4.83] | -0.13 | 0.899 + 3, male | 2, male | -4.75 | 4.23 | [-13.06, 3.56] | -1.12 | 0.262 + 3, female | 2, male | -0.78 | 3.32 | [ -7.29, 5.74] | -0.23 | 0.815 + 3, male | 2, female | -4.42 | 3.75 | [-11.78, 2.95] | -1.18 | 0.239 + 3, female | 2, female | -0.44 | 2.67 | [ -5.69, 4.80] | -0.17 | 0.869 + 3, female | 3, male | 3.97 | 4.26 | [ -4.40, 12.34] | 0.93 | 0.352 - c172code | c161sex | Contrast | 95% CI | p - --------------------------------------------------------- - 1-2 | male | -3.89 | -12.55, 4.77 | 0.378 - 1-3 | male | 0.86 | -9.28, 10.99 | 0.868 - 1 | male-female | -0.95 | -9.39, 7.50 | 0.825 - 1-2 | male-female | -3.56 | -11.32, 4.20 | 0.368 - 1-3 | male-female | -3.12 | -11.85, 5.62 | 0.484 - 2-3 | male | 4.75 | -3.56, 13.06 | 0.262 - 2-1 | male-female | 2.94 | -3.21, 9.10 | 0.348 - 2 | male-female | 0.33 | -4.83, 5.49 | 0.899 - 2-3 | male-female | 0.78 | -5.74, 7.29 | 0.815 - 3-1 | male-female | -1.81 | -9.89, 6.28 | 0.661 - 3-2 | male-female | -4.42 | -11.78, 2.95 | 0.239 - 3 | male-female | -3.97 | -12.34, 4.40 | 0.352 - 1-2 | female | -2.61 | -7.37, 2.15 | 0.282 - 1-3 | female | -2.17 | -8.39, 4.05 | 0.494 - 2-3 | female | 0.44 | -4.80, 5.69 | 0.869 + Variable predicted: barthtot + Predictors contrasted: c172code, c161sex + Predictors averaged: c12hour (42), neg_c_7 (12) # hypothesis_test, ci-level Code print(out) Output - # Pairwise comparisons + Model-based Contrasts Analysis - Species | Contrast | 95% CI | p - ------------------------------------------------------- - setosa-versicolor | -0.93 | -1.13, -0.73 | < .001 - setosa-virginica | -1.58 | -1.79, -1.38 | < .001 - versicolor-virginica | -0.65 | -0.86, -0.45 | < .001 + Level1 | Level2 | Difference | SE | 95% CI | t(147) | p + ---------------------------------------------------------------------------- + versicolor | setosa | 0.93 | 0.10 | [0.73, 1.13] | 9.03 | < .001 + virginica | setosa | 1.58 | 0.10 | [1.38, 1.79] | 15.37 | < .001 + virginica | versicolor | 0.65 | 0.10 | [0.45, 0.86] | 6.33 | < .001 + + Variable predicted: Sepal.Length + Predictors contrasted: Species --- Code print(out) Output - # Pairwise comparisons - - Species | Contrast | 80% CI | p - ------------------------------------------------------- - setosa-versicolor | -0.93 | -1.06, -0.80 | < .001 - setosa-virginica | -1.58 | -1.71, -1.45 | < .001 - versicolor-virginica | -0.65 | -0.78, -0.52 | < .001 - -# glmmTMB, orderedbeta - - Code - print(test_predictions(out2)) - Output - # Pairwise comparisons + Model-based Contrasts Analysis - gear | Contrast | 95% CI | p - ------------------------------------- - 3-4 | -0.03 | -0.12, 0.06 | 0.471 - 3-5 | -0.05 | -0.18, 0.09 | 0.489 - 4-5 | -0.02 | -0.15, 0.12 | 0.820 - Message + Level1 | Level2 | Difference | SE | 80% CI | t(147) | p + ---------------------------------------------------------------------------- + versicolor | setosa | 0.93 | 0.10 | [0.80, 1.06] | 9.03 | < .001 + virginica | setosa | 1.58 | 0.10 | [1.45, 1.71] | 15.37 | < .001 + virginica | versicolor | 0.65 | 0.10 | [0.52, 0.78] | 6.33 | < .001 - Contrasts are presented as proportions (in %-points). + Variable predicted: Sepal.Length + Predictors contrasted: Species # print hypothesis_test collapse CI Code print(out) Output - # Pairwise comparisons + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | t(876) | p + ------------------------------------------------------------------------ + 2 | 1 | -8.67 | 2.52 | [-13.61, -3.72] | -3.44 | < .001 + 3 | 1 | -21.19 | 2.45 | [-25.99, -16.38] | -8.66 | < .001 + 4 | 1 | -61.19 | 2.47 | [-66.05, -56.34] | -24.75 | < .001 + 3 | 2 | -12.52 | 1.59 | [-15.64, -9.40] | -7.87 | < .001 + 4 | 2 | -52.53 | 1.63 | [-55.73, -49.32] | -32.16 | < .001 + 4 | 3 | -40.01 | 1.48 | [-42.92, -37.10] | -26.98 | < .001 - e42dep | Contrast | 95% CI | p - ----------------------------------------- - 1-2 | 8.67 | 3.72, 13.61 | < .001 - 1-3 | 21.19 | 16.38, 25.99 | < .001 - 1-4 | 61.19 | 56.34, 66.05 | < .001 - 2-3 | 12.52 | 9.40, 15.64 | < .001 - 2-4 | 52.53 | 49.32, 55.73 | < .001 - 3-4 | 40.01 | 37.10, 42.92 | < .001 + Variable predicted: barthtot + Predictors contrasted: e42dep + Predictors averaged: c160age (53) --- Code print(out, collapse_ci = TRUE) Output - # Pairwise comparisons + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | t(876) | p + ------------------------------------------------------------------------ + 2 | 1 | -8.67 | 2.52 | [-13.61, -3.72] | -3.44 | < .001 + 3 | 1 | -21.19 | 2.45 | [-25.99, -16.38] | -8.66 | < .001 + 4 | 1 | -61.19 | 2.47 | [-66.05, -56.34] | -24.75 | < .001 + 3 | 2 | -12.52 | 1.59 | [-15.64, -9.40] | -7.87 | < .001 + 4 | 2 | -52.53 | 1.63 | [-55.73, -49.32] | -32.16 | < .001 + 4 | 3 | -40.01 | 1.48 | [-42.92, -37.10] | -26.98 | < .001 - e42dep | Contrast (95% CI) | p - -------------------------------------- - 1-2 | 8.67 (3.72, 13.61) | < .001 - 1-3 | 21.19 (16.38, 25.99) | < .001 - 1-4 | 61.19 (56.34, 66.05) | < .001 - 2-3 | 12.52 (9.40, 15.64) | < .001 - 2-4 | 52.53 (49.32, 55.73) | < .001 - 3-4 | 40.01 (37.10, 42.92) | < .001 + Variable predicted: barthtot + Predictors contrasted: e42dep + Predictors averaged: c160age (53) diff --git a/tests/testthat/_snaps/print_test_predictions.new.md b/tests/testthat/_snaps/print_test_predictions.new.md deleted file mode 100644 index 7787b644..00000000 --- a/tests/testthat/_snaps/print_test_predictions.new.md +++ /dev/null @@ -1,840 +0,0 @@ -# print hypothesis_test simple contrast link scale - - Code - print(out) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | z | p - ------------------------------------------------------------------ - 1 | 0 | 0.07 | 0.57 | [-1.05, 1.19] | 0.12 | 0.901 - - Variable predicted: outcome - Predictors contrasted: var_binom - Predictors averaged: var_cont (9.2), groups - Contrasts are on the link-scale. - -# print hypothesis_test simple predictions link scale - - Code - print(out) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | z | p - ------------------------------------------------------------------ - 1 | 0 | 0.07 | 0.57 | [-1.05, 1.19] | 0.12 | 0.901 - - Variable predicted: outcome - Predictors contrasted: var_binom - Predictors averaged: var_cont (9.2), groups - Contrasts are on the link-scale. - -# print hypothesis_test simple contrast response scale - - Code - print(out) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | z | p - ------------------------------------------------------------------ - 1 | 0 | 0.02 | 0.14 | [-0.26, 0.30] | 0.12 | 0.901 - - Variable predicted: outcome - Predictors contrasted: var_binom - Predictors averaged: var_cont (9.2), groups - Contrasts are on the response-scale. - -# print hypothesis_test contrasts link scale - - Code - print(out) - Output - Model-based Contrasts Analysis - - Parameter | Difference | SE | 95% CI | z | p - ----------------------------------------------------------------------------------- - 0 -0.2549517 - 0 -4.3727306 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 3.8628272 - 0 -4.3727306 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 7.9806061 - 0 -4.3727306 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 12.0983850 - 0 -4.3727306 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 16.2161639 - 0 -4.3727306 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 0 20.3339428 - 0 -4.3727306 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 - 0 24.4517217 - 0 -4.3727306 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 - 0 28.5695006 - 0 -4.3727306 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 - 0 32.6872795 - 0 -4.3727306 | 0.67 | 1.32 | [-1.91, 3.26] | 0.51 | 0.610 - 1 -4.3727306 - 0 -4.3727306 | 0.66 | 1.33 | [-1.94, 3.27] | 0.50 | 0.618 - 1 -0.2549517 - 0 -4.3727306 | 0.56 | 1.05 | [-1.51, 2.62] | 0.53 | 0.596 - 1 3.8628272 - 0 -4.3727306 | 0.45 | 0.84 | [-1.20, 2.11] | 0.54 | 0.590 - 1 7.9806061 - 0 -4.3727306 | 0.35 | 0.76 | [-1.14, 1.84] | 0.46 | 0.644 - 1 12.0983850 - 0 -4.3727306 | 0.25 | 0.84 | [-1.40, 1.89] | 0.29 | 0.768 - 1 16.2161639 - 0 -4.3727306 | 0.14 | 1.05 | [-1.91, 2.19] | 0.14 | 0.891 - 1 20.3339428 - 0 -4.3727306 | 0.04 | 1.32 | [-2.55, 2.63] | 0.03 | 0.976 - 1 24.4517217 - 0 -4.3727306 | -0.06 | 1.63 | [-3.26, 3.13] | -0.04 | 0.968 - 1 28.5695006 - 0 -4.3727306 | -0.17 | 1.96 | [-4.01, 3.67] | -0.09 | 0.931 - 1 32.6872795 - 0 -4.3727306 | -0.27 | 2.30 | [-4.77, 4.23] | -0.12 | 0.906 - 0 3.8628272 - 0 -0.2549517 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 7.9806061 - 0 -0.2549517 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 12.0983850 - 0 -0.2549517 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 16.2161639 - 0 -0.2549517 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 20.3339428 - 0 -0.2549517 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 0 24.4517217 - 0 -0.2549517 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 - 0 28.5695006 - 0 -0.2549517 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 - 0 32.6872795 - 0 -0.2549517 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 - 1 -4.3727306 - 0 -0.2549517 | 0.59 | 1.28 | [-1.92, 3.10] | 0.46 | 0.646 - 1 -0.2549517 - 0 -0.2549517 | 0.48 | 0.99 | [-1.46, 2.42] | 0.49 | 0.625 - 1 3.8628272 - 0 -0.2549517 | 0.38 | 0.76 | [-1.12, 1.88] | 0.50 | 0.619 - 1 7.9806061 - 0 -0.2549517 | 0.28 | 0.67 | [-1.04, 1.59] | 0.41 | 0.680 - 1 12.0983850 - 0 -0.2549517 | 0.17 | 0.76 | [-1.31, 1.66] | 0.23 | 0.820 - 1 16.2161639 - 0 -0.2549517 | 0.07 | 0.98 | [-1.86, 1.99] | 0.07 | 0.945 - 1 20.3339428 - 0 -0.2549517 | -0.04 | 1.27 | [-2.53, 2.46] | -0.03 | 0.978 - 1 24.4517217 - 0 -0.2549517 | -0.14 | 1.59 | [-3.26, 2.98] | -0.09 | 0.930 - 1 28.5695006 - 0 -0.2549517 | -0.24 | 1.93 | [-4.02, 3.53] | -0.13 | 0.899 - 1 32.6872795 - 0 -0.2549517 | -0.35 | 2.27 | [-4.79, 4.10] | -0.15 | 0.878 - 0 7.9806061 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 12.0983850 - 0 3.8628272 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 16.2161639 - 0 3.8628272 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 20.3339428 - 0 3.8628272 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 24.4517217 - 0 3.8628272 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 0 28.5695006 - 0 3.8628272 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 - 0 32.6872795 - 0 3.8628272 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 - 1 -4.3727306 - 0 3.8628272 | 0.51 | 1.25 | [-1.93, 2.95] | 0.41 | 0.680 - 1 -0.2549517 - 0 3.8628272 | 0.41 | 0.94 | [-1.44, 2.26] | 0.43 | 0.665 - 1 3.8628272 - 0 3.8628272 | 0.30 | 0.70 | [-1.07, 1.68] | 0.43 | 0.665 - 1 7.9806061 - 0 3.8628272 | 0.20 | 0.60 | [-0.98, 1.38] | 0.33 | 0.738 - 1 12.0983850 - 0 3.8628272 | 0.10 | 0.70 | [-1.28, 1.47] | 0.14 | 0.890 - 1 16.2161639 - 0 3.8628272 | -6.65e-03 | 0.94 | [-1.85, 1.83] | -7.09e-03 | 0.994 - 1 20.3339428 - 0 3.8628272 | -0.11 | 1.24 | [-2.54, 2.32] | -0.09 | 0.929 - 1 24.4517217 - 0 3.8628272 | -0.21 | 1.56 | [-3.28, 2.85] | -0.14 | 0.891 - 1 28.5695006 - 0 3.8628272 | -0.32 | 1.90 | [-4.05, 3.41] | -0.17 | 0.867 - 1 32.6872795 - 0 3.8628272 | -0.42 | 2.25 | [-4.83, 3.99] | -0.19 | 0.851 - 0 12.0983850 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 16.2161639 - 0 7.9806061 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 20.3339428 - 0 7.9806061 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 24.4517217 - 0 7.9806061 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 28.5695006 - 0 7.9806061 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 0 32.6872795 - 0 7.9806061 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 - 1 -4.3727306 - 0 7.9806061 | 0.44 | 1.23 | [-1.97, 2.84] | 0.36 | 0.721 - 1 -0.2549517 - 0 7.9806061 | 0.33 | 0.92 | [-1.47, 2.14] | 0.36 | 0.717 - 1 3.8628272 - 0 7.9806061 | 0.23 | 0.67 | [-1.09, 1.55] | 0.34 | 0.732 - 1 7.9806061 - 0 7.9806061 | 0.13 | 0.56 | [-0.98, 1.23] | 0.22 | 0.823 - 1 12.0983850 - 0 7.9806061 | 0.02 | 0.67 | [-1.29, 1.33] | 0.03 | 0.973 - 1 16.2161639 - 0 7.9806061 | -0.08 | 0.92 | [-1.88, 1.71] | -0.09 | 0.929 - 1 20.3339428 - 0 7.9806061 | -0.19 | 1.22 | [-2.58, 2.21] | -0.15 | 0.879 - 1 24.4517217 - 0 7.9806061 | -0.29 | 1.55 | [-3.33, 2.75] | -0.19 | 0.852 - 1 28.5695006 - 0 7.9806061 | -0.39 | 1.89 | [-4.11, 3.32] | -0.21 | 0.836 - 1 32.6872795 - 0 7.9806061 | -0.50 | 2.24 | [-4.89, 3.90] | -0.22 | 0.825 - 0 16.2161639 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 20.3339428 - 0 12.0983850 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 24.4517217 - 0 12.0983850 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 28.5695006 - 0 12.0983850 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 32.6872795 - 0 12.0983850 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 1 -4.3727306 - 0 12.0983850 | 0.36 | 1.23 | [-2.04, 2.77] | 0.30 | 0.767 - 1 -0.2549517 - 0 12.0983850 | 0.26 | 0.92 | [-1.54, 2.06] | 0.28 | 0.778 - 1 3.8628272 - 0 12.0983850 | 0.16 | 0.67 | [-1.16, 1.47] | 0.23 | 0.818 - 1 7.9806061 - 0 12.0983850 | 0.05 | 0.57 | [-1.06, 1.16] | 0.09 | 0.928 - 1 12.0983850 - 0 12.0983850 | -0.05 | 0.67 | [-1.37, 1.26] | -0.08 | 0.937 - 1 16.2161639 - 0 12.0983850 | -0.16 | 0.92 | [-1.96, 1.64] | -0.17 | 0.864 - 1 20.3339428 - 0 12.0983850 | -0.26 | 1.22 | [-2.66, 2.14] | -0.21 | 0.831 - 1 24.4517217 - 0 12.0983850 | -0.36 | 1.55 | [-3.41, 2.68] | -0.23 | 0.815 - 1 28.5695006 - 0 12.0983850 | -0.47 | 1.90 | [-4.18, 3.25] | -0.25 | 0.805 - 1 32.6872795 - 0 12.0983850 | -0.57 | 2.24 | [-4.97, 3.83] | -0.25 | 0.799 - 0 20.3339428 - 0 16.2161639 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 24.4517217 - 0 16.2161639 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 28.5695006 - 0 16.2161639 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 32.6872795 - 0 16.2161639 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 1 -4.3727306 - 0 16.2161639 | 0.29 | 1.24 | [-2.15, 2.72] | 0.23 | 0.817 - 1 -0.2549517 - 0 16.2161639 | 0.18 | 0.94 | [-1.66, 2.03] | 0.20 | 0.845 - 1 3.8628272 - 0 16.2161639 | 0.08 | 0.70 | [-1.30, 1.46] | 0.11 | 0.909 - 1 7.9806061 - 0 16.2161639 | -0.02 | 0.60 | [-1.20, 1.16] | -0.04 | 0.968 - 1 12.0983850 - 0 16.2161639 | -0.13 | 0.70 | [-1.51, 1.25] | -0.18 | 0.856 - 1 16.2161639 - 0 16.2161639 | -0.23 | 0.94 | [-2.08, 1.61] | -0.25 | 0.806 - 1 20.3339428 - 0 16.2161639 | -0.34 | 1.24 | [-2.77, 2.10] | -0.27 | 0.787 - 1 24.4517217 - 0 16.2161639 | -0.44 | 1.57 | [-3.51, 2.63] | -0.28 | 0.779 - 1 28.5695006 - 0 16.2161639 | -0.54 | 1.91 | [-4.28, 3.20] | -0.28 | 0.776 - 1 32.6872795 - 0 16.2161639 | -0.65 | 2.25 | [-5.07, 3.77] | -0.29 | 0.774 - 0 24.4517217 - 0 20.3339428 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 28.5695006 - 0 20.3339428 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 32.6872795 - 0 20.3339428 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 1 -4.3727306 - 0 20.3339428 | 0.21 | 1.28 | [-2.29, 2.71] | 0.17 | 0.868 - 1 -0.2549517 - 0 20.3339428 | 0.11 | 0.99 | [-1.82, 2.04] | 0.11 | 0.912 - 1 3.8628272 - 0 20.3339428 | 5.09e-03 | 0.76 | [-1.49, 1.50] | 6.68e-03 | 0.995 - 1 7.9806061 - 0 20.3339428 | -0.10 | 0.67 | [-1.41, 1.22] | -0.15 | 0.883 - 1 12.0983850 - 0 20.3339428 | -0.20 | 0.76 | [-1.70, 1.29] | -0.27 | 0.790 - 1 16.2161639 - 0 20.3339428 | -0.31 | 0.99 | [-2.24, 1.63] | -0.31 | 0.756 - 1 20.3339428 - 0 20.3339428 | -0.41 | 1.28 | [-2.91, 2.09] | -0.32 | 0.748 - 1 24.4517217 - 0 20.3339428 | -0.51 | 1.60 | [-3.64, 2.62] | -0.32 | 0.747 - 1 28.5695006 - 0 20.3339428 | -0.62 | 1.93 | [-4.40, 3.17] | -0.32 | 0.749 - 1 32.6872795 - 0 20.3339428 | -0.72 | 2.27 | [-5.18, 3.74] | -0.32 | 0.751 - 0 28.5695006 - 0 24.4517217 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 32.6872795 - 0 24.4517217 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 1 -4.3727306 - 0 24.4517217 | 0.14 | 1.32 | [-2.46, 2.73] | 0.10 | 0.917 - 1 -0.2549517 - 0 24.4517217 | 0.03 | 1.05 | [-2.02, 2.09] | 0.03 | 0.974 - 1 3.8628272 - 0 24.4517217 | -0.07 | 0.84 | [-1.72, 1.58] | -0.08 | 0.934 - 1 7.9806061 - 0 24.4517217 | -0.17 | 0.76 | [-1.67, 1.32] | -0.23 | 0.819 - 1 12.0983850 - 0 24.4517217 | -0.28 | 0.84 | [-1.93, 1.38] | -0.33 | 0.742 - 1 16.2161639 - 0 24.4517217 | -0.38 | 1.05 | [-2.44, 1.68] | -0.36 | 0.717 - 1 20.3339428 - 0 24.4517217 | -0.49 | 1.33 | [-3.09, 2.12] | -0.37 | 0.715 - 1 24.4517217 - 0 24.4517217 | -0.59 | 1.64 | [-3.80, 2.62] | -0.36 | 0.719 - 1 28.5695006 - 0 24.4517217 | -0.69 | 1.97 | [-4.55, 3.16] | -0.35 | 0.724 - 1 32.6872795 - 0 24.4517217 | -0.80 | 2.30 | [-5.31, 3.72] | -0.35 | 0.729 - 0 32.6872795 - 0 28.5695006 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 1 -4.3727306 - 0 28.5695006 | 0.06 | 1.39 | [-2.66, 2.78] | 0.05 | 0.964 - 1 -0.2549517 - 0 28.5695006 | -0.04 | 1.13 | [-2.25, 2.17] | -0.04 | 0.971 - 1 3.8628272 - 0 28.5695006 | -0.14 | 0.94 | [-1.98, 1.69] | -0.15 | 0.877 - 1 7.9806061 - 0 28.5695006 | -0.25 | 0.87 | [-1.95, 1.45] | -0.29 | 0.774 - 1 12.0983850 - 0 28.5695006 | -0.35 | 0.94 | [-2.20, 1.49] | -0.37 | 0.708 - 1 16.2161639 - 0 28.5695006 | -0.46 | 1.13 | [-2.67, 1.76] | -0.40 | 0.687 - 1 20.3339428 - 0 28.5695006 | -0.56 | 1.39 | [-3.29, 2.17] | -0.40 | 0.687 - 1 24.4517217 - 0 28.5695006 | -0.66 | 1.69 | [-3.98, 2.65] | -0.39 | 0.694 - 1 28.5695006 - 0 28.5695006 | -0.77 | 2.01 | [-4.71, 3.17] | -0.38 | 0.702 - 1 32.6872795 - 0 28.5695006 | -0.87 | 2.34 | [-5.46, 3.72] | -0.37 | 0.710 - 1 -4.3727306 - 0 32.6872795 | -0.01 | 1.46 | [-2.88, 2.85] | -8.26e-03 | 0.993 - 1 -0.2549517 - 0 32.6872795 | -0.12 | 1.22 | [-2.51, 2.27] | -0.10 | 0.924 - 1 3.8628272 - 0 32.6872795 | -0.22 | 1.05 | [-2.27, 1.83] | -0.21 | 0.834 - 1 7.9806061 - 0 32.6872795 | -0.32 | 0.98 | [-2.25, 1.60] | -0.33 | 0.742 - 1 12.0983850 - 0 32.6872795 | -0.43 | 1.05 | [-2.49, 1.63] | -0.41 | 0.684 - 1 16.2161639 - 0 32.6872795 | -0.53 | 1.22 | [-2.93, 1.87] | -0.43 | 0.664 - 1 20.3339428 - 0 32.6872795 | -0.64 | 1.47 | [-3.51, 2.24] | -0.43 | 0.665 - 1 24.4517217 - 0 32.6872795 | -0.74 | 1.75 | [-4.18, 2.70] | -0.42 | 0.674 - 1 28.5695006 - 0 32.6872795 | -0.84 | 2.06 | [-4.89, 3.20] | -0.41 | 0.683 - 1 32.6872795 - 0 32.6872795 | -0.95 | 2.39 | [-5.63, 3.74] | -0.40 | 0.692 - 1 -0.2549517 - 1 -4.3727306 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 3.8628272 - 1 -4.3727306 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 7.9806061 - 1 -4.3727306 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 12.0983850 - 1 -4.3727306 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 16.2161639 - 1 -4.3727306 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 20.3339428 - 1 -4.3727306 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 - 1 24.4517217 - 1 -4.3727306 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 - 1 28.5695006 - 1 -4.3727306 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 - 1 32.6872795 - 1 -4.3727306 | -0.93 | 3.26 | [-7.32, 5.45] | -0.29 | 0.774 - 1 3.8628272 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 7.9806061 - 1 -0.2549517 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 12.0983850 - 1 -0.2549517 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 16.2161639 - 1 -0.2549517 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 20.3339428 - 1 -0.2549517 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 24.4517217 - 1 -0.2549517 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 - 1 28.5695006 - 1 -0.2549517 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 - 1 32.6872795 - 1 -0.2549517 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 - 1 7.9806061 - 1 3.8628272 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 12.0983850 - 1 3.8628272 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 16.2161639 - 1 3.8628272 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 20.3339428 - 1 3.8628272 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 24.4517217 - 1 3.8628272 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 28.5695006 - 1 3.8628272 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 - 1 32.6872795 - 1 3.8628272 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 - 1 12.0983850 - 1 7.9806061 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 16.2161639 - 1 7.9806061 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 20.3339428 - 1 7.9806061 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 24.4517217 - 1 7.9806061 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 28.5695006 - 1 7.9806061 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 32.6872795 - 1 7.9806061 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 - 1 16.2161639 - 1 12.0983850 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 20.3339428 - 1 12.0983850 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 24.4517217 - 1 12.0983850 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 28.5695006 - 1 12.0983850 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 32.6872795 - 1 12.0983850 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 20.3339428 - 1 16.2161639 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 24.4517217 - 1 16.2161639 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 28.5695006 - 1 16.2161639 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 32.6872795 - 1 16.2161639 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 24.4517217 - 1 20.3339428 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 28.5695006 - 1 20.3339428 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 32.6872795 - 1 20.3339428 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 28.5695006 - 1 24.4517217 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 32.6872795 - 1 24.4517217 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 32.6872795 - 1 28.5695006 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - - Variable predicted: outcome - Predictors contrasted: var_binom, var_cont - Predictors averaged: groups - Contrasts are on the link-scale. - -# print hypothesis_test predictions link scale - - Code - print(out) - Output - Model-based Contrasts Analysis - - Parameter | Difference | SE | 95% CI | z | p - ----------------------------------------------------------------------------------- - 0 -0.2549517 - 0 -4.3727306 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 3.8628272 - 0 -4.3727306 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 7.9806061 - 0 -4.3727306 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 12.0983850 - 0 -4.3727306 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 16.2161639 - 0 -4.3727306 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 0 20.3339428 - 0 -4.3727306 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 - 0 24.4517217 - 0 -4.3727306 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 - 0 28.5695006 - 0 -4.3727306 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 - 0 32.6872795 - 0 -4.3727306 | 0.67 | 1.32 | [-1.91, 3.26] | 0.51 | 0.610 - 1 -4.3727306 - 0 -4.3727306 | 0.66 | 1.33 | [-1.94, 3.27] | 0.50 | 0.618 - 1 -0.2549517 - 0 -4.3727306 | 0.56 | 1.05 | [-1.51, 2.62] | 0.53 | 0.596 - 1 3.8628272 - 0 -4.3727306 | 0.45 | 0.84 | [-1.20, 2.11] | 0.54 | 0.590 - 1 7.9806061 - 0 -4.3727306 | 0.35 | 0.76 | [-1.14, 1.84] | 0.46 | 0.644 - 1 12.0983850 - 0 -4.3727306 | 0.25 | 0.84 | [-1.40, 1.89] | 0.29 | 0.768 - 1 16.2161639 - 0 -4.3727306 | 0.14 | 1.05 | [-1.91, 2.19] | 0.14 | 0.891 - 1 20.3339428 - 0 -4.3727306 | 0.04 | 1.32 | [-2.55, 2.63] | 0.03 | 0.976 - 1 24.4517217 - 0 -4.3727306 | -0.06 | 1.63 | [-3.26, 3.13] | -0.04 | 0.968 - 1 28.5695006 - 0 -4.3727306 | -0.17 | 1.96 | [-4.01, 3.67] | -0.09 | 0.931 - 1 32.6872795 - 0 -4.3727306 | -0.27 | 2.30 | [-4.77, 4.23] | -0.12 | 0.906 - 0 3.8628272 - 0 -0.2549517 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 7.9806061 - 0 -0.2549517 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 12.0983850 - 0 -0.2549517 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 16.2161639 - 0 -0.2549517 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 20.3339428 - 0 -0.2549517 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 0 24.4517217 - 0 -0.2549517 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 - 0 28.5695006 - 0 -0.2549517 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 - 0 32.6872795 - 0 -0.2549517 | 0.60 | 1.17 | [-1.70, 2.90] | 0.51 | 0.610 - 1 -4.3727306 - 0 -0.2549517 | 0.59 | 1.28 | [-1.92, 3.10] | 0.46 | 0.646 - 1 -0.2549517 - 0 -0.2549517 | 0.48 | 0.99 | [-1.46, 2.42] | 0.49 | 0.625 - 1 3.8628272 - 0 -0.2549517 | 0.38 | 0.76 | [-1.12, 1.88] | 0.50 | 0.619 - 1 7.9806061 - 0 -0.2549517 | 0.28 | 0.67 | [-1.04, 1.59] | 0.41 | 0.680 - 1 12.0983850 - 0 -0.2549517 | 0.17 | 0.76 | [-1.31, 1.66] | 0.23 | 0.820 - 1 16.2161639 - 0 -0.2549517 | 0.07 | 0.98 | [-1.86, 1.99] | 0.07 | 0.945 - 1 20.3339428 - 0 -0.2549517 | -0.04 | 1.27 | [-2.53, 2.46] | -0.03 | 0.978 - 1 24.4517217 - 0 -0.2549517 | -0.14 | 1.59 | [-3.26, 2.98] | -0.09 | 0.930 - 1 28.5695006 - 0 -0.2549517 | -0.24 | 1.93 | [-4.02, 3.53] | -0.13 | 0.899 - 1 32.6872795 - 0 -0.2549517 | -0.35 | 2.27 | [-4.79, 4.10] | -0.15 | 0.878 - 0 7.9806061 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 12.0983850 - 0 3.8628272 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 16.2161639 - 0 3.8628272 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 20.3339428 - 0 3.8628272 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 24.4517217 - 0 3.8628272 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 0 28.5695006 - 0 3.8628272 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 - 0 32.6872795 - 0 3.8628272 | 0.52 | 1.03 | [-1.49, 2.54] | 0.51 | 0.610 - 1 -4.3727306 - 0 3.8628272 | 0.51 | 1.25 | [-1.93, 2.95] | 0.41 | 0.680 - 1 -0.2549517 - 0 3.8628272 | 0.41 | 0.94 | [-1.44, 2.26] | 0.43 | 0.665 - 1 3.8628272 - 0 3.8628272 | 0.30 | 0.70 | [-1.07, 1.68] | 0.43 | 0.665 - 1 7.9806061 - 0 3.8628272 | 0.20 | 0.60 | [-0.98, 1.38] | 0.33 | 0.738 - 1 12.0983850 - 0 3.8628272 | 0.10 | 0.70 | [-1.28, 1.47] | 0.14 | 0.890 - 1 16.2161639 - 0 3.8628272 | -6.65e-03 | 0.94 | [-1.85, 1.83] | -7.09e-03 | 0.994 - 1 20.3339428 - 0 3.8628272 | -0.11 | 1.24 | [-2.54, 2.32] | -0.09 | 0.929 - 1 24.4517217 - 0 3.8628272 | -0.21 | 1.56 | [-3.28, 2.85] | -0.14 | 0.891 - 1 28.5695006 - 0 3.8628272 | -0.32 | 1.90 | [-4.05, 3.41] | -0.17 | 0.867 - 1 32.6872795 - 0 3.8628272 | -0.42 | 2.25 | [-4.83, 3.99] | -0.19 | 0.851 - 0 12.0983850 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 16.2161639 - 0 7.9806061 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 20.3339428 - 0 7.9806061 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 24.4517217 - 0 7.9806061 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 28.5695006 - 0 7.9806061 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 0 32.6872795 - 0 7.9806061 | 0.45 | 0.88 | [-1.28, 2.18] | 0.51 | 0.610 - 1 -4.3727306 - 0 7.9806061 | 0.44 | 1.23 | [-1.97, 2.84] | 0.36 | 0.721 - 1 -0.2549517 - 0 7.9806061 | 0.33 | 0.92 | [-1.47, 2.14] | 0.36 | 0.717 - 1 3.8628272 - 0 7.9806061 | 0.23 | 0.67 | [-1.09, 1.55] | 0.34 | 0.732 - 1 7.9806061 - 0 7.9806061 | 0.13 | 0.56 | [-0.98, 1.23] | 0.22 | 0.823 - 1 12.0983850 - 0 7.9806061 | 0.02 | 0.67 | [-1.29, 1.33] | 0.03 | 0.973 - 1 16.2161639 - 0 7.9806061 | -0.08 | 0.92 | [-1.88, 1.71] | -0.09 | 0.929 - 1 20.3339428 - 0 7.9806061 | -0.19 | 1.22 | [-2.58, 2.21] | -0.15 | 0.879 - 1 24.4517217 - 0 7.9806061 | -0.29 | 1.55 | [-3.33, 2.75] | -0.19 | 0.852 - 1 28.5695006 - 0 7.9806061 | -0.39 | 1.89 | [-4.11, 3.32] | -0.21 | 0.836 - 1 32.6872795 - 0 7.9806061 | -0.50 | 2.24 | [-4.89, 3.90] | -0.22 | 0.825 - 0 16.2161639 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 20.3339428 - 0 12.0983850 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 24.4517217 - 0 12.0983850 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 28.5695006 - 0 12.0983850 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 0 32.6872795 - 0 12.0983850 | 0.37 | 0.73 | [-1.06, 1.81] | 0.51 | 0.610 - 1 -4.3727306 - 0 12.0983850 | 0.36 | 1.23 | [-2.04, 2.77] | 0.30 | 0.767 - 1 -0.2549517 - 0 12.0983850 | 0.26 | 0.92 | [-1.54, 2.06] | 0.28 | 0.778 - 1 3.8628272 - 0 12.0983850 | 0.16 | 0.67 | [-1.16, 1.47] | 0.23 | 0.818 - 1 7.9806061 - 0 12.0983850 | 0.05 | 0.57 | [-1.06, 1.16] | 0.09 | 0.928 - 1 12.0983850 - 0 12.0983850 | -0.05 | 0.67 | [-1.37, 1.26] | -0.08 | 0.937 - 1 16.2161639 - 0 12.0983850 | -0.16 | 0.92 | [-1.96, 1.64] | -0.17 | 0.864 - 1 20.3339428 - 0 12.0983850 | -0.26 | 1.22 | [-2.66, 2.14] | -0.21 | 0.831 - 1 24.4517217 - 0 12.0983850 | -0.36 | 1.55 | [-3.41, 2.68] | -0.23 | 0.815 - 1 28.5695006 - 0 12.0983850 | -0.47 | 1.90 | [-4.18, 3.25] | -0.25 | 0.805 - 1 32.6872795 - 0 12.0983850 | -0.57 | 2.24 | [-4.97, 3.83] | -0.25 | 0.799 - 0 20.3339428 - 0 16.2161639 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 24.4517217 - 0 16.2161639 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 28.5695006 - 0 16.2161639 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 0 32.6872795 - 0 16.2161639 | 0.30 | 0.59 | [-0.85, 1.45] | 0.51 | 0.610 - 1 -4.3727306 - 0 16.2161639 | 0.29 | 1.24 | [-2.15, 2.72] | 0.23 | 0.817 - 1 -0.2549517 - 0 16.2161639 | 0.18 | 0.94 | [-1.66, 2.03] | 0.20 | 0.845 - 1 3.8628272 - 0 16.2161639 | 0.08 | 0.70 | [-1.30, 1.46] | 0.11 | 0.909 - 1 7.9806061 - 0 16.2161639 | -0.02 | 0.60 | [-1.20, 1.16] | -0.04 | 0.968 - 1 12.0983850 - 0 16.2161639 | -0.13 | 0.70 | [-1.51, 1.25] | -0.18 | 0.856 - 1 16.2161639 - 0 16.2161639 | -0.23 | 0.94 | [-2.08, 1.61] | -0.25 | 0.806 - 1 20.3339428 - 0 16.2161639 | -0.34 | 1.24 | [-2.77, 2.10] | -0.27 | 0.787 - 1 24.4517217 - 0 16.2161639 | -0.44 | 1.57 | [-3.51, 2.63] | -0.28 | 0.779 - 1 28.5695006 - 0 16.2161639 | -0.54 | 1.91 | [-4.28, 3.20] | -0.28 | 0.776 - 1 32.6872795 - 0 16.2161639 | -0.65 | 2.25 | [-5.07, 3.77] | -0.29 | 0.774 - 0 24.4517217 - 0 20.3339428 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 28.5695006 - 0 20.3339428 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 0 32.6872795 - 0 20.3339428 | 0.22 | 0.44 | [-0.64, 1.09] | 0.51 | 0.610 - 1 -4.3727306 - 0 20.3339428 | 0.21 | 1.28 | [-2.29, 2.71] | 0.17 | 0.868 - 1 -0.2549517 - 0 20.3339428 | 0.11 | 0.99 | [-1.82, 2.04] | 0.11 | 0.912 - 1 3.8628272 - 0 20.3339428 | 5.09e-03 | 0.76 | [-1.49, 1.50] | 6.68e-03 | 0.995 - 1 7.9806061 - 0 20.3339428 | -0.10 | 0.67 | [-1.41, 1.22] | -0.15 | 0.883 - 1 12.0983850 - 0 20.3339428 | -0.20 | 0.76 | [-1.70, 1.29] | -0.27 | 0.790 - 1 16.2161639 - 0 20.3339428 | -0.31 | 0.99 | [-2.24, 1.63] | -0.31 | 0.756 - 1 20.3339428 - 0 20.3339428 | -0.41 | 1.28 | [-2.91, 2.09] | -0.32 | 0.748 - 1 24.4517217 - 0 20.3339428 | -0.51 | 1.60 | [-3.64, 2.62] | -0.32 | 0.747 - 1 28.5695006 - 0 20.3339428 | -0.62 | 1.93 | [-4.40, 3.17] | -0.32 | 0.749 - 1 32.6872795 - 0 20.3339428 | -0.72 | 2.27 | [-5.18, 3.74] | -0.32 | 0.751 - 0 28.5695006 - 0 24.4517217 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 32.6872795 - 0 24.4517217 | 0.15 | 0.29 | [-0.43, 0.73] | 0.51 | 0.610 - 1 -4.3727306 - 0 24.4517217 | 0.14 | 1.32 | [-2.46, 2.73] | 0.10 | 0.917 - 1 -0.2549517 - 0 24.4517217 | 0.03 | 1.05 | [-2.02, 2.09] | 0.03 | 0.974 - 1 3.8628272 - 0 24.4517217 | -0.07 | 0.84 | [-1.72, 1.58] | -0.08 | 0.934 - 1 7.9806061 - 0 24.4517217 | -0.17 | 0.76 | [-1.67, 1.32] | -0.23 | 0.819 - 1 12.0983850 - 0 24.4517217 | -0.28 | 0.84 | [-1.93, 1.38] | -0.33 | 0.742 - 1 16.2161639 - 0 24.4517217 | -0.38 | 1.05 | [-2.44, 1.68] | -0.36 | 0.717 - 1 20.3339428 - 0 24.4517217 | -0.49 | 1.33 | [-3.09, 2.12] | -0.37 | 0.715 - 1 24.4517217 - 0 24.4517217 | -0.59 | 1.64 | [-3.80, 2.62] | -0.36 | 0.719 - 1 28.5695006 - 0 24.4517217 | -0.69 | 1.97 | [-4.55, 3.16] | -0.35 | 0.724 - 1 32.6872795 - 0 24.4517217 | -0.80 | 2.30 | [-5.31, 3.72] | -0.35 | 0.729 - 0 32.6872795 - 0 28.5695006 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 1 -4.3727306 - 0 28.5695006 | 0.06 | 1.39 | [-2.66, 2.78] | 0.05 | 0.964 - 1 -0.2549517 - 0 28.5695006 | -0.04 | 1.13 | [-2.25, 2.17] | -0.04 | 0.971 - 1 3.8628272 - 0 28.5695006 | -0.14 | 0.94 | [-1.98, 1.69] | -0.15 | 0.877 - 1 7.9806061 - 0 28.5695006 | -0.25 | 0.87 | [-1.95, 1.45] | -0.29 | 0.774 - 1 12.0983850 - 0 28.5695006 | -0.35 | 0.94 | [-2.20, 1.49] | -0.37 | 0.708 - 1 16.2161639 - 0 28.5695006 | -0.46 | 1.13 | [-2.67, 1.76] | -0.40 | 0.687 - 1 20.3339428 - 0 28.5695006 | -0.56 | 1.39 | [-3.29, 2.17] | -0.40 | 0.687 - 1 24.4517217 - 0 28.5695006 | -0.66 | 1.69 | [-3.98, 2.65] | -0.39 | 0.694 - 1 28.5695006 - 0 28.5695006 | -0.77 | 2.01 | [-4.71, 3.17] | -0.38 | 0.702 - 1 32.6872795 - 0 28.5695006 | -0.87 | 2.34 | [-5.46, 3.72] | -0.37 | 0.710 - 1 -4.3727306 - 0 32.6872795 | -0.01 | 1.46 | [-2.88, 2.85] | -8.26e-03 | 0.993 - 1 -0.2549517 - 0 32.6872795 | -0.12 | 1.22 | [-2.51, 2.27] | -0.10 | 0.924 - 1 3.8628272 - 0 32.6872795 | -0.22 | 1.05 | [-2.27, 1.83] | -0.21 | 0.834 - 1 7.9806061 - 0 32.6872795 | -0.32 | 0.98 | [-2.25, 1.60] | -0.33 | 0.742 - 1 12.0983850 - 0 32.6872795 | -0.43 | 1.05 | [-2.49, 1.63] | -0.41 | 0.684 - 1 16.2161639 - 0 32.6872795 | -0.53 | 1.22 | [-2.93, 1.87] | -0.43 | 0.664 - 1 20.3339428 - 0 32.6872795 | -0.64 | 1.47 | [-3.51, 2.24] | -0.43 | 0.665 - 1 24.4517217 - 0 32.6872795 | -0.74 | 1.75 | [-4.18, 2.70] | -0.42 | 0.674 - 1 28.5695006 - 0 32.6872795 | -0.84 | 2.06 | [-4.89, 3.20] | -0.41 | 0.683 - 1 32.6872795 - 0 32.6872795 | -0.95 | 2.39 | [-5.63, 3.74] | -0.40 | 0.692 - 1 -0.2549517 - 1 -4.3727306 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 3.8628272 - 1 -4.3727306 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 7.9806061 - 1 -4.3727306 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 12.0983850 - 1 -4.3727306 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 16.2161639 - 1 -4.3727306 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 20.3339428 - 1 -4.3727306 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 - 1 24.4517217 - 1 -4.3727306 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 - 1 28.5695006 - 1 -4.3727306 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 - 1 32.6872795 - 1 -4.3727306 | -0.93 | 3.26 | [-7.32, 5.45] | -0.29 | 0.774 - 1 3.8628272 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 7.9806061 - 1 -0.2549517 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 12.0983850 - 1 -0.2549517 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 16.2161639 - 1 -0.2549517 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 20.3339428 - 1 -0.2549517 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 24.4517217 - 1 -0.2549517 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 - 1 28.5695006 - 1 -0.2549517 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 - 1 32.6872795 - 1 -0.2549517 | -0.83 | 2.90 | [-6.51, 4.85] | -0.29 | 0.774 - 1 7.9806061 - 1 3.8628272 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 12.0983850 - 1 3.8628272 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 16.2161639 - 1 3.8628272 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 20.3339428 - 1 3.8628272 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 24.4517217 - 1 3.8628272 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 28.5695006 - 1 3.8628272 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 - 1 32.6872795 - 1 3.8628272 | -0.73 | 2.53 | [-5.70, 4.24] | -0.29 | 0.774 - 1 12.0983850 - 1 7.9806061 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 16.2161639 - 1 7.9806061 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 20.3339428 - 1 7.9806061 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 24.4517217 - 1 7.9806061 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 28.5695006 - 1 7.9806061 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 32.6872795 - 1 7.9806061 | -0.62 | 2.17 | [-4.88, 3.64] | -0.29 | 0.774 - 1 16.2161639 - 1 12.0983850 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 20.3339428 - 1 12.0983850 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 24.4517217 - 1 12.0983850 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 28.5695006 - 1 12.0983850 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 32.6872795 - 1 12.0983850 | -0.52 | 1.81 | [-4.07, 3.03] | -0.29 | 0.774 - 1 20.3339428 - 1 16.2161639 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 24.4517217 - 1 16.2161639 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 28.5695006 - 1 16.2161639 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 32.6872795 - 1 16.2161639 | -0.42 | 1.45 | [-3.25, 2.42] | -0.29 | 0.774 - 1 24.4517217 - 1 20.3339428 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 28.5695006 - 1 20.3339428 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 32.6872795 - 1 20.3339428 | -0.31 | 1.09 | [-2.44, 1.82] | -0.29 | 0.774 - 1 28.5695006 - 1 24.4517217 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - 1 32.6872795 - 1 24.4517217 | -0.21 | 0.72 | [-1.63, 1.21] | -0.29 | 0.774 - 1 32.6872795 - 1 28.5695006 | -0.10 | 0.36 | [-0.81, 0.61] | -0.29 | 0.774 - - Variable predicted: outcome - Predictors contrasted: var_binom, var_cont - Predictors averaged: groups - Contrasts are on the link-scale. - -# print hypothesis_test contrasts response scale - - Code - print(out) - Output - Model-based Contrasts Analysis - - Parameter | Difference | SE | 95% CI | z | p - ----------------------------------------------------------------------------------- - 0 -0.2549517 - 0 -4.3727306 | 0.02 | 0.03 | [-0.05, 0.09] | 0.53 | 0.597 - 0 3.8628272 - 0 -4.3727306 | 0.04 | 0.07 | [-0.10, 0.17] | 0.52 | 0.601 - 0 7.9806061 - 0 -4.3727306 | 0.06 | 0.11 | [-0.15, 0.26] | 0.52 | 0.603 - 0 12.0983850 - 0 -4.3727306 | 0.07 | 0.14 | [-0.21, 0.35] | 0.52 | 0.605 - 0 16.2161639 - 0 -4.3727306 | 0.09 | 0.18 | [-0.26, 0.44] | 0.52 | 0.606 - 0 20.3339428 - 0 -4.3727306 | 0.11 | 0.22 | [-0.31, 0.53] | 0.51 | 0.607 - 0 24.4517217 - 0 -4.3727306 | 0.13 | 0.25 | [-0.36, 0.62] | 0.52 | 0.606 - 0 28.5695006 - 0 -4.3727306 | 0.15 | 0.29 | [-0.41, 0.71] | 0.52 | 0.606 - 0 32.6872795 - 0 -4.3727306 | 0.17 | 0.32 | [-0.46, 0.80] | 0.52 | 0.604 - 1 -4.3727306 - 0 -4.3727306 | 0.16 | 0.33 | [-0.47, 0.80] | 0.50 | 0.615 - 1 -0.2549517 - 0 -4.3727306 | 0.14 | 0.26 | [-0.37, 0.65] | 0.53 | 0.594 - 1 3.8628272 - 0 -4.3727306 | 0.11 | 0.21 | [-0.30, 0.52] | 0.54 | 0.589 - 1 7.9806061 - 0 -4.3727306 | 0.09 | 0.19 | [-0.28, 0.45] | 0.46 | 0.643 - 1 12.0983850 - 0 -4.3727306 | 0.06 | 0.21 | [-0.34, 0.46] | 0.29 | 0.769 - 1 16.2161639 - 0 -4.3727306 | 0.03 | 0.26 | [-0.47, 0.54] | 0.14 | 0.892 - 1 20.3339428 - 0 -4.3727306 | 9.51e-03 | 0.32 | [-0.62, 0.64] | 0.03 | 0.976 - 1 24.4517217 - 0 -4.3727306 | -0.02 | 0.39 | [-0.77, 0.74] | -0.04 | 0.968 - 1 28.5695006 - 0 -4.3727306 | -0.04 | 0.45 | [-0.93, 0.85] | -0.09 | 0.930 - 1 32.6872795 - 0 -4.3727306 | -0.06 | 0.52 | [-1.07, 0.95] | -0.12 | 0.902 - 0 3.8628272 - 0 -0.2549517 | 0.02 | 0.04 | [-0.05, 0.09] | 0.52 | 0.604 - 0 7.9806061 - 0 -0.2549517 | 0.04 | 0.07 | [-0.10, 0.18] | 0.52 | 0.606 - 0 12.0983850 - 0 -0.2549517 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.607 - 0 16.2161639 - 0 -0.2549517 | 0.07 | 0.14 | [-0.21, 0.36] | 0.51 | 0.608 - 0 20.3339428 - 0 -0.2549517 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.608 - 0 24.4517217 - 0 -0.2549517 | 0.11 | 0.22 | [-0.32, 0.54] | 0.51 | 0.608 - 0 28.5695006 - 0 -0.2549517 | 0.13 | 0.25 | [-0.37, 0.63] | 0.51 | 0.607 - 0 32.6872795 - 0 -0.2549517 | 0.15 | 0.29 | [-0.41, 0.71] | 0.52 | 0.605 - 1 -4.3727306 - 0 -0.2549517 | 0.15 | 0.31 | [-0.47, 0.76] | 0.46 | 0.643 - 1 -0.2549517 - 0 -0.2549517 | 0.12 | 0.25 | [-0.36, 0.60] | 0.49 | 0.624 - 1 3.8628272 - 0 -0.2549517 | 0.09 | 0.19 | [-0.28, 0.47] | 0.50 | 0.619 - 1 7.9806061 - 0 -0.2549517 | 0.07 | 0.17 | [-0.26, 0.39] | 0.41 | 0.681 - 1 12.0983850 - 0 -0.2549517 | 0.04 | 0.19 | [-0.33, 0.41] | 0.23 | 0.821 - 1 16.2161639 - 0 -0.2549517 | 0.02 | 0.24 | [-0.46, 0.49] | 0.07 | 0.945 - 1 20.3339428 - 0 -0.2549517 | -8.63e-03 | 0.31 | [-0.61, 0.59] | -0.03 | 0.978 - 1 24.4517217 - 0 -0.2549517 | -0.03 | 0.38 | [-0.77, 0.71] | -0.09 | 0.929 - 1 28.5695006 - 0 -0.2549517 | -0.06 | 0.45 | [-0.93, 0.82] | -0.13 | 0.897 - 1 32.6872795 - 0 -0.2549517 | -0.08 | 0.51 | [-1.08, 0.92] | -0.16 | 0.873 - 0 7.9806061 - 0 3.8628272 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.608 - 0 12.0983850 - 0 3.8628272 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.609 - 0 16.2161639 - 0 3.8628272 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 - 0 20.3339428 - 0 3.8628272 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.610 - 0 24.4517217 - 0 3.8628272 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.609 - 0 28.5695006 - 0 3.8628272 | 0.11 | 0.22 | [-0.31, 0.54] | 0.51 | 0.607 - 0 32.6872795 - 0 3.8628272 | 0.13 | 0.25 | [-0.36, 0.62] | 0.52 | 0.605 - 1 -4.3727306 - 0 3.8628272 | 0.13 | 0.31 | [-0.47, 0.73] | 0.42 | 0.677 - 1 -0.2549517 - 0 3.8628272 | 0.10 | 0.23 | [-0.36, 0.56] | 0.43 | 0.664 - 1 3.8628272 - 0 3.8628272 | 0.08 | 0.18 | [-0.27, 0.42] | 0.43 | 0.665 - 1 7.9806061 - 0 3.8628272 | 0.05 | 0.15 | [-0.24, 0.34] | 0.33 | 0.739 - 1 12.0983850 - 0 3.8628272 | 0.02 | 0.17 | [-0.32, 0.36] | 0.14 | 0.890 - 1 16.2161639 - 0 3.8628272 | -1.64e-03 | 0.23 | [-0.45, 0.45] | -7.09e-03 | 0.994 - 1 20.3339428 - 0 3.8628272 | -0.03 | 0.30 | [-0.61, 0.56] | -0.09 | 0.928 - 1 24.4517217 - 0 3.8628272 | -0.05 | 0.37 | [-0.78, 0.68] | -0.14 | 0.889 - 1 28.5695006 - 0 3.8628272 | -0.08 | 0.44 | [-0.94, 0.79] | -0.17 | 0.863 - 1 32.6872795 - 0 3.8628272 | -0.10 | 0.50 | [-1.09, 0.89] | -0.20 | 0.843 - 0 12.0983850 - 0 7.9806061 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.610 - 0 16.2161639 - 0 7.9806061 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.611 - 0 20.3339428 - 0 7.9806061 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 - 0 24.4517217 - 0 7.9806061 | 0.07 | 0.15 | [-0.21, 0.36] | 0.51 | 0.609 - 0 28.5695006 - 0 7.9806061 | 0.09 | 0.18 | [-0.26, 0.45] | 0.51 | 0.607 - 0 32.6872795 - 0 7.9806061 | 0.11 | 0.22 | [-0.31, 0.54] | 0.52 | 0.605 - 1 -4.3727306 - 0 7.9806061 | 0.11 | 0.30 | [-0.48, 0.70] | 0.36 | 0.718 - 1 -0.2549517 - 0 7.9806061 | 0.08 | 0.23 | [-0.36, 0.53] | 0.36 | 0.716 - 1 3.8628272 - 0 7.9806061 | 0.06 | 0.17 | [-0.27, 0.39] | 0.34 | 0.733 - 1 7.9806061 - 0 7.9806061 | 0.03 | 0.14 | [-0.25, 0.31] | 0.22 | 0.824 - 1 12.0983850 - 0 7.9806061 | 5.53e-03 | 0.17 | [-0.32, 0.33] | 0.03 | 0.974 - 1 16.2161639 - 0 7.9806061 | -0.02 | 0.23 | [-0.46, 0.42] | -0.09 | 0.929 - 1 20.3339428 - 0 7.9806061 | -0.05 | 0.30 | [-0.63, 0.53] | -0.15 | 0.878 - 1 24.4517217 - 0 7.9806061 | -0.07 | 0.37 | [-0.79, 0.65] | -0.19 | 0.848 - 1 28.5695006 - 0 7.9806061 | -0.09 | 0.44 | [-0.95, 0.76] | -0.22 | 0.829 - 1 32.6872795 - 0 7.9806061 | -0.12 | 0.50 | [-1.10, 0.87] | -0.24 | 0.814 - 0 16.2161639 - 0 12.0983850 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.611 - 0 20.3339428 - 0 12.0983850 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.610 - 0 24.4517217 - 0 12.0983850 | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.608 - 0 28.5695006 - 0 12.0983850 | 0.07 | 0.15 | [-0.21, 0.36] | 0.52 | 0.606 - 0 32.6872795 - 0 12.0983850 | 0.09 | 0.18 | [-0.26, 0.45] | 0.52 | 0.603 - 1 -4.3727306 - 0 12.0983850 | 0.09 | 0.30 | [-0.50, 0.68] | 0.30 | 0.764 - 1 -0.2549517 - 0 12.0983850 | 0.06 | 0.23 | [-0.38, 0.51] | 0.28 | 0.777 - 1 3.8628272 - 0 12.0983850 | 0.04 | 0.17 | [-0.29, 0.37] | 0.23 | 0.818 - 1 7.9806061 - 0 12.0983850 | 0.01 | 0.14 | [-0.26, 0.29] | 0.09 | 0.928 - 1 12.0983850 - 0 12.0983850 | -0.01 | 0.17 | [-0.34, 0.31] | -0.08 | 0.937 - 1 16.2161639 - 0 12.0983850 | -0.04 | 0.23 | [-0.48, 0.40] | -0.17 | 0.864 - 1 20.3339428 - 0 12.0983850 | -0.06 | 0.30 | [-0.64, 0.52] | -0.22 | 0.829 - 1 24.4517217 - 0 12.0983850 | -0.09 | 0.37 | [-0.81, 0.63] | -0.24 | 0.809 - 1 28.5695006 - 0 12.0983850 | -0.11 | 0.44 | [-0.97, 0.75] | -0.26 | 0.796 - 1 32.6872795 - 0 12.0983850 | -0.14 | 0.50 | [-1.12, 0.85] | -0.27 | 0.785 - 0 20.3339428 - 0 16.2161639 | 0.02 | 0.04 | [-0.05, 0.09] | 0.51 | 0.609 - 0 24.4517217 - 0 16.2161639 | 0.04 | 0.07 | [-0.11, 0.18] | 0.51 | 0.607 - 0 28.5695006 - 0 16.2161639 | 0.06 | 0.11 | [-0.16, 0.27] | 0.52 | 0.605 - 0 32.6872795 - 0 16.2161639 | 0.07 | 0.14 | [-0.21, 0.35] | 0.52 | 0.601 - 1 -4.3727306 - 0 16.2161639 | 0.07 | 0.31 | [-0.53, 0.67] | 0.23 | 0.815 - 1 -0.2549517 - 0 16.2161639 | 0.05 | 0.23 | [-0.41, 0.51] | 0.20 | 0.845 - 1 3.8628272 - 0 16.2161639 | 0.02 | 0.18 | [-0.32, 0.36] | 0.11 | 0.909 - 1 7.9806061 - 0 16.2161639 | -5.95e-03 | 0.15 | [-0.30, 0.29] | -0.04 | 0.968 - 1 12.0983850 - 0 16.2161639 | -0.03 | 0.17 | [-0.37, 0.31] | -0.18 | 0.855 - 1 16.2161639 - 0 16.2161639 | -0.06 | 0.23 | [-0.51, 0.40] | -0.25 | 0.804 - 1 20.3339428 - 0 16.2161639 | -0.08 | 0.30 | [-0.67, 0.51] | -0.28 | 0.783 - 1 24.4517217 - 0 16.2161639 | -0.11 | 0.37 | [-0.84, 0.62] | -0.29 | 0.772 - 1 28.5695006 - 0 16.2161639 | -0.13 | 0.44 | [-1.00, 0.73] | -0.30 | 0.765 - 1 32.6872795 - 0 16.2161639 | -0.16 | 0.51 | [-1.15, 0.84] | -0.31 | 0.758 - 0 24.4517217 - 0 20.3339428 | 0.02 | 0.04 | [-0.05, 0.09] | 0.52 | 0.605 - 0 28.5695006 - 0 20.3339428 | 0.04 | 0.07 | [-0.10, 0.18] | 0.52 | 0.602 - 0 32.6872795 - 0 20.3339428 | 0.06 | 0.11 | [-0.15, 0.26] | 0.53 | 0.599 - 1 -4.3727306 - 0 20.3339428 | 0.05 | 0.31 | [-0.56, 0.67] | 0.17 | 0.866 - 1 -0.2549517 - 0 20.3339428 | 0.03 | 0.25 | [-0.45, 0.51] | 0.11 | 0.912 - 1 3.8628272 - 0 20.3339428 | 1.27e-03 | 0.19 | [-0.37, 0.37] | 6.68e-03 | 0.995 - 1 7.9806061 - 0 20.3339428 | -0.02 | 0.17 | [-0.35, 0.30] | -0.15 | 0.883 - 1 12.0983850 - 0 20.3339428 | -0.05 | 0.19 | [-0.42, 0.32] | -0.27 | 0.790 - 1 16.2161639 - 0 20.3339428 | -0.08 | 0.24 | [-0.55, 0.40] | -0.31 | 0.754 - 1 20.3339428 - 0 20.3339428 | -0.10 | 0.31 | [-0.71, 0.51] | -0.33 | 0.743 - 1 24.4517217 - 0 20.3339428 | -0.13 | 0.38 | [-0.87, 0.62] | -0.33 | 0.739 - 1 28.5695006 - 0 20.3339428 | -0.15 | 0.45 | [-1.03, 0.73] | -0.34 | 0.736 - 1 32.6872795 - 0 20.3339428 | -0.17 | 0.51 | [-1.18, 0.83] | -0.34 | 0.733 - 0 28.5695006 - 0 24.4517217 | 0.02 | 0.04 | [-0.05, 0.09] | 0.53 | 0.599 - 0 32.6872795 - 0 24.4517217 | 0.04 | 0.07 | [-0.10, 0.17] | 0.53 | 0.595 - 1 -4.3727306 - 0 24.4517217 | 0.03 | 0.33 | [-0.61, 0.67] | 0.10 | 0.917 - 1 -0.2549517 - 0 24.4517217 | 8.46e-03 | 0.26 | [-0.50, 0.52] | 0.03 | 0.974 - 1 3.8628272 - 0 24.4517217 | -0.02 | 0.21 | [-0.43, 0.39] | -0.08 | 0.934 - 1 7.9806061 - 0 24.4517217 | -0.04 | 0.19 | [-0.42, 0.33] | -0.23 | 0.819 - 1 12.0983850 - 0 24.4517217 | -0.07 | 0.21 | [-0.48, 0.34] | -0.33 | 0.741 - 1 16.2161639 - 0 24.4517217 | -0.09 | 0.26 | [-0.60, 0.41] | -0.37 | 0.715 - 1 20.3339428 - 0 24.4517217 | -0.12 | 0.32 | [-0.75, 0.51] | -0.37 | 0.710 - 1 24.4517217 - 0 24.4517217 | -0.15 | 0.39 | [-0.91, 0.62] | -0.37 | 0.710 - 1 28.5695006 - 0 24.4517217 | -0.17 | 0.46 | [-1.07, 0.73] | -0.37 | 0.711 - 1 32.6872795 - 0 24.4517217 | -0.19 | 0.52 | [-1.21, 0.82] | -0.37 | 0.710 - 0 32.6872795 - 0 28.5695006 | 0.02 | 0.03 | [-0.05, 0.09] | 0.54 | 0.591 - 1 -4.3727306 - 0 28.5695006 | 0.02 | 0.34 | [-0.65, 0.69] | 0.05 | 0.964 - 1 -0.2549517 - 0 28.5695006 | -0.01 | 0.28 | [-0.56, 0.54] | -0.04 | 0.971 - 1 3.8628272 - 0 28.5695006 | -0.04 | 0.23 | [-0.49, 0.42] | -0.15 | 0.877 - 1 7.9806061 - 0 28.5695006 | -0.06 | 0.22 | [-0.48, 0.36] | -0.29 | 0.773 - 1 12.0983850 - 0 28.5695006 | -0.09 | 0.23 | [-0.55, 0.37] | -0.38 | 0.706 - 1 16.2161639 - 0 28.5695006 | -0.11 | 0.28 | [-0.66, 0.43] | -0.41 | 0.684 - 1 20.3339428 - 0 28.5695006 | -0.14 | 0.34 | [-0.80, 0.53] | -0.41 | 0.682 - 1 24.4517217 - 0 28.5695006 | -0.16 | 0.40 | [-0.96, 0.63] | -0.41 | 0.685 - 1 28.5695006 - 0 28.5695006 | -0.19 | 0.47 | [-1.11, 0.73] | -0.40 | 0.688 - 1 32.6872795 - 0 28.5695006 | -0.21 | 0.53 | [-1.25, 0.83] | -0.40 | 0.689 - 1 -4.3727306 - 0 32.6872795 | -2.96e-03 | 0.36 | [-0.71, 0.70] | -8.25e-03 | 0.993 - 1 -0.2549517 - 0 32.6872795 | -0.03 | 0.30 | [-0.62, 0.56] | -0.10 | 0.924 - 1 3.8628272 - 0 32.6872795 | -0.05 | 0.26 | [-0.56, 0.45] | -0.21 | 0.833 - 1 7.9806061 - 0 32.6872795 | -0.08 | 0.24 | [-0.56, 0.39] | -0.33 | 0.740 - 1 12.0983850 - 0 32.6872795 | -0.11 | 0.26 | [-0.61, 0.40] | -0.41 | 0.681 - 1 16.2161639 - 0 32.6872795 | -0.13 | 0.30 | [-0.72, 0.46] | -0.44 | 0.660 - 1 20.3339428 - 0 32.6872795 | -0.16 | 0.36 | [-0.86, 0.54] | -0.44 | 0.659 - 1 24.4517217 - 0 32.6872795 | -0.18 | 0.42 | [-1.00, 0.64] | -0.43 | 0.664 - 1 28.5695006 - 0 32.6872795 | -0.21 | 0.48 | [-1.15, 0.74] | -0.43 | 0.668 - 1 32.6872795 - 0 32.6872795 | -0.23 | 0.54 | [-1.29, 0.83] | -0.43 | 0.671 - 1 -0.2549517 - 1 -4.3727306 | -0.03 | 0.09 | [-0.20, 0.14] | -0.29 | 0.768 - 1 3.8628272 - 1 -4.3727306 | -0.05 | 0.18 | [-0.40, 0.29] | -0.29 | 0.770 - 1 7.9806061 - 1 -4.3727306 | -0.08 | 0.27 | [-0.60, 0.45] | -0.29 | 0.772 - 1 12.0983850 - 1 -4.3727306 | -0.10 | 0.36 | [-0.80, 0.60] | -0.29 | 0.772 - 1 16.2161639 - 1 -4.3727306 | -0.13 | 0.45 | [-1.00, 0.74] | -0.29 | 0.772 - 1 20.3339428 - 1 -4.3727306 | -0.15 | 0.53 | [-1.19, 0.88] | -0.29 | 0.771 - 1 24.4517217 - 1 -4.3727306 | -0.18 | 0.61 | [-1.38, 1.02] | -0.29 | 0.769 - 1 28.5695006 - 1 -4.3727306 | -0.20 | 0.68 | [-1.55, 1.14] | -0.30 | 0.766 - 1 32.6872795 - 1 -4.3727306 | -0.23 | 0.75 | [-1.70, 1.25] | -0.30 | 0.763 - 1 3.8628272 - 1 -0.2549517 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.772 - 1 7.9806061 - 1 -0.2549517 | -0.05 | 0.18 | [-0.40, 0.30] | -0.29 | 0.773 - 1 12.0983850 - 1 -0.2549517 | -0.08 | 0.27 | [-0.61, 0.45] | -0.29 | 0.773 - 1 16.2161639 - 1 -0.2549517 | -0.10 | 0.36 | [-0.81, 0.60] | -0.29 | 0.773 - 1 20.3339428 - 1 -0.2549517 | -0.13 | 0.44 | [-1.00, 0.74] | -0.29 | 0.771 - 1 24.4517217 - 1 -0.2549517 | -0.15 | 0.52 | [-1.18, 0.87] | -0.29 | 0.769 - 1 28.5695006 - 1 -0.2549517 | -0.18 | 0.60 | [-1.35, 0.99] | -0.30 | 0.766 - 1 32.6872795 - 1 -0.2549517 | -0.20 | 0.67 | [-1.51, 1.10] | -0.30 | 0.762 - 1 7.9806061 - 1 3.8628272 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.774 - 1 12.0983850 - 1 3.8628272 | -0.05 | 0.18 | [-0.41, 0.30] | -0.29 | 0.774 - 1 16.2161639 - 1 3.8628272 | -0.08 | 0.27 | [-0.60, 0.45] | -0.29 | 0.773 - 1 20.3339428 - 1 3.8628272 | -0.10 | 0.35 | [-0.80, 0.59] | -0.29 | 0.771 - 1 24.4517217 - 1 3.8628272 | -0.13 | 0.43 | [-0.98, 0.72] | -0.29 | 0.768 - 1 28.5695006 - 1 3.8628272 | -0.15 | 0.51 | [-1.15, 0.84] | -0.30 | 0.765 - 1 32.6872795 - 1 3.8628272 | -0.18 | 0.58 | [-1.31, 0.95] | -0.30 | 0.761 - 1 12.0983850 - 1 7.9806061 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.774 - 1 16.2161639 - 1 7.9806061 | -0.05 | 0.18 | [-0.40, 0.30] | -0.29 | 0.772 - 1 20.3339428 - 1 7.9806061 | -0.08 | 0.26 | [-0.59, 0.44] | -0.29 | 0.770 - 1 24.4517217 - 1 7.9806061 | -0.10 | 0.34 | [-0.77, 0.57] | -0.30 | 0.767 - 1 28.5695006 - 1 7.9806061 | -0.13 | 0.42 | [-0.95, 0.69] | -0.30 | 0.763 - 1 32.6872795 - 1 7.9806061 | -0.15 | 0.49 | [-1.10, 0.80] | -0.31 | 0.758 - 1 16.2161639 - 1 12.0983850 | -0.03 | 0.09 | [-0.20, 0.15] | -0.29 | 0.771 - 1 20.3339428 - 1 12.0983850 | -0.05 | 0.17 | [-0.39, 0.29] | -0.30 | 0.768 - 1 24.4517217 - 1 12.0983850 | -0.08 | 0.25 | [-0.57, 0.42] | -0.30 | 0.764 - 1 28.5695006 - 1 12.0983850 | -0.10 | 0.33 | [-0.74, 0.54] | -0.31 | 0.760 - 1 32.6872795 - 1 12.0983850 | -0.12 | 0.40 | [-0.90, 0.65] | -0.31 | 0.755 - 1 20.3339428 - 1 16.2161639 | -0.03 | 0.08 | [-0.19, 0.14] | -0.30 | 0.765 - 1 24.4517217 - 1 16.2161639 | -0.05 | 0.17 | [-0.37, 0.27] | -0.30 | 0.761 - 1 28.5695006 - 1 16.2161639 | -0.07 | 0.24 | [-0.55, 0.40] | -0.31 | 0.756 - 1 32.6872795 - 1 16.2161639 | -0.10 | 0.31 | [-0.70, 0.51] | -0.32 | 0.750 - 1 24.4517217 - 1 20.3339428 | -0.02 | 0.08 | [-0.18, 0.13] | -0.31 | 0.757 - 1 28.5695006 - 1 20.3339428 | -0.05 | 0.16 | [-0.35, 0.25] | -0.32 | 0.751 - 1 32.6872795 - 1 20.3339428 | -0.07 | 0.22 | [-0.51, 0.37] | -0.33 | 0.745 - 1 28.5695006 - 1 24.4517217 | -0.02 | 0.07 | [-0.17, 0.12] | -0.32 | 0.745 - 1 32.6872795 - 1 24.4517217 | -0.05 | 0.14 | [-0.33, 0.23] | -0.33 | 0.738 - 1 32.6872795 - 1 28.5695006 | -0.02 | 0.07 | [-0.16, 0.11] | -0.35 | 0.730 - - Variable predicted: outcome - Predictors contrasted: var_binom, var_cont - Predictors averaged: groups - Contrasts are on the response-scale. - -# print hypothesis_test comma and dash levels - - Code - print(ht) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE - ------------------------------------------------------------------- - and, another, comma, b | and, another, comma, a | -0.02 | 0.07 - no comma, a | and, another, comma, a | 0.15 | 0.09 - no comma, b | and, another, comma, a | 0.13 | 0.12 - with, comma, a | and, another, comma, a | 0.07 | 0.08 - with, comma, b | and, another, comma, a | 0.06 | 0.11 - no comma, a | and, another, comma, b | 0.17 | 0.12 - no comma, b | and, another, comma, b | 0.15 | 0.09 - with, comma, a | and, another, comma, b | 0.09 | 0.11 - with, comma, b | and, another, comma, b | 0.07 | 0.08 - no comma, b | no comma, a | -0.02 | 0.07 - with, comma, a | no comma, a | -0.08 | 0.09 - with, comma, b | no comma, a | -0.10 | 0.11 - with, comma, a | no comma, b | -0.06 | 0.12 - with, comma, b | no comma, b | -0.08 | 0.09 - with, comma, b | with, comma, a | -0.02 | 0.07 - - Level1 | 95% CI | t(143) | p - ------------------------------------------------------- - and, another, comma, b | [-0.16, 0.12] | -0.26 | 0.796 - no comma, a | [-0.03, 0.33] | 1.66 | 0.099 - no comma, b | [-0.10, 0.36] | 1.14 | 0.255 - with, comma, a | [-0.09, 0.24] | 0.88 | 0.380 - with, comma, b | [-0.16, 0.27] | 0.51 | 0.610 - no comma, a | [-0.06, 0.40] | 1.46 | 0.147 - no comma, b | [-0.03, 0.33] | 1.66 | 0.099 - with, comma, a | [-0.13, 0.32] | 0.82 | 0.412 - with, comma, b | [-0.09, 0.24] | 0.88 | 0.380 - no comma, b | [-0.16, 0.12] | -0.26 | 0.796 - with, comma, a | [-0.26, 0.10] | -0.84 | 0.402 - with, comma, b | [-0.32, 0.13] | -0.83 | 0.407 - with, comma, a | [-0.29, 0.18] | -0.49 | 0.625 - with, comma, b | [-0.26, 0.10] | -0.84 | 0.402 - with, comma, b | [-0.16, 0.12] | -0.26 | 0.796 - - Variable predicted: Sepal.Length - Predictors contrasted: f1, f2 - Predictors averaged: Sepal.Width (3.1), Species - ---- - - Code - print(ht, table_width = Inf) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(143) | p - -------------------------------------------------------------------------------------------------------------------- - and, another, comma, nothere | and, another, comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 - no comma, comma, here | and, another, comma, comma, here | 0.15 | 0.09 | [-0.03, 0.33] | 1.66 | 0.099 - no comma, nothere | and, another, comma, comma, here | 0.13 | 0.12 | [-0.10, 0.36] | 1.14 | 0.255 - with, comma, comma, here | and, another, comma, comma, here | 0.07 | 0.08 | [-0.09, 0.24] | 0.88 | 0.380 - with, comma, nothere | and, another, comma, comma, here | 0.06 | 0.11 | [-0.16, 0.27] | 0.51 | 0.610 - no comma, comma, here | and, another, comma, nothere | 0.17 | 0.12 | [-0.06, 0.40] | 1.46 | 0.147 - no comma, nothere | and, another, comma, nothere | 0.15 | 0.09 | [-0.03, 0.33] | 1.66 | 0.099 - with, comma, comma, here | and, another, comma, nothere | 0.09 | 0.11 | [-0.13, 0.32] | 0.82 | 0.412 - with, comma, nothere | and, another, comma, nothere | 0.07 | 0.08 | [-0.09, 0.24] | 0.88 | 0.380 - no comma, nothere | no comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 - with, comma, comma, here | no comma, comma, here | -0.08 | 0.09 | [-0.26, 0.10] | -0.84 | 0.402 - with, comma, nothere | no comma, comma, here | -0.10 | 0.11 | [-0.32, 0.13] | -0.83 | 0.407 - with, comma, comma, here | no comma, nothere | -0.06 | 0.12 | [-0.29, 0.18] | -0.49 | 0.625 - with, comma, nothere | no comma, nothere | -0.08 | 0.09 | [-0.26, 0.10] | -0.84 | 0.402 - with, comma, nothere | with, comma, comma, here | -0.02 | 0.07 | [-0.16, 0.12] | -0.26 | 0.796 - - Variable predicted: Sepal.Length - Predictors contrasted: f1, f2 - Predictors averaged: Sepal.Width (3.1), Species - -# print hypothesis_test collapse levels - - Code - print(out) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(807) | p - ---------------------------------------------------------------------------- - 1, female | 1, male | 0.95 | 4.30 | [ -7.50, 9.39] | 0.22 | 0.825 - 2, male | 1, male | 3.89 | 4.41 | [ -4.77, 12.55] | 0.88 | 0.378 - 2, female | 1, male | 3.56 | 3.95 | [ -4.20, 11.32] | 0.90 | 0.368 - 3, male | 1, male | -0.86 | 5.16 | [-10.99, 9.28] | -0.17 | 0.868 - 3, female | 1, male | 3.12 | 4.45 | [ -5.62, 11.85] | 0.70 | 0.484 - 2, male | 1, female | 2.94 | 3.14 | [ -3.21, 9.10] | 0.94 | 0.348 - 2, female | 1, female | 2.61 | 2.42 | [ -2.15, 7.37] | 1.08 | 0.282 - 3, male | 1, female | -1.81 | 4.12 | [ -9.89, 6.28] | -0.44 | 0.661 - 3, female | 1, female | 2.17 | 3.17 | [ -4.05, 8.39] | 0.68 | 0.494 - 2, female | 2, male | -0.33 | 2.63 | [ -5.49, 4.83] | -0.13 | 0.899 - 3, male | 2, male | -4.75 | 4.23 | [-13.06, 3.56] | -1.12 | 0.262 - 3, female | 2, male | -0.78 | 3.32 | [ -7.29, 5.74] | -0.23 | 0.815 - 3, male | 2, female | -4.42 | 3.75 | [-11.78, 2.95] | -1.18 | 0.239 - 3, female | 2, female | -0.44 | 2.67 | [ -5.69, 4.80] | -0.17 | 0.869 - 3, female | 3, male | 3.97 | 4.26 | [ -4.40, 12.34] | 0.93 | 0.352 - - Variable predicted: barthtot - Predictors contrasted: c172code, c161sex - Predictors averaged: c12hour (42), neg_c_7 (12) - -# hypothesis_test, ci-level - - Code - print(out) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(147) | p - ---------------------------------------------------------------------------- - versicolor | setosa | 0.93 | 0.10 | [0.73, 1.13] | 9.03 | < .001 - virginica | setosa | 1.58 | 0.10 | [1.38, 1.79] | 15.37 | < .001 - virginica | versicolor | 0.65 | 0.10 | [0.45, 0.86] | 6.33 | < .001 - - Variable predicted: Sepal.Length - Predictors contrasted: Species - ---- - - Code - print(out) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 80% CI | t(147) | p - ---------------------------------------------------------------------------- - versicolor | setosa | 0.93 | 0.10 | [0.80, 1.06] | 9.03 | < .001 - virginica | setosa | 1.58 | 0.10 | [1.45, 1.71] | 15.37 | < .001 - virginica | versicolor | 0.65 | 0.10 | [0.52, 0.78] | 6.33 | < .001 - - Variable predicted: Sepal.Length - Predictors contrasted: Species - -# print hypothesis_test collapse CI - - Code - print(out) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(876) | p - ------------------------------------------------------------------------ - 2 | 1 | -8.67 | 2.52 | [-13.61, -3.72] | -3.44 | < .001 - 3 | 1 | -21.19 | 2.45 | [-25.99, -16.38] | -8.66 | < .001 - 4 | 1 | -61.19 | 2.47 | [-66.05, -56.34] | -24.75 | < .001 - 3 | 2 | -12.52 | 1.59 | [-15.64, -9.40] | -7.87 | < .001 - 4 | 2 | -52.53 | 1.63 | [-55.73, -49.32] | -32.16 | < .001 - 4 | 3 | -40.01 | 1.48 | [-42.92, -37.10] | -26.98 | < .001 - - Variable predicted: barthtot - Predictors contrasted: e42dep - Predictors averaged: c160age (53) - ---- - - Code - print(out, collapse_ci = TRUE) - Output - Model-based Contrasts Analysis - - Level1 | Level2 | Difference | SE | 95% CI | t(876) | p - ------------------------------------------------------------------------ - 2 | 1 | -8.67 | 2.52 | [-13.61, -3.72] | -3.44 | < .001 - 3 | 1 | -21.19 | 2.45 | [-25.99, -16.38] | -8.66 | < .001 - 4 | 1 | -61.19 | 2.47 | [-66.05, -56.34] | -24.75 | < .001 - 3 | 2 | -12.52 | 1.59 | [-15.64, -9.40] | -7.87 | < .001 - 4 | 2 | -52.53 | 1.63 | [-55.73, -49.32] | -32.16 | < .001 - 4 | 3 | -40.01 | 1.48 | [-42.92, -37.10] | -26.98 | < .001 - - Variable predicted: barthtot - Predictors contrasted: e42dep - Predictors averaged: c160age (53) - From 2951fa32743763ac390f0a0349a97db07577c4b4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 12:42:04 +0100 Subject: [PATCH 17/51] Update test_predictions.R --- R/test_predictions.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/test_predictions.R b/R/test_predictions.R index a200f8ae..4c2018a1 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -468,7 +468,8 @@ test_predictions.default <- function(object, object, contrast = terms, by = by, - predict = scale, + predict = dot_args$type, + transform = dot_args$transform, ci = ci_level, comparison = test, estimate = marginalize, From d7cbaedf672a67250349e7cc5167915710f890f4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 12:48:11 +0100 Subject: [PATCH 18/51] update tests --- R/test_predictions.R | 3 +- tests/testthat/test-print_test_predictions.R | 97 +++++++++++--------- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/R/test_predictions.R b/R/test_predictions.R index 4c2018a1..272a28de 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -469,7 +469,8 @@ test_predictions.default <- function(object, contrast = terms, by = by, predict = dot_args$type, - transform = dot_args$transform, + ## TODO: enable this, once the "transform" argument is removed in modelbased + # transform = dot_args$transform, ci = ci_level, comparison = test, estimate = marginalize, diff --git a/tests/testthat/test-print_test_predictions.R b/tests/testthat/test-print_test_predictions.R index b71b6361..fb3de6c6 100644 --- a/tests/testthat/test-print_test_predictions.R +++ b/tests/testthat/test-print_test_predictions.R @@ -23,26 +23,10 @@ test_that("print hypothesis_test simple predictions link scale", { out <- hypothesis_test(m, "var_binom", test = NULL, scale = "link") expect_snapshot(print(out)) }) -test_that("print hypothesis_test simple contrast exp scale", { - out <- hypothesis_test(m, "var_binom", scale = "exp") - expect_snapshot(print(out)) -}) -test_that("print hypothesis_test simple contrast odds ratio scale", { - out <- hypothesis_test(m, "var_binom", scale = "oddsratios") - expect_snapshot(print(out)) -}) test_that("print hypothesis_test simple contrast response scale", { out <- hypothesis_test(m, "var_binom", scale = "response") expect_snapshot(print(out)) }) -test_that("print hypothesis_test simple predictions exp scale", { - out <- hypothesis_test(m, "var_binom", test = NULL, scale = "exp") - expect_snapshot(print(out)) -}) -test_that("print hypothesis_test simple predictions odds ratio scale", { - out <- hypothesis_test(m, "var_binom", test = NULL, scale = "oddsratios") - expect_snapshot(print(out)) -}) test_that("print hypothesis_test contrasts link scale", { out <- hypothesis_test(m, c("var_binom", "var_cont"), scale = "link") @@ -52,18 +36,10 @@ test_that("print hypothesis_test predictions link scale", { out <- hypothesis_test(m, c("var_binom", "var_cont"), test = NULL, scale = "link") expect_snapshot(print(out)) }) -test_that("print hypothesis_test contrasts exp scale", { - out <- hypothesis_test(m, c("var_binom", "var_cont"), scale = "exp") - expect_snapshot(print(out)) -}) test_that("print hypothesis_test contrasts response scale", { out <- hypothesis_test(m, c("var_binom", "var_cont"), scale = "response") expect_snapshot(print(out)) }) -test_that("print hypothesis_test predictions exp scale", { - out <- hypothesis_test(m, c("var_binom", "var_cont"), test = NULL, scale = "exp") - expect_snapshot(print(out)) -}) test_that("print hypothesis_test many rows", { dat <- mtcars @@ -79,19 +55,21 @@ test_that("print hypothesis_test many rows", { out <- capture.output(print(ht)) expect_identical( out, - c( - "Hypothesis | Contrast | 95% CI | p", - "---------------------------------------------------", - "(b1-b13)=(b3-b15) | -8.55 | -19.86, 2.76 | 0.131", + c("Model-based Contrasts Analysis", + "", + "Parameter | Difference | SE | 95% CI | t(22) | p", + "-------------------------------------------------------------------", + "b1-b13=b3-b15 | 2.40 | 6.64 | [-11.37, 16.17] | 0.36 | 0.721", "", - "Tested hypothesis: (cyl[4],vs[0],gear[3] - cyl[4],vs[0],gear[5]) =", - " (cyl[8],vs[0],gear[3] - cyl[8],vs[0],gear[5])" + "Variable predicted: mpg", + "Predictors contrasted: cyl, vs, gear", + "Parameters:", + "b1 = cyl [4], vs [0], gear [3]", + "b13 = cyl [4], vs [0], gear [5]", + "b3 = cyl [8], vs [0], gear [3]", + "b15 = cyl [8], vs [0], gear [5]" ) ) - expect_identical( - attributes(ht)$hypothesis_label, - "(cyl[4],vs[0],gear[3] - cyl[4],vs[0],gear[5]) = (cyl[8],vs[0],gear[3] - cyl[8],vs[0],gear[5])" - ) # check that operators are not replaced if inside brackets dat <- mtcars dat$gear <- factor(dat$gear) @@ -109,18 +87,21 @@ test_that("print hypothesis_test many rows", { expect_identical( out, c( - "Hypothesis | Contrast | 95% CI | p", - "---------------------------------------------------", - "(b1-b13)=(b3-b15) | -8.55 | -19.86, 2.76 | 0.131", + "Model-based Contrasts Analysis", + "", + "Parameter | Difference | SE | 95% CI | t(22) | p", + "-------------------------------------------------------------------", + "b1-b13=b3-b15 | 2.40 | 6.64 | [-11.37, 16.17] | 0.36 | 0.721", "", - "Tested hypothesis: (cyl[4],vs[a=1],gear[-40] - cyl[4],vs[a=1],gear[65+])", - " = (cyl[8],vs[a=1],gear[-40] - cyl[8],vs[a=1],gear[65+])" + "Variable predicted: mpg", + "Predictors contrasted: cyl, vs, gear", + "Parameters:", + "b1 = cyl [4], vs [a=1], gear [-40]", + "b13 = cyl [4], vs [a=1], gear [65+]", + "b3 = cyl [8], vs [a=1], gear [-40]", + "b15 = cyl [8], vs [a=1], gear [65+]" ) ) - expect_identical( - attributes(ht)$hypothesis_label, - "(cyl[4],vs[a=1],gear[-40] - cyl[4],vs[a=1],gear[65+]) = (cyl[8],vs[a=1],gear[-40] - cyl[8],vs[a=1],gear[65+])" - ) # check that collapse_levels works ht1 <- suppressWarnings(hypothesis_test( mod, @@ -270,3 +251,33 @@ withr::with_environment( expect_snapshot(print(out, collapse_ci = TRUE)) }) ) + + +## TODO: these currently don't work, as they conflict with the depracted +## "transform" argument in modelbased. Once that argument is removed, +## this can be re-enabled. + +# test_that("print hypothesis_test simple contrast exp scale", { +# out <- hypothesis_test(m, "var_binom", scale = "exp") +# expect_snapshot(print(out)) +# }) +# test_that("print hypothesis_test simple contrast odds ratio scale", { +# out <- hypothesis_test(m, "var_binom", scale = "oddsratios") +# expect_snapshot(print(out)) +# }) +# test_that("print hypothesis_test simple predictions exp scale", { +# out <- hypothesis_test(m, "var_binom", test = NULL, scale = "exp") +# expect_snapshot(print(out)) +# }) +# test_that("print hypothesis_test simple predictions odds ratio scale", { +# out <- hypothesis_test(m, "var_binom", test = NULL, scale = "oddsratios") +# expect_snapshot(print(out)) +# }) +# test_that("print hypothesis_test contrasts exp scale", { +# out <- hypothesis_test(m, c("var_binom", "var_cont"), scale = "exp") +# expect_snapshot(print(out)) +# }) +# test_that("print hypothesis_test predictions exp scale", { +# out <- hypothesis_test(m, c("var_binom", "var_cont"), test = NULL, scale = "exp") +# expect_snapshot(print(out)) +# }) From 7534dc9aead81cddc2aaa8646194d428935c256e Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 14:43:34 +0100 Subject: [PATCH 19/51] update snaps --- tests/testthat/_snaps/print_md.md | 182 +++++++++++++----------------- tests/testthat/test-betareg.R | 2 +- tests/testthat/test-print_md.R | 2 +- 3 files changed, 78 insertions(+), 108 deletions(-) diff --git a/tests/testthat/_snaps/print_md.md b/tests/testthat/_snaps/print_md.md index 8458a7a0..601e3c2d 100644 --- a/tests/testthat/_snaps/print_md.md +++ b/tests/testthat/_snaps/print_md.md @@ -18,7 +18,7 @@ +----------+-----------+--------------+ | 67 | 11.42 | 10.94, 11.89 | +----------+-----------+--------------+ - | 100 | 10.40 | 9.59, 11.21 | + | 100 | 10.40 | 9.59, 11.21 | +----------+-----------+--------------+ | c161sex: 2 | +----------+-----------+--------------+ @@ -124,41 +124,31 @@ print(out) Output - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | c172code | c161sex | Contrast | 95% CI | p | - +=========================================================+=============+==========+==============+=======+ - | low level of education-intermediate level of education | Male | -0.56 | -1.84, 0.73 | 0.396 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | low level of education-high level of education | Male | -0.35 | -1.86, 1.16 | 0.651 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | low level of education | Male-Female | -0.80 | -2.05, 0.45 | 0.210 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | low level of education-intermediate level of education | Male-Female | -0.78 | -1.93, 0.38 | 0.186 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | low level of education-high level of education | Male-Female | -1.64 | -2.93, -0.35 | 0.013 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | intermediate level of education-high level of education | Male | 0.21 | -1.03, 1.44 | 0.742 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | intermediate level of education-low level of education | Male-Female | -0.25 | -1.15, 0.66 | 0.593 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | intermediate level of education | Male-Female | -0.22 | -0.98, 0.53 | 0.563 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | intermediate level of education-high level of education | Male-Female | -1.09 | -2.04, -0.13 | 0.026 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | high level of education-low level of education | Male-Female | -0.45 | -1.65, 0.75 | 0.460 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | high level of education-intermediate level of education | Male-Female | -0.43 | -1.53, 0.67 | 0.443 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | high level of education | Male-Female | -1.29 | -2.53, -0.05 | 0.042 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | low level of education-intermediate level of education | Female | 0.02 | -0.68, 0.72 | 0.949 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | low level of education-high level of education | Female | -0.84 | -1.75, 0.08 | 0.072 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - | intermediate level of education-high level of education | Female | -0.86 | -1.63, -0.09 | 0.029 | - +---------------------------------------------------------+-------------+----------+--------------+-------+ - - Table: Pairwise comparisons + + Table: Model-based Contrasts Analysis + + |Level1 | Level2 | Difference| SE| 95% CI| t(825)| p| + |:---------------------------------------|:---------------------------------------|----------:|----:|-------------:|------:|-----:| + |low level of education, Female | low level of education, Male | 0.80| 0.64| (-0.45, 2.05)| 1.25| 0.210| + |intermediate level of education, Male | low level of education, Male | 0.56| 0.65| (-0.73, 1.84)| 0.85| 0.396| + |intermediate level of education, Female | low level of education, Male | 0.78| 0.59| (-0.38, 1.93)| 1.32| 0.186| + |high level of education, Male | low level of education, Male | 0.35| 0.77| (-1.16, 1.86)| 0.45| 0.651| + |high level of education, Female | low level of education, Male | 1.64| 0.66| ( 0.35, 2.93)| 2.49| 0.013| + |intermediate level of education, Male | low level of education, Female | -0.25| 0.46| (-1.15, 0.66)| -0.53| 0.593| + |intermediate level of education, Female | low level of education, Female | -0.02| 0.36| (-0.72, 0.68)| -0.06| 0.949| + |high level of education, Male | low level of education, Female | -0.45| 0.61| (-1.65, 0.75)| -0.74| 0.460| + |high level of education, Female | low level of education, Female | 0.84| 0.47| (-0.08, 1.75)| 1.80| 0.072| + |intermediate level of education, Female | intermediate level of education, Male | 0.22| 0.39| (-0.53, 0.98)| 0.58| 0.563| + |high level of education, Male | intermediate level of education, Male | -0.21| 0.63| (-1.44, 1.03)| -0.33| 0.742| + |high level of education, Female | intermediate level of education, Male | 1.09| 0.49| ( 0.13, 2.04)| 2.23| 0.026| + |high level of education, Male |intermediate level of education, Female | -0.43| 0.56| (-1.53, 0.67)| -0.77| 0.443| + |high level of education, Female |intermediate level of education, Female | 0.86| 0.39| ( 0.09, 1.63)| 2.19| 0.029| + |high level of education, Female | high level of education, Male | 1.29| 0.63| ( 0.05, 2.53)| 2.04| 0.042| + + Variable predicted: neg_c_7 + Predictors contrasted: c172code, c161sex + Predictors averaged: c12hour (42), e42dep (2.9) + --- @@ -166,41 +156,31 @@ print(out) Output - +---------------------------------------------------------+-------------+----------------------+-------+ - | c172code | c161sex | Contrast (95% CI) | p | - +=========================================================+=============+======================+=======+ - | low level of education-intermediate level of education | Male | -0.56 (-1.84, 0.73) | 0.396 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | low level of education-high level of education | Male | -0.35 (-1.86, 1.16) | 0.651 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | low level of education | Male-Female | -0.80 (-2.05, 0.45) | 0.210 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | low level of education-intermediate level of education | Male-Female | -0.78 (-1.93, 0.38) | 0.186 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | low level of education-high level of education | Male-Female | -1.64 (-2.93, -0.35) | 0.013 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | intermediate level of education-high level of education | Male | 0.21 (-1.03, 1.44) | 0.742 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | intermediate level of education-low level of education | Male-Female | -0.25 (-1.15, 0.66) | 0.593 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | intermediate level of education | Male-Female | -0.22 (-0.98, 0.53) | 0.563 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | intermediate level of education-high level of education | Male-Female | -1.09 (-2.04, -0.13) | 0.026 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | high level of education-low level of education | Male-Female | -0.45 (-1.65, 0.75) | 0.460 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | high level of education-intermediate level of education | Male-Female | -0.43 (-1.53, 0.67) | 0.443 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | high level of education | Male-Female | -1.29 (-2.53, -0.05) | 0.042 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | low level of education-intermediate level of education | Female | 0.02 (-0.68, 0.72) | 0.949 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | low level of education-high level of education | Female | -0.84 (-1.75, 0.08) | 0.072 | - +---------------------------------------------------------+-------------+----------------------+-------+ - | intermediate level of education-high level of education | Female | -0.86 (-1.63, -0.09) | 0.029 | - +---------------------------------------------------------+-------------+----------------------+-------+ - - Table: Pairwise comparisons + + Table: Model-based Contrasts Analysis + + |Level1 | Level2 | Difference| SE| 95% CI| t(825)| p| + |:---------------------------------------|:---------------------------------------|----------:|----:|-------------:|------:|-----:| + |low level of education, Female | low level of education, Male | 0.80| 0.64| (-0.45, 2.05)| 1.25| 0.210| + |intermediate level of education, Male | low level of education, Male | 0.56| 0.65| (-0.73, 1.84)| 0.85| 0.396| + |intermediate level of education, Female | low level of education, Male | 0.78| 0.59| (-0.38, 1.93)| 1.32| 0.186| + |high level of education, Male | low level of education, Male | 0.35| 0.77| (-1.16, 1.86)| 0.45| 0.651| + |high level of education, Female | low level of education, Male | 1.64| 0.66| ( 0.35, 2.93)| 2.49| 0.013| + |intermediate level of education, Male | low level of education, Female | -0.25| 0.46| (-1.15, 0.66)| -0.53| 0.593| + |intermediate level of education, Female | low level of education, Female | -0.02| 0.36| (-0.72, 0.68)| -0.06| 0.949| + |high level of education, Male | low level of education, Female | -0.45| 0.61| (-1.65, 0.75)| -0.74| 0.460| + |high level of education, Female | low level of education, Female | 0.84| 0.47| (-0.08, 1.75)| 1.80| 0.072| + |intermediate level of education, Female | intermediate level of education, Male | 0.22| 0.39| (-0.53, 0.98)| 0.58| 0.563| + |high level of education, Male | intermediate level of education, Male | -0.21| 0.63| (-1.44, 1.03)| -0.33| 0.742| + |high level of education, Female | intermediate level of education, Male | 1.09| 0.49| ( 0.13, 2.04)| 2.23| 0.026| + |high level of education, Male |intermediate level of education, Female | -0.43| 0.56| (-1.53, 0.67)| -0.77| 0.443| + |high level of education, Female |intermediate level of education, Female | 0.86| 0.39| ( 0.09, 1.63)| 2.19| 0.029| + |high level of education, Female | high level of education, Male | 1.29| 0.63| ( 0.05, 2.53)| 2.04| 0.042| + + Variable predicted: neg_c_7 + Predictors contrasted: c172code, c161sex + Predictors averaged: c12hour (42), e42dep (2.9) + --- @@ -208,39 +188,29 @@ print(out) Output - +---------------------------------------------------------+-------------+-----------------------+ - | c172code | c161sex | Contrast (95% CI) | - +=========================================================+=============+=======================+ - | low level of education-intermediate level of education | Male | -0.56 (-1.84, 0.73) | - +---------------------------------------------------------+-------------+-----------------------+ - | low level of education-high level of education | Male | -0.35 (-1.86, 1.16) | - +---------------------------------------------------------+-------------+-----------------------+ - | low level of education | Male-Female | -0.80 (-2.05, 0.45) | - +---------------------------------------------------------+-------------+-----------------------+ - | low level of education-intermediate level of education | Male-Female | -0.78 (-1.93, 0.38) | - +---------------------------------------------------------+-------------+-----------------------+ - | low level of education-high level of education | Male-Female | -1.64* (-2.93, -0.35) | - +---------------------------------------------------------+-------------+-----------------------+ - | intermediate level of education-high level of education | Male | 0.21 (-1.03, 1.44) | - +---------------------------------------------------------+-------------+-----------------------+ - | intermediate level of education-low level of education | Male-Female | -0.25 (-1.15, 0.66) | - +---------------------------------------------------------+-------------+-----------------------+ - | intermediate level of education | Male-Female | -0.22 (-0.98, 0.53) | - +---------------------------------------------------------+-------------+-----------------------+ - | intermediate level of education-high level of education | Male-Female | -1.09* (-2.04, -0.13) | - +---------------------------------------------------------+-------------+-----------------------+ - | high level of education-low level of education | Male-Female | -0.45 (-1.65, 0.75) | - +---------------------------------------------------------+-------------+-----------------------+ - | high level of education-intermediate level of education | Male-Female | -0.43 (-1.53, 0.67) | - +---------------------------------------------------------+-------------+-----------------------+ - | high level of education | Male-Female | -1.29* (-2.53, -0.05) | - +---------------------------------------------------------+-------------+-----------------------+ - | low level of education-intermediate level of education | Female | 0.02 (-0.68, 0.72) | - +---------------------------------------------------------+-------------+-----------------------+ - | low level of education-high level of education | Female | -0.84 (-1.75, 0.08) | - +---------------------------------------------------------+-------------+-----------------------+ - | intermediate level of education-high level of education | Female | -0.86* (-1.63, -0.09) | - +---------------------------------------------------------+-------------+-----------------------+ - - Table: Pairwise comparisons + + Table: Model-based Contrasts Analysis + + |Level1 | Level2 | Difference| SE| 95% CI| t(825)| p| + |:---------------------------------------|:---------------------------------------|----------:|----:|-------------:|------:|-----:| + |low level of education, Female | low level of education, Male | 0.80| 0.64| (-0.45, 2.05)| 1.25| 0.210| + |intermediate level of education, Male | low level of education, Male | 0.56| 0.65| (-0.73, 1.84)| 0.85| 0.396| + |intermediate level of education, Female | low level of education, Male | 0.78| 0.59| (-0.38, 1.93)| 1.32| 0.186| + |high level of education, Male | low level of education, Male | 0.35| 0.77| (-1.16, 1.86)| 0.45| 0.651| + |high level of education, Female | low level of education, Male | 1.64| 0.66| ( 0.35, 2.93)| 2.49| 0.013| + |intermediate level of education, Male | low level of education, Female | -0.25| 0.46| (-1.15, 0.66)| -0.53| 0.593| + |intermediate level of education, Female | low level of education, Female | -0.02| 0.36| (-0.72, 0.68)| -0.06| 0.949| + |high level of education, Male | low level of education, Female | -0.45| 0.61| (-1.65, 0.75)| -0.74| 0.460| + |high level of education, Female | low level of education, Female | 0.84| 0.47| (-0.08, 1.75)| 1.80| 0.072| + |intermediate level of education, Female | intermediate level of education, Male | 0.22| 0.39| (-0.53, 0.98)| 0.58| 0.563| + |high level of education, Male | intermediate level of education, Male | -0.21| 0.63| (-1.44, 1.03)| -0.33| 0.742| + |high level of education, Female | intermediate level of education, Male | 1.09| 0.49| ( 0.13, 2.04)| 2.23| 0.026| + |high level of education, Male |intermediate level of education, Female | -0.43| 0.56| (-1.53, 0.67)| -0.77| 0.443| + |high level of education, Female |intermediate level of education, Female | 0.86| 0.39| ( 0.09, 1.63)| 2.19| 0.029| + |high level of education, Female | high level of education, Male | 1.29| 0.63| ( 0.05, 2.53)| 2.04| 0.042| + + Variable predicted: neg_c_7 + Predictors contrasted: c172code, c161sex + Predictors averaged: c12hour (42), e42dep (2.9) + diff --git a/tests/testthat/test-betareg.R b/tests/testthat/test-betareg.R index 6dd17954..cac2db48 100644 --- a/tests/testthat/test-betareg.R +++ b/tests/testthat/test-betareg.R @@ -49,5 +49,5 @@ test_that("ggpredict", { skip_if_not_installed("marginaleffects") out <- test_predictions(p) - expect_equal(out$Difference , -0.00123838580671709, tolerance = 1e-4) + expect_equal(out$Difference , 0.00123838580671709, tolerance = 1e-4) }) diff --git a/tests/testthat/test-print_md.R b/tests/testthat/test-print_md.R index 8e363b07..9f4e2a80 100644 --- a/tests/testthat/test-print_md.R +++ b/tests/testthat/test-print_md.R @@ -30,4 +30,4 @@ test_that("ggpredict, print_md", { expect_snapshot(print(out)) out <- print_md(result, collapse_ci = TRUE, collapse_p = TRUE) expect_snapshot(print(out)) -}) \ No newline at end of file +}) From 94958fdb15bed94b091ec73bd047a5affe74a683 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 15:08:19 +0100 Subject: [PATCH 20/51] update --- R/test_predictions.R | 20 +- .../_snaps/print_test_predictions-ordinal.md | 230 ------------------ 2 files changed, 19 insertions(+), 231 deletions(-) delete mode 100644 tests/testthat/_snaps/print_test_predictions-ordinal.md diff --git a/R/test_predictions.R b/R/test_predictions.R index 272a28de..e0acee34 100644 --- a/R/test_predictions.R +++ b/R/test_predictions.R @@ -457,13 +457,31 @@ test_predictions.default <- function(object, )) } - marginalize <- switch(margin, + marginalize <- switch(margin, mean_reference = , mean_mode = "specific", marginalmeans = "average", "population" ) + # check if we have representative values in brackets + representative_values <- .get_representative_values( + terms, + insight::get_data(object, source = "mf", verbose = FALSE) + ) + + # convert terms argument + if (!is.null(representative_values)) { + terms <- unlist(lapply(names(representative_values), function(i) { + value <- representative_values[[i]] + # for non numeric, surround with quotes + if (anyNA(suppressWarnings(as.numeric(value)))) { + value <- paste0("'", value, "'") + } + paste0(i, "=c(", paste(value, collapse = ","), ")") + }), use.names = FALSE) + } + modelbased::estimate_contrasts( object, contrast = terms, diff --git a/tests/testthat/_snaps/print_test_predictions-ordinal.md b/tests/testthat/_snaps/print_test_predictions-ordinal.md deleted file mode 100644 index 3001c0be..00000000 --- a/tests/testthat/_snaps/print_test_predictions-ordinal.md +++ /dev/null @@ -1,230 +0,0 @@ -# print hypothesis_test ordinal outcome - - Code - print(out) - Output - # Pairwise comparisons - - Response Level by Type | Contrast - ------------------------------------------ - Low-Tower-Low-Apartment | -0.14 - Low-Tower-Low-Atrium | -0.09 - Low-Tower-Low-Terrace | -0.27 - Low-Tower-Medium-Tower | 0.09 - Low-Tower-Medium-Apartment | 0.12 - Low-Tower-Medium-Atrium | 0.10 - Low-Tower-Medium-Terrace | 0.17 - Low-Tower-High-Tower | 0.04 - Low-Tower-High-Apartment | 0.16 - Low-Tower-High-Atrium | 0.12 - Low-Tower-High-Terrace | 0.23 - Low-Apartment-Low-Atrium | 0.05 - Low-Apartment-Low-Terrace | -0.13 - Low-Apartment-Medium-Tower | 0.23 - Low-Apartment-Medium-Apartment | 0.26 - Low-Apartment-Medium-Atrium | 0.24 - Low-Apartment-Medium-Terrace | 0.31 - Low-Apartment-High-Tower | 0.18 - Low-Apartment-High-Apartment | 0.30 - Low-Apartment-High-Atrium | 0.26 - Low-Apartment-High-Terrace | 0.37 - Low-Atrium-Low-Terrace | -0.18 - Low-Atrium-Medium-Tower | 0.18 - Low-Atrium-Medium-Apartment | 0.21 - Low-Atrium-Medium-Atrium | 0.19 - Low-Atrium-Medium-Terrace | 0.26 - Low-Atrium-High-Tower | 0.13 - Low-Atrium-High-Apartment | 0.25 - Low-Atrium-High-Atrium | 0.21 - Low-Atrium-High-Terrace | 0.32 - Low-Terrace-Medium-Tower | 0.36 - Low-Terrace-Medium-Apartment | 0.38 - Low-Terrace-Medium-Atrium | 0.37 - Low-Terrace-Medium-Terrace | 0.43 - Low-Terrace-High-Tower | 0.31 - Low-Terrace-High-Apartment | 0.42 - Low-Terrace-High-Atrium | 0.39 - Low-Terrace-High-Terrace | 0.50 - Medium-Tower-Medium-Apartment | 0.03 - Medium-Tower-Medium-Atrium | 0.01 - Medium-Tower-Medium-Terrace | 0.08 - Medium-Tower-High-Tower | -0.05 - Medium-Tower-High-Apartment | 0.07 - Medium-Tower-High-Atrium | 0.03 - Medium-Tower-High-Terrace | 0.14 - Medium-Apartment-Medium-Atrium | -0.01 - Medium-Apartment-Medium-Terrace | 0.05 - Medium-Apartment-High-Tower | -0.07 - Medium-Apartment-High-Apartment | 0.04 - Medium-Apartment-High-Atrium | 0.00 - Medium-Apartment-High-Terrace | 0.12 - Medium-Atrium-Medium-Terrace | 0.06 - Medium-Atrium-High-Tower | -0.06 - Medium-Atrium-High-Apartment | 0.05 - Medium-Atrium-High-Atrium | 0.02 - Medium-Atrium-High-Terrace | 0.13 - Medium-Terrace-High-Tower | -0.12 - Medium-Terrace-High-Apartment | -0.01 - Medium-Terrace-High-Atrium | -0.05 - Medium-Terrace-High-Terrace | 0.07 - High-Tower-High-Apartment | 0.11 - High-Tower-High-Atrium | 0.08 - High-Tower-High-Terrace | 0.19 - High-Apartment-High-Atrium | -0.04 - High-Apartment-High-Terrace | 0.08 - High-Atrium-High-Terrace | 0.11 - Message - - Contrasts are presented as probabilities (in %-points). - ---- - - Code - print(out) - Output - # Pairwise comparisons - - Response Level by Type & x | Contrast - ------------------------------------------------ - Low-Terrace-1-Low-Terrace-2 | 0.00 - Low-Terrace-1-Low-Apartment-1 | 0.13 - Low-Terrace-1-Low-Apartment-2 | 0.13 - Low-Terrace-1-Medium-Terrace-1 | 0.43 - Low-Terrace-1-Medium-Terrace-2 | 0.43 - Low-Terrace-1-Medium-Apartment-1 | 0.38 - Low-Terrace-1-Medium-Apartment-2 | 0.38 - Low-Terrace-1-High-Terrace-1 | 0.49 - Low-Terrace-1-High-Terrace-2 | 0.49 - Low-Terrace-1-High-Apartment-1 | 0.42 - Low-Terrace-1-High-Apartment-2 | 0.42 - Low-Terrace-2-Low-Apartment-1 | 0.12 - Low-Terrace-2-Low-Apartment-2 | 0.13 - Low-Terrace-2-Medium-Terrace-1 | 0.42 - Low-Terrace-2-Medium-Terrace-2 | 0.42 - Low-Terrace-2-Medium-Apartment-1 | 0.38 - Low-Terrace-2-Medium-Apartment-2 | 0.38 - Low-Terrace-2-High-Terrace-1 | 0.49 - Low-Terrace-2-High-Terrace-2 | 0.49 - Low-Terrace-2-High-Apartment-1 | 0.41 - Low-Terrace-2-High-Apartment-2 | 0.41 - Low-Apartment-1-Low-Apartment-2 | 0.00 - Low-Apartment-1-Medium-Terrace-1 | 0.30 - Low-Apartment-1-Medium-Terrace-2 | 0.30 - Low-Apartment-1-Medium-Apartment-1 | 0.25 - Low-Apartment-1-Medium-Apartment-2 | 0.25 - Low-Apartment-1-High-Terrace-1 | 0.37 - Low-Apartment-1-High-Terrace-2 | 0.37 - Low-Apartment-1-High-Apartment-1 | 0.29 - Low-Apartment-1-High-Apartment-2 | 0.29 - Low-Apartment-2-Medium-Terrace-1 | 0.30 - Low-Apartment-2-Medium-Terrace-2 | 0.30 - Low-Apartment-2-Medium-Apartment-1 | 0.25 - Low-Apartment-2-Medium-Apartment-2 | 0.25 - Low-Apartment-2-High-Terrace-1 | 0.37 - Low-Apartment-2-High-Terrace-2 | 0.36 - Low-Apartment-2-High-Apartment-1 | 0.29 - Low-Apartment-2-High-Apartment-2 | 0.29 - Medium-Terrace-1-Medium-Terrace-2 | 0.00 - Medium-Terrace-1-Medium-Apartment-1 | -0.05 - Medium-Terrace-1-Medium-Apartment-2 | -0.05 - Medium-Terrace-1-High-Terrace-1 | 0.07 - Medium-Terrace-1-High-Terrace-2 | 0.07 - Medium-Terrace-1-High-Apartment-1 | -0.01 - Medium-Terrace-1-High-Apartment-2 | -0.01 - Medium-Terrace-2-Medium-Apartment-1 | -0.05 - Medium-Terrace-2-Medium-Apartment-2 | -0.05 - Medium-Terrace-2-High-Terrace-1 | 0.07 - Medium-Terrace-2-High-Terrace-2 | 0.07 - Medium-Terrace-2-High-Apartment-1 | -0.01 - Medium-Terrace-2-High-Apartment-2 | -0.01 - Medium-Apartment-1-Medium-Apartment-2 | 0.00 - Medium-Apartment-1-High-Terrace-1 | 0.12 - Medium-Apartment-1-High-Terrace-2 | 0.11 - Medium-Apartment-1-High-Apartment-1 | 0.04 - Medium-Apartment-1-High-Apartment-2 | 0.04 - Medium-Apartment-2-High-Terrace-1 | 0.12 - Medium-Apartment-2-High-Terrace-2 | 0.11 - Medium-Apartment-2-High-Apartment-1 | 0.04 - Medium-Apartment-2-High-Apartment-2 | 0.04 - High-Terrace-1-High-Terrace-2 | 0.00 - High-Terrace-1-High-Apartment-1 | -0.08 - High-Terrace-1-High-Apartment-2 | -0.08 - High-Terrace-2-High-Apartment-1 | -0.08 - High-Terrace-2-High-Apartment-2 | -0.08 - High-Apartment-1-High-Apartment-2 | 0.00 - Message - - Contrasts are presented as probabilities (in %-points). - ---- - - Code - print(out) - Output - - # Response Level: Low - - Type | Predicted - --------------------- - Tower | 0.38 - Apartment | 0.52 - Atrium | 0.47 - Terrace | 0.64 - - # Response Level: Medium - - Type | Predicted - --------------------- - Tower | 0.29 - Apartment | 0.26 - Atrium | 0.27 - Terrace | 0.21 - - # Response Level: High - - Type | Predicted - --------------------- - Tower | 0.33 - Apartment | 0.22 - Atrium | 0.26 - Terrace | 0.14 - Message - - Predictions are presented as probabilities. - ---- - - Code - print(out) - Output - - # Response Level: Low - - Type | x | Predicted - ---------------------------- - Terrace | 1.00 | 0.64 - Terrace | 2.00 | 0.64 - Apartment | 1.00 | 0.52 - Apartment | 2.00 | 0.51 - - # Response Level: Medium - - Type | x | Predicted - ---------------------------- - Terrace | 1.00 | 0.21 - Terrace | 2.00 | 0.21 - Apartment | 1.00 | 0.26 - Apartment | 2.00 | 0.26 - - # Response Level: High - - Type | x | Predicted - ---------------------------- - Terrace | 1.00 | 0.15 - Terrace | 2.00 | 0.15 - Apartment | 1.00 | 0.22 - Apartment | 2.00 | 0.23 - Message - - Predictions are presented as probabilities. - From 5dcfd23e9f6a21c53b0beb8614b468cf94c9db28 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 15:10:57 +0100 Subject: [PATCH 21/51] Update test-print_test_predictions-ordinal.R --- tests/testthat/test-print_test_predictions-ordinal.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/testthat/test-print_test_predictions-ordinal.R b/tests/testthat/test-print_test_predictions-ordinal.R index 7068621a..e429f3fd 100644 --- a/tests/testthat/test-print_test_predictions-ordinal.R +++ b/tests/testthat/test-print_test_predictions-ordinal.R @@ -4,6 +4,8 @@ skip_if_not_installed("marginaleffects") skip_if_not_installed("MASS") skip_if_not_installed("ggplot2") +skip_if(!interactive()) + test_that("print hypothesis_test ordinal outcome", { data("housing", package = "MASS") set.seed(123) From 652bdd9cddf4e11322cb864d289728fe5ddab0b9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 16:13:03 +0100 Subject: [PATCH 22/51] remove johnson_neyman temporarily --- DESCRIPTION | 3 +- NAMESPACE | 2 - {R => WIP}/johnson_neyman.R | 103 ++++++++++++- {tests/testthat => WIP}/test-johnson_neyman.R | 0 .../test-johnson_neyman_numcat.R | 0 _pkgdown.yml | 1 - man/johnson_neyman.Rd | 135 ------------------ 7 files changed, 99 insertions(+), 145 deletions(-) rename {R => WIP}/johnson_neyman.R (75%) rename {tests/testthat => WIP}/test-johnson_neyman.R (100%) rename {tests/testthat => WIP}/test-johnson_neyman_numcat.R (100%) delete mode 100644 man/johnson_neyman.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 8dded03c..313e6ced 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -41,6 +41,7 @@ Suggests: clubSandwich, dfidx, effects (>= 4.2-2), + effectsize (>= 1.0.0), emmeans (>= 1.8.9), fixest, gam, @@ -62,7 +63,7 @@ Suggests: lme4 (>= 1.1-35), logistf, logitr, - marginaleffects (>= 0.24.0), + marginaleffects (>= 0.25.0), modelbased, MASS, Matrix, diff --git a/NAMESPACE b/NAMESPACE index 3832bbd4..711996f5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -117,7 +117,6 @@ export(ggemmeans) export(ggpredict) export(hypothesis_test) export(install_latest) -export(johnson_neyman) export(new_data) export(pool_comparisons) export(pool_predictions) @@ -128,7 +127,6 @@ export(print_md) export(representative_values) export(residualize_over_grid) export(show_palettes) -export(spotlight_analysis) export(test_predictions) export(theme_ggeffects) export(values_at) diff --git a/R/johnson_neyman.R b/WIP/johnson_neyman.R similarity index 75% rename from R/johnson_neyman.R rename to WIP/johnson_neyman.R index d10a3f33..76a5d905 100644 --- a/R/johnson_neyman.R +++ b/WIP/johnson_neyman.R @@ -139,14 +139,15 @@ johnson_neyman <- function(x, precision = 500, p_adjust = NULL, ...) { # calculate contrasts of slopes fun_args <- list( model, - terms = focal_terms[1], + trend = focal_terms[1], by = focal_terms[2:length(focal_terms)], - test = "comparison" + length = precision ) - if (identical(p_adjust, "fdr")) { - fun_args$p_adjust <- "fdr" - } - do.call("test_predictions", c(fun_args, dot_args)) + # if (identical(p_adjust, "fdr")) { + # fun_args$p_adjust <- "fdr" + # } + out <- do.call(modelbased::estimate_slopes, c(fun_args, dot_args)) + .summarize_slopes(out) } @@ -158,6 +159,96 @@ spotlight_analysis <- johnson_neyman # helper ---------------------------------------------------------------------- +.summarize_slopes <- function(object, verbose = TRUE, ...) { + out <- as.data.frame(object) + by <- attributes(object)$by + + if (verbose && nrow(out) < 50) { + insight::format_alert("There might be too few data to accurately determine intervals. Consider setting `length = 100` (or larger) in your call to `estimate_slopes()`.") # nolint + } + + # Add "Confidence" col based on the sig index present in the data + out$Confidence <- .estimate_slopes_significance(out, ...) + out$Direction <- .estimate_slopes_direction(out, ...) + + # if we have more than one variable in `by`, group result table and + # add group name as separate column + if (length(by) > 1) { + parts <- split(out, out[[by[2]]]) + out <- do.call(rbind, lapply(parts, .estimate_slope_parts, by = by[1])) + out <- datawizard::rownames_as_column(out, "Group") + out$Group <- gsub("\\.\\d+$", "", out$Group) + } else { + out <- .estimate_slope_parts(out, by) + } + + attributes(out) <- utils::modifyList(attributes(object), attributes(out)) + class(out) <- c("summary_estimate_slopes", "data.frame") + attr(out, "table_title") <- c("Average Marginal Effects", "blue") + + out +} + + +.estimate_slope_parts <- function(out, by) { + # mark all "changes" from negative to positive and vice versa + index <- 1 + out$switch <- index + index <- index + 1 + + for (i in 2:nrow(out)) { + if (out$Direction[i] != out$Direction[i - 1] || out$Confidence[i] != out$Confidence[i - 1]) { + out$switch[i:nrow(out)] <- index + index <- index + 1 + } + } + + # split into "switches" + parts <- split(out, out$switch) + + do.call(rbind, lapply(parts, function(i) { + data.frame( + Start = i[[by]][1], + End = i[[by]][nrow(i)], + Direction = i$Direction[1], + Confidence = i$Confidence[1] + ) + })) +} + + +.estimate_slopes_direction <- function(data, ...) { + centrality_columns <- datawizard::extract_column_names( + data, + c("Coefficient", "Slope", "Median", "Mean", "MAP_Estimate"), + verbose = FALSE + ) + ifelse(data[[centrality_columns]] < 0, "negative", "positive") +} + + +.estimate_slopes_significance <- function(x, confidence = "auto", ...) { + insight::check_if_installed("effectsize") + + if (confidence == "auto") { + # TODO: make sure all of these work + if ("BF" %in% names(x)) confidence <- "BF" + if ("p" %in% names(x)) confidence <- "p" + if ("pd" %in% names(x)) confidence <- "pd" + } + + switch(confidence, + p = tools::toTitleCase(effectsize::interpret_p(x$p, ...)), + BF = tools::toTitleCase(effectsize::interpret_bf(x$BF, ...)), + pd = tools::toTitleCase(effectsize::interpret_pd(x$pd, ...)), + { + # Based on CI + out <- ifelse((x$CI_high < 0 & x$CI_low < 0) | (x$CI_high > 0 & x$CI_low > 0), "Significant", "Uncertain") + factor(out, levels = c("Uncertain", "Significant")) + } + ) +} + .fdr_interaction <- function(x, focal_terms, model) { # get names of interaction terms diff --git a/tests/testthat/test-johnson_neyman.R b/WIP/test-johnson_neyman.R similarity index 100% rename from tests/testthat/test-johnson_neyman.R rename to WIP/test-johnson_neyman.R diff --git a/tests/testthat/test-johnson_neyman_numcat.R b/WIP/test-johnson_neyman_numcat.R similarity index 100% rename from tests/testthat/test-johnson_neyman_numcat.R rename to WIP/test-johnson_neyman_numcat.R diff --git a/_pkgdown.yml b/_pkgdown.yml index 34dd86d5..e1cbced0 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -25,7 +25,6 @@ reference: - title: "Pairwise Comparisons, Contrasts and Marginal Effects" contents: - - johnson_neyman - test_predictions - pool_comparisons diff --git a/man/johnson_neyman.Rd b/man/johnson_neyman.Rd deleted file mode 100644 index 55b71868..00000000 --- a/man/johnson_neyman.Rd +++ /dev/null @@ -1,135 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/johnson_neyman.R -\name{johnson_neyman} -\alias{johnson_neyman} -\alias{spotlight_analysis} -\title{Spotlight-analysis: Create Johnson-Neyman confidence intervals and plots} -\usage{ -johnson_neyman(x, precision = 500, p_adjust = NULL, ...) - -spotlight_analysis(x, precision = 500, p_adjust = NULL, ...) -} -\arguments{ -\item{x}{An object of class \code{ggeffects}, as returned by the functions -from this package.} - -\item{precision}{Number of values used for the range of the moderator variable -to calculate the Johnson-Neyman interval. This argument is passed down to -\code{pretty(..., n = precision)}. Usually, the default value of 500 is sufficient. -Increasing this value will result in a smoother plot and more accurate values -for the interval bounds, but can also slightly increase the computation time.} - -\item{p_adjust}{Character vector, if not \code{NULL}, indicates the method to -adjust p-values. See \code{\link[stats:p.adjust]{stats::p.adjust()}} or \code{\link[stats:p.adjust]{stats::p.adjust.methods}} -for details. Further possible adjustment methods are \code{"tukey"} or \code{"sidak"}, -and for \code{johnson_neyman()}, \code{"fdr"} (or \code{"bh"}) and \code{"esarey"} (or its -short-cut \code{"es"}) are available options. Some caution is necessary when -adjusting p-value for multiple comparisons. See also section \emph{P-value adjustment} -below.} - -\item{...}{Arguments passed down to \code{\link[=test_predictions]{test_predictions()}} (and then probably -further to \code{\link[marginaleffects:slopes]{marginaleffects::slopes()}}). See \code{?test_predictions} for further -details.} - -\item{colors}{Colors used for the plot. Must be a vector with two color -values. Only used if \code{show_association = TRUE}.} - -\item{show_association}{Logical, if \code{TRUE}, highlights the range where values -of the moderator are positively or negtatively associated with the outcome.} - -\item{show_rug}{Logical, if \code{TRUE}, adds a rug with raw data of the moderator -variable to the plot. This helps visualizing its distribution.} - -\item{verbose}{Show/hide printed message for plots.} -} -\value{ -A data frame including contrasts of the \code{\link[=test_predictions]{test_predictions()}} for the -given interaction terms; for \code{plot()}, returns a Johnson-Neyman plot. -} -\description{ -Function conduct a spotlight-analysis to create so-called -Johnson-Neyman intervals. The \code{plot()} method can be used to visualize the -results of the Johnson-Neyman test. -} -\details{ -The Johnson-Neyman intervals help to understand where slopes are significant -in the context of interactions in regression models. Thus, the interval is only -useful if the model contains at least one interaction term. The function -accepts the results of a call to \code{predict_response()}. The \emph{first} and the -\emph{last} focal term used in the \code{terms} argument of \code{predict_response()} must -be numeric. The function will then test the slopes of the first focal terms -against zero, for different moderator values of the last focal term. If only -one numeric focal term is given, the function will create contrasts by levels -of the categorical focal term. Use \code{plot()} to create a plot of the results. - -To avoid misleading interpretations of the plot, we speak of "positive" and -"negative" associations, respectively, and "no clear" associations (instead -of "significant" or "non-significant"). This should prevent the user from -considering a non-significant range of values of the moderator as "accepting -the null hypothesis". -} -\section{P-value adjustment for multiple comparisons}{ - - -Note that p-value adjustment for methods supported by \code{p.adjust()} (see also -\code{p.adjust.methods}), each row is considered as one set of comparisons, no -matter which \code{test} was specified. That is, for instance, when \code{test_predictions()} -returns eight rows of predictions (when \code{test = NULL}), and \code{p_adjust = "bonferroni"}, -the p-values are adjusted in the same way as if we had a test of pairwise -comparisons (\code{test = "pairwise"}) where eight rows of comparisons are -returned. For methods \code{"tukey"} or \code{"sidak"}, a rank adjustment is done -based on the number of combinations of levels from the focal predictors -in \code{terms}. Thus, the latter two methods may be useful for certain tests -only, in particular pairwise comparisons. - -For \code{johnson_neyman()}, the only available adjustment methods are \code{"fdr"} -(or \code{"bh"}) (\emph{Benjamini & Hochberg (1995)}) and \code{"esarey"} (or \code{"es"}) -(\emph{Esarey and Sumner 2017}). These usually return similar results. The major -difference is that \code{"fdr"} can be slightly faster and more stable in edge -cases, however, confidence intervals are not updated. Only the p-values are -adjusted. \code{"esarey"} is slower, but confidence intervals are updated as well. -} - -\examples{ -\dontshow{if (all(insight::check_if_installed(c("ggplot2", "marginaleffects", "modelbased"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -\dontrun{ -data(efc, package = "ggeffects") -efc$c172code <- as.factor(efc$c172code) -m <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc) - -pr <- predict_response(m, c("c12hour", "barthtot")) -johnson_neyman(pr) -plot(johnson_neyman(pr)) - -pr <- predict_response(m, c("c12hour", "barthtot", "c172code")) -johnson_neyman(pr) -plot(johnson_neyman(pr)) - -# robust standard errors -if (requireNamespace("sandwich")) { - johnson_neyman(pr, vcov = sandwich::vcovHC) -} -} -\dontshow{\}) # examplesIf} -} -\references{ -Bauer, D. J., & Curran, P. J. (2005). Probing interactions in fixed and -multilevel regression: Inferential and graphical techniques. Multivariate -Behavioral Research, 40(3), 373-400. doi: 10.1207/s15327906mbr4003_5 - -Esarey, J., & Sumner, J. L. (2017). Marginal effects in interaction models: -Determining and controlling the false positive rate. Comparative Political -Studies, 1–33. Advance online publication. doi: 10.1177/0010414017730080 - -Johnson, P.O. & Fay, L.C. (1950). The Johnson-Neyman technique, its theory -and application. Psychometrika, 15, 349-367. doi: 10.1007/BF02288864 - -McCabe CJ, Kim DS, King KM. Improving Present Practices in the Visual Display -of Interactions. Advances in Methods and Practices in Psychological Science. -2018;1(2):147-165. doi:10.1177/2515245917746792 - -Spiller, S. A., Fitzsimons, G. J., Lynch, J. G., & McClelland, G. H. (2013). -Spotlights, Floodlights, and the Magic Number Zero: Simple Effects Tests in -Moderated Regression. Journal of Marketing Research, 50(2), 277–288. -doi:10.1509/jmr.12.0420 -} From 56c85f9ba46c8bfc864a91a559e7752c15b03a7c Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 16:14:23 +0100 Subject: [PATCH 23/51] update --- tests/testthat/test-vcov.R | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/testthat/test-vcov.R b/tests/testthat/test-vcov.R index e4e91261..238f075c 100644 --- a/tests/testthat/test-vcov.R +++ b/tests/testthat/test-vcov.R @@ -132,17 +132,20 @@ test_that("ggaverage, hypothesis test, robust SE", { expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-4) expect_equal(out1$conf.low, out2$conf.low, tolerance = 1e-4) expect_equal(out1$conf.low, out_later$conf.low, tolerance = 1e-4) + + ## TODO: re-implement once this is stable in modelbased + # johnson-neymann - data(efc, package = "ggeffects") - efc$c172code <- as.factor(efc$c172code) - fit <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc) - pr <- predict_response(fit, c("c12hour", "barthtot"), margin = "average") - out1 <- johnson_neyman(pr) - expect_equal(attributes(out1)$intervals$pos_lower, 47, tolerance = 1e-3) - # robust vcov - pr <- predict_response(fit, c("c12hour", "barthtot"), vcov = "HC1", margin = "average") - out2 <- johnson_neyman(pr) - out3 <- johnson_neyman(pr, vcov = "HC1") - expect_equal(attributes(out2)$intervals$pos_lower, 44.6, tolerance = 1e-3) - expect_equal(attributes(out2)$intervals$pos_lower, attributes(out3)$intervals$pos_lower, tolerance = 1e-3) + # data(efc, package = "ggeffects") + # efc$c172code <- as.factor(efc$c172code) + # fit <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc) + # pr <- predict_response(fit, c("c12hour", "barthtot"), margin = "average") + # out1 <- johnson_neyman(pr) + # expect_equal(attributes(out1)$intervals$pos_lower, 47, tolerance = 1e-3) + # # robust vcov + # pr <- predict_response(fit, c("c12hour", "barthtot"), vcov = "HC1", margin = "average") + # out2 <- johnson_neyman(pr) + # out3 <- johnson_neyman(pr, vcov = "HC1") + # expect_equal(attributes(out2)$intervals$pos_lower, 44.6, tolerance = 1e-3) + # expect_equal(attributes(out2)$intervals$pos_lower, attributes(out3)$intervals$pos_lower, tolerance = 1e-3) }) From 99ba8872dd158e17b59760d3d235227652f5d992 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 16:38:51 +0100 Subject: [PATCH 24/51] add back --- NAMESPACE | 3 + R/johnson_neyman.R | 425 +++++++++++++++++++++++++++ _pkgdown.yml | 1 + man/johnson_neyman.Rd | 130 ++++++++ tests/testthat/test-johnson_neyman.R | 180 ++++++++++++ 5 files changed, 739 insertions(+) create mode 100644 R/johnson_neyman.R create mode 100644 man/johnson_neyman.Rd create mode 100644 tests/testthat/test-johnson_neyman.R diff --git a/NAMESPACE b/NAMESPACE index 711996f5..559b2a91 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -93,6 +93,7 @@ S3method(plot,ggalleffects) S3method(plot,ggeffects) S3method(plot,see_equivalence_test_ggeffects) S3method(print,ggeffects) +S3method(print,ggjohnson_neyman) S3method(print_html,ggeffects) S3method(print_md,ggeffects) S3method(residualize_over_grid,data.frame) @@ -117,6 +118,7 @@ export(ggemmeans) export(ggpredict) export(hypothesis_test) export(install_latest) +export(johnson_neyman) export(new_data) export(pool_comparisons) export(pool_predictions) @@ -127,6 +129,7 @@ export(print_md) export(representative_values) export(residualize_over_grid) export(show_palettes) +export(spotlight_analysis) export(test_predictions) export(theme_ggeffects) export(values_at) diff --git a/R/johnson_neyman.R b/R/johnson_neyman.R new file mode 100644 index 00000000..1bdde83d --- /dev/null +++ b/R/johnson_neyman.R @@ -0,0 +1,425 @@ +#' @title Spotlight-analysis: Create Johnson-Neyman confidence intervals and plots +#' @name johnson_neyman +#' +#' @description Function conduct a spotlight-analysis to create so-called +#' Johnson-Neyman intervals. The `plot()` method can be used to visualize the +#' results of the Johnson-Neyman test. +#' +#' @param x An object of class `ggeffects`, as returned by the functions +#' from this package. +#' @param precision Number of values used for the range of the moderator variable +#' to calculate the Johnson-Neyman interval. This argument is passed down to +#' `pretty(..., n = precision)`. Usually, the default value of 500 is sufficient. +#' Increasing this value will result in a smoother plot and more accurate values +#' for the interval bounds, but can also slightly increase the computation time. +#' @param colors Colors used for the plot. Must be a vector with two color +#' values. Only used if `show_association = TRUE`. +#' @param show_association Logical, if `TRUE`, highlights the range where values +#' of the moderator are positively or negtatively associated with the outcome. +#' @param show_rug Logical, if `TRUE`, adds a rug with raw data of the moderator +#' variable to the plot. This helps visualizing its distribution. +#' @param verbose Show/hide printed message for plots. +#' @param ... Arguments passed down to [`test_predictions()`] (and then probably +#' further to [`marginaleffects::slopes()`]). See `?test_predictions` for further +#' details. +#' +#' @inheritParams test_predictions +#' +#' @return A data frame including contrasts of the [`test_predictions()`] for the +#' given interaction terms; for `plot()`, returns a Johnson-Neyman plot. +#' +#' @details +#' The Johnson-Neyman intervals help to understand where slopes are significant +#' in the context of interactions in regression models. Thus, the interval is only +#' useful if the model contains at least one interaction term. The function +#' accepts the results of a call to `predict_response()`. The _first_ and the +#' _last_ focal term used in the `terms` argument of `predict_response()` must +#' be numeric. The function will then test the slopes of the first focal terms +#' against zero, for different moderator values of the last focal term. If only +#' one numeric focal term is given, the function will create contrasts by levels +#' of the categorical focal term. Use `plot()` to create a plot of the results. +#' +#' To avoid misleading interpretations of the plot, we speak of "positive" and +#' "negative" associations, respectively, and "no clear" associations (instead +#' of "significant" or "non-significant"). This should prevent the user from +#' considering a non-significant range of values of the moderator as "accepting +#' the null hypothesis". +#' +#' @inheritSection test_predictions P-value adjustment for multiple comparisons +#' +#' @references +#' Bauer, D. J., & Curran, P. J. (2005). Probing interactions in fixed and +#' multilevel regression: Inferential and graphical techniques. Multivariate +#' Behavioral Research, 40(3), 373-400. doi: 10.1207/s15327906mbr4003_5 +#' +#' Esarey, J., & Sumner, J. L. (2017). Marginal effects in interaction models: +#' Determining and controlling the false positive rate. Comparative Political +#' Studies, 1–33. Advance online publication. doi: 10.1177/0010414017730080 +#' +#' Johnson, P.O. & Fay, L.C. (1950). The Johnson-Neyman technique, its theory +#' and application. Psychometrika, 15, 349-367. doi: 10.1007/BF02288864 +#' +#' McCabe CJ, Kim DS, King KM. Improving Present Practices in the Visual Display +#' of Interactions. Advances in Methods and Practices in Psychological Science. +#' 2018;1(2):147-165. doi:10.1177/2515245917746792 +#' +#' Spiller, S. A., Fitzsimons, G. J., Lynch, J. G., & McClelland, G. H. (2013). +#' Spotlights, Floodlights, and the Magic Number Zero: Simple Effects Tests in +#' Moderated Regression. Journal of Marketing Research, 50(2), 277–288. +#' doi:10.1509/jmr.12.0420 +#' +#' @examplesIf all(insight::check_if_installed(c("ggplot2", "marginaleffects", "modelbased"), quietly = TRUE)) +#' \dontrun{ +#' data(efc, package = "ggeffects") +#' m <- lm(neg_c_7 ~ c12hour * barthtot, data = efc) +#' +#' pr <- predict_response(m, c("c12hour", "barthtot")) +#' johnson_neyman(pr) +#' plot(johnson_neyman(pr)) +#' +#' # robust standard errors +#' if (requireNamespace("sandwich")) { +#' johnson_neyman(pr, vcov = sandwich::vcovHC) +#' } +#' } +#' @export +johnson_neyman <- function(x, precision = 500, p_adjust = NULL, ...) { + # we need the model data to check whether we have numeric focal terms + model <- .safe(.get_model_object(x)) + model_data <- .safe(.get_model_data(model)) + if (is.null(model_data)) { + insight::format_error("No model data found.") + } + + # check arguments + if (!is.null(p_adjust)) { + p_adjust <- insight::validate_argument(p_adjust, c("esarey", "es", "fdr", "bh")) + # just keep one shortcut + p_adjust <- switch(p_adjust, + esarey = "es", + bh = "fdr", + p_adjust + ) + } + + # extract focal terms + focal_terms <- attributes(x)$terms + + dot_args <- list(...) + # information about vcov-matrix + vcov_matrix <- attributes(x)$vcov + # set default for marginaleffects + if (is.null(vcov_matrix)) { + vcov_matrix <- TRUE + } + + # make sure we have a valid vcov-argument when user supplies "standard" vcov-arguments + # from ggpredict, like "vcov" etc. - then remove vcov_-arguments + if (!is.null(dot_args$vcov)) { + dot_args$vcov <- .get_variance_covariance_matrix(model, dot_args$vcov, dot_args$vcov_args) + # remove non supported args + dot_args$vcov_args <- NULL + } else if (is.null(dot_args$vcov)) { + dot_args$vcov <- vcov_matrix + } + + # check whether we have numeric focal terms in our model data + numeric_focal <- .safe(vapply(model_data[focal_terms], is.numeric, logical(1))) + + # if we don't have at least one numeric focal term, we can't create a Johnson-Neyman plot + if (sum(numeric_focal) < 1) { + insight::format_error("At least one numeric focal term is required.") + } + + # calculate contrasts of slopes + fun_args <- list( + model, + trend = focal_terms[1], + by = focal_terms[2:length(focal_terms)], + length = precision + ) + # if (identical(p_adjust, "fdr")) { + # fun_args$p_adjust <- "fdr" + # } + out <- do.call(modelbased::estimate_slopes, c(fun_args, dot_args)) + out <- .summarize_slopes(out) + class(out) <- c("ggjohnson_neyman", "data.frame") + + out +} + + +#' @rdname johnson_neyman +#' @export +spotlight_analysis <- johnson_neyman + + +# helper ---------------------------------------------------------------------- + + +#' @export +print.ggjohnson_neyman <- function(x, ...) { + # extract attributes + trend <- attributes(x)$trend + current_focal <- attributes(x)$by + response <- attributes(x)$response + + # iterate all intervals + for (row in seq_len(nrow(x))) { + # slice data, extract only for specific group + d <- x[row, ] + + # get bound + pos_lower <- d$Start + pos_upper <- d$End + + # check which values are significant for the slope + if (is.na(pos_lower) && is.na(pos_upper)) { + # is everything non-significant? + msg <- sprintf( + "There are no clear negative or positive associations between `%s` and `%s` for any value of `%s`.", + trend, + response, + current_focal + ) + } else if (is.na(pos_upper)) { + # only one change from significant to non-significant + direction <- ifelse(d$Confidence == "Significant", "lower", "higher") + msg <- sprintf( + "The association between `%s` and `%s` is %s for values of `%s` %s than %s.", + trend, + response, + d$Direction, + current_focal, + direction, + insight::format_value(pos_lower, protect_integers = TRUE) + ) + + unclear_direction <- ifelse(d$significant != "yes", "lower", "higher") + msg <- paste(msg, sprintf( + "There were no clear associations for values of `%s` %s than %s.", + current_focal, + unclear_direction, + insight::format_value(pos_lower, protect_integers = TRUE) + )) + } else { + # J-N interval + direction_lower <- ifelse(d$significant == "yes", "lower", "higher") + direction_higher <- ifelse(d$significant != "yes", "lower", "higher") + association_lower <- ifelse(d$slope_lower > 0, "positive", "negative") + association_higher <- ifelse(d$slope_upper > 0, "positive", "negative") + + # check whether significant range is inside or outside of that interval + if (direction_lower == "higher") { + # positive or negative associations *inside* of an interval + msg <- sprintf( + "The association between `%s` and `%s` is %s for values of `%s` that range from %s to %s.", + trend, + response, + association_lower, + current_focal, + insight::format_value(pos_lower, protect_integers = TRUE), + insight::format_value(pos_upper, protect_integers = TRUE) + ) + msg <- paste(msg, "Outside of this interval, there were no clear associations.") + } else { + # positive or negative associations *outside* of an interval + msg <- sprintf( + "The association between `%s` and `%s` is %s for values of `%s` %s than %s and %s for values %s than %s.", + colnames(x)[1], + response, + association_lower, + current_focal, + direction_lower, + insight::format_value(pos_lower, protect_integers = TRUE), + association_higher, + direction_higher, + insight::format_value(pos_upper, protect_integers = TRUE) + ) + msg <- paste(msg, sprintf( + "Inside the interval of %s, there were no clear associations.", + insight::format_ci(pos_lower, pos_upper, ci = NULL) + )) + } + } + + cat(insight::format_message(msg), "\n", sep = "") + } + + if (!is.null(p_adjust)) { + cat("\n", .format_p_adjust(p_adjust), "\n", sep = "") + } +} + + +.summarize_slopes <- function(object, verbose = TRUE, ...) { + out <- as.data.frame(object) + by <- attributes(object)$by + + if (verbose && nrow(out) < 50) { + insight::format_alert("There might be too few data to accurately determine intervals. Consider setting `length = 100` (or larger) in your call to `estimate_slopes()`.") # nolint + } + + # Add "Confidence" col based on the sig index present in the data + out$Confidence <- .estimate_slopes_significance(out, ...) + out$Direction <- .estimate_slopes_direction(out, ...) + + # if we have more than one variable in `by`, group result table and + # add group name as separate column + if (length(by) > 1) { + parts <- split(out, out[[by[2]]]) + out <- do.call(rbind, lapply(parts, .estimate_slope_parts, by = by[1])) + out <- datawizard::rownames_as_column(out, "Group") + out$Group <- gsub("\\.\\d+$", "", out$Group) + } else { + out <- .estimate_slope_parts(out, by) + } + + attributes(out) <- utils::modifyList(attributes(object), attributes(out)) + class(out) <- c("summary_estimate_slopes", "data.frame") + attr(out, "table_title") <- c("Average Marginal Effects", "blue") + + out +} + + +.estimate_slope_parts <- function(out, by) { + # mark all "changes" from negative to positive and vice versa + index <- 1 + out$switch <- index + index <- index + 1 + + for (i in 2:nrow(out)) { + if (out$Direction[i] != out$Direction[i - 1] || out$Confidence[i] != out$Confidence[i - 1]) { + out$switch[i:nrow(out)] <- index + index <- index + 1 + } + } + + # split into "switches" + parts <- split(out, out$switch) + + do.call(rbind, lapply(parts, function(i) { + data.frame( + Start = i[[by]][1], + End = i[[by]][nrow(i)], + Direction = i$Direction[1], + Confidence = i$Confidence[1] + ) + })) +} + + +.estimate_slopes_direction <- function(data, ...) { + centrality_columns <- datawizard::extract_column_names( + data, + c("Coefficient", "Slope", "Median", "Mean", "MAP_Estimate"), + verbose = FALSE + ) + ifelse(data[[centrality_columns]] < 0, "negative", "positive") +} + + +.estimate_slopes_significance <- function(x, confidence = "auto", ...) { + insight::check_if_installed("effectsize") + + if (confidence == "auto") { + # TODO: make sure all of these work + if ("BF" %in% names(x)) confidence <- "BF" + if ("p" %in% names(x)) confidence <- "p" + if ("pd" %in% names(x)) confidence <- "pd" + } + + switch(confidence, + p = tools::toTitleCase(effectsize::interpret_p(x$p, ...)), + BF = tools::toTitleCase(effectsize::interpret_bf(x$BF, ...)), + pd = tools::toTitleCase(effectsize::interpret_pd(x$pd, ...)), + { + # Based on CI + out <- ifelse((x$CI_high < 0 & x$CI_low < 0) | (x$CI_high > 0 & x$CI_low > 0), "Significant", "Uncertain") + factor(out, levels = c("Uncertain", "Significant")) + } + ) +} + + +.fdr_interaction <- function(x, focal_terms, model) { + # get names of interaction terms + pred <- focal_terms[1] + mod <- focal_terms[length(focal_terms)] + int <- paste0(pred, ":", mod) + + # variance-covariance matrix, to adjust p-values + varcov <- insight::get_varcov(model) + # Predictor variances + vcov_pred <- varcov[pred, pred] + vcov_int <- varcov[int, int] + vcov_pred_int <- varcov[pred, int] + + # Generate sequence of numbers along range of moderator + range_sequence <- seq( + from = min(x[[mod]], na.rm = TRUE), + to = max(x[[mod]], na.rm = TRUE), + by = diff(range(x[[mod]], na.rm = TRUE)) / 1000 + ) + + # get parameters, to manually calculate marginal effects + params <- insight::get_parameters(model) + beta_pred <- params$Estimate[params$Parameter == pred] + beta_int <- params$Estimate[params$Parameter == int] + + # produces a sequence of marginal effects + marginal_effects <- beta_pred + beta_int * range_sequence + # SEs of those marginal effects + me_ses <- sqrt(vcov_pred + (range_sequence^2) * vcov_int + 2 * range_sequence * vcov_pred_int) + + # t-values across range of marginal effects + statistic <- marginal_effects / me_ses + # degrees of freedom + dof <- attributes(x)$df + # Get the minimum p values used in the adjustment + pvalues <- 2 * pmin(stats::pt(statistic, df = dof), (1 - stats::pt(statistic, df = dof))) + # Multipliers + multipliers <- seq_along(marginal_effects) / length(marginal_effects) + # Order the pvals + ordered_pvalues <- order(pvalues) + + # Adapted from interactionTest package function fdrInteraction + test <- 0 + i <- 1 + length(marginal_effects) + alpha <- (1 - attributes(x)$ci_level) / 2 + + while (test == 0 && i > 1) { + i <- i - 1 + test <- min(pvalues[ordered_pvalues][1:i] <= multipliers[i] * (alpha * 2)) + } + + # updates test statistic + tcrit <- abs(stats::qt(multipliers[i] * alpha, dof)) + # update confidence intervals + standard_errors <- attributes(x)$standard_error + x$conf.low <- x$Slope - tcrit * standard_errors + x$conf.high <- x$Slope + tcrit * standard_errors + + # update p-values - we need to ensure that length of "statisic" matches number + # of rows, so we pick just as many values from "statistic" as required + range_mod <- .split_vector(range_sequence, nrow(x)) + if (length(range_mod) == length(statistic)) { + statistic <- statistic[range_mod] + # update p-values + x$p.value <- 2 * stats::pt(abs(statistic), df = dof, lower.tail = FALSE) + } + x +} + + +.split_vector <- function(x, by) { + by <- length(x) / by + r <- diff(range(x)) + out <- seq(0, abs(r - by - 1), by = by) + out <- c(round(min(x) + c(0, out - 0.51 + (max(x) - max(out)) / 2), 0), max(x)) + if (length(out) > by) { + out <- out[-sample(seq_along(out), 1)] + } + out +} diff --git a/_pkgdown.yml b/_pkgdown.yml index e1cbced0..34dd86d5 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -25,6 +25,7 @@ reference: - title: "Pairwise Comparisons, Contrasts and Marginal Effects" contents: + - johnson_neyman - test_predictions - pool_comparisons diff --git a/man/johnson_neyman.Rd b/man/johnson_neyman.Rd new file mode 100644 index 00000000..2012b325 --- /dev/null +++ b/man/johnson_neyman.Rd @@ -0,0 +1,130 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/johnson_neyman.R +\name{johnson_neyman} +\alias{johnson_neyman} +\alias{spotlight_analysis} +\title{Spotlight-analysis: Create Johnson-Neyman confidence intervals and plots} +\usage{ +johnson_neyman(x, precision = 500, p_adjust = NULL, ...) + +spotlight_analysis(x, precision = 500, p_adjust = NULL, ...) +} +\arguments{ +\item{x}{An object of class \code{ggeffects}, as returned by the functions +from this package.} + +\item{precision}{Number of values used for the range of the moderator variable +to calculate the Johnson-Neyman interval. This argument is passed down to +\code{pretty(..., n = precision)}. Usually, the default value of 500 is sufficient. +Increasing this value will result in a smoother plot and more accurate values +for the interval bounds, but can also slightly increase the computation time.} + +\item{p_adjust}{Character vector, if not \code{NULL}, indicates the method to +adjust p-values. See \code{\link[stats:p.adjust]{stats::p.adjust()}} or \code{\link[stats:p.adjust]{stats::p.adjust.methods}} +for details. Further possible adjustment methods are \code{"tukey"} or \code{"sidak"}, +and for \code{johnson_neyman()}, \code{"fdr"} (or \code{"bh"}) and \code{"esarey"} (or its +short-cut \code{"es"}) are available options. Some caution is necessary when +adjusting p-value for multiple comparisons. See also section \emph{P-value adjustment} +below.} + +\item{...}{Arguments passed down to \code{\link[=test_predictions]{test_predictions()}} (and then probably +further to \code{\link[marginaleffects:slopes]{marginaleffects::slopes()}}). See \code{?test_predictions} for further +details.} + +\item{colors}{Colors used for the plot. Must be a vector with two color +values. Only used if \code{show_association = TRUE}.} + +\item{show_association}{Logical, if \code{TRUE}, highlights the range where values +of the moderator are positively or negtatively associated with the outcome.} + +\item{show_rug}{Logical, if \code{TRUE}, adds a rug with raw data of the moderator +variable to the plot. This helps visualizing its distribution.} + +\item{verbose}{Show/hide printed message for plots.} +} +\value{ +A data frame including contrasts of the \code{\link[=test_predictions]{test_predictions()}} for the +given interaction terms; for \code{plot()}, returns a Johnson-Neyman plot. +} +\description{ +Function conduct a spotlight-analysis to create so-called +Johnson-Neyman intervals. The \code{plot()} method can be used to visualize the +results of the Johnson-Neyman test. +} +\details{ +The Johnson-Neyman intervals help to understand where slopes are significant +in the context of interactions in regression models. Thus, the interval is only +useful if the model contains at least one interaction term. The function +accepts the results of a call to \code{predict_response()}. The \emph{first} and the +\emph{last} focal term used in the \code{terms} argument of \code{predict_response()} must +be numeric. The function will then test the slopes of the first focal terms +against zero, for different moderator values of the last focal term. If only +one numeric focal term is given, the function will create contrasts by levels +of the categorical focal term. Use \code{plot()} to create a plot of the results. + +To avoid misleading interpretations of the plot, we speak of "positive" and +"negative" associations, respectively, and "no clear" associations (instead +of "significant" or "non-significant"). This should prevent the user from +considering a non-significant range of values of the moderator as "accepting +the null hypothesis". +} +\section{P-value adjustment for multiple comparisons}{ + + +Note that p-value adjustment for methods supported by \code{p.adjust()} (see also +\code{p.adjust.methods}), each row is considered as one set of comparisons, no +matter which \code{test} was specified. That is, for instance, when \code{test_predictions()} +returns eight rows of predictions (when \code{test = NULL}), and \code{p_adjust = "bonferroni"}, +the p-values are adjusted in the same way as if we had a test of pairwise +comparisons (\code{test = "pairwise"}) where eight rows of comparisons are +returned. For methods \code{"tukey"} or \code{"sidak"}, a rank adjustment is done +based on the number of combinations of levels from the focal predictors +in \code{terms}. Thus, the latter two methods may be useful for certain tests +only, in particular pairwise comparisons. + +For \code{johnson_neyman()}, the only available adjustment methods are \code{"fdr"} +(or \code{"bh"}) (\emph{Benjamini & Hochberg (1995)}) and \code{"esarey"} (or \code{"es"}) +(\emph{Esarey and Sumner 2017}). These usually return similar results. The major +difference is that \code{"fdr"} can be slightly faster and more stable in edge +cases, however, confidence intervals are not updated. Only the p-values are +adjusted. \code{"esarey"} is slower, but confidence intervals are updated as well. +} + +\examples{ +\dontshow{if (all(insight::check_if_installed(c("ggplot2", "marginaleffects", "modelbased"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontrun{ +data(efc, package = "ggeffects") +m <- lm(neg_c_7 ~ c12hour * barthtot, data = efc) + +pr <- predict_response(m, c("c12hour", "barthtot")) +johnson_neyman(pr) +plot(johnson_neyman(pr)) + +# robust standard errors +if (requireNamespace("sandwich")) { + johnson_neyman(pr, vcov = sandwich::vcovHC) +} +} +\dontshow{\}) # examplesIf} +} +\references{ +Bauer, D. J., & Curran, P. J. (2005). Probing interactions in fixed and +multilevel regression: Inferential and graphical techniques. Multivariate +Behavioral Research, 40(3), 373-400. doi: 10.1207/s15327906mbr4003_5 + +Esarey, J., & Sumner, J. L. (2017). Marginal effects in interaction models: +Determining and controlling the false positive rate. Comparative Political +Studies, 1–33. Advance online publication. doi: 10.1177/0010414017730080 + +Johnson, P.O. & Fay, L.C. (1950). The Johnson-Neyman technique, its theory +and application. Psychometrika, 15, 349-367. doi: 10.1007/BF02288864 + +McCabe CJ, Kim DS, King KM. Improving Present Practices in the Visual Display +of Interactions. Advances in Methods and Practices in Psychological Science. +2018;1(2):147-165. doi:10.1177/2515245917746792 + +Spiller, S. A., Fitzsimons, G. J., Lynch, J. G., & McClelland, G. H. (2013). +Spotlights, Floodlights, and the Magic Number Zero: Simple Effects Tests in +Moderated Regression. Journal of Marketing Research, 50(2), 277–288. +doi:10.1509/jmr.12.0420 +} diff --git a/tests/testthat/test-johnson_neyman.R b/tests/testthat/test-johnson_neyman.R new file mode 100644 index 00000000..09e1cfc0 --- /dev/null +++ b/tests/testthat/test-johnson_neyman.R @@ -0,0 +1,180 @@ +skip_on_cran() +skip_on_os(c("mac", "solaris")) +skip_if_not_installed("marginaleffects") +skip_if(getRversion() < "4.3.0") + +data(efc, package = "ggeffects") +m2 <- lm(c12hour ~ neg_c_7 * barthtot, data = efc) +m3 <- lm(neg_c_7 ~ c12hour * barthtot, data = efc) + +states <- as.data.frame(state.x77) +states$HSGrad <- states$`HS Grad` +m4 <- lm(Income ~ HSGrad + Murder * Illiteracy, + data = states +) + +test_that("ggpredict, johnson_neyman, 2 focal terms, inside interval", { + pr <- ggpredict(m2, c("neg_c_7", "barthtot")) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + expect_identical( + out, + c( + "The association between `neg_c_7` and `c12hour` is positive for values", + " of `barthtot` that range from 46 to 49. Outside of this interval, there", + " were no clear associations." + ) + ) +}) + +test_that("ggpredict, johnson_neyman, 2 focal terms, one direction", { + pr <- ggpredict(m3, c("c12hour", "barthtot")) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + expect_identical( + out, + c( + "The association between `c12hour` and `neg_c_7` is positive for values", + " of `barthtot` higher than 48. There were no clear associations for", + " values of `barthtot` lower than 48." + ) + ) +}) + +test_that("ggpredict, johnson_neyman, 2 focal terms, outside interval", { + pr <- ggpredict(m4, c("Murder", "Illiteracy")) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + expect_identical( + out, + c( + "The association between `Murder` and `Income` is positive for values of", + " `Illiteracy` lower than 0.78 and negative for values higher than 2.66.", + " Inside the interval of [0.78, 2.66], there were no clear associations." + ) + ) +}) + +test_that("ggpredict, johnson_neyman, 3 focal terms", { + pr <- ggpredict(m1, c("c12hour", "c172code", "barthtot")) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + expect_identical( + out, + c( + "# Level `c172code = 1`", + "The association between `c12hour` and `neg_c_7` is negative for values", + " of `barthtot` lower than 47. There were no clear associations for values", + " of `barthtot` higher than 47.", + "", + "# Level `c172code = 2`", + "The association between `c12hour` and `neg_c_7` is positive for values", + " of `barthtot` higher than 33. There were no clear associations for", + " values of `barthtot` lower than 33.", + "", + "# Level `c172code = 3`", + "There are no clear negative or positive associations between `c12hour`", + " and `neg_c_7` for any value of `barthtot`." + ) + ) +}) + +test_that("ggpredict, johnson_neyman, p-adjustment", { + pr <- ggpredict(m1, c("c12hour", "barthtot")) + out1 <- johnson_neyman(pr, p_adjust = "es", precision = 100) + out2 <- johnson_neyman(pr, precision = 100) + out3 <- johnson_neyman(pr, p_adjust = "bh", precision = 100) + expect_identical(attributes(out1)$intervals$pos_lower, 38) + expect_identical(attributes(out2)$intervals$pos_lower, 47) + expect_identical(attributes(out3)$intervals$pos_lower, 38) + out <- utils::capture.output(print(out1)) + expect_identical( + out, + c( + "The association between `c12hour` and `neg_c_7` is negative for values", + " of `barthtot` lower than 38. There were no clear associations for values", + " of `barthtot` higher than 38.", + "", + "P-values were adjusted using the Esarey & Sumner (2017) method." + ) + ) + out <- utils::capture.output(print(out3)) + expect_identical( + out, + c( + "The association between `c12hour` and `neg_c_7` is negative for values", + " of `barthtot` lower than 38. There were no clear associations for values", + " of `barthtot` higher than 38.", + "", + "P-values were adjusted using the Benjamini & Hochberg (1995) method." + ) + ) + expect_error(johnson_neyman(pr, p_adjust = "bonferroni"), regex = "Invalid option for argument") +}) + +test_that("ggpredict, johnson_neyman, p-adjustment, glm", { + data(efc, package = "ggeffects") + efc$neg_c_7d <- as.numeric(efc$neg_c_7 > median(efc$neg_c_7, na.rm = TRUE)) + d <- efc + fit <- glm(neg_c_7d ~ c12hour * barthtot, data = d, family = binomial(link = "logit")) + pr <- ggpredict(fit, terms = c("c12hour", "barthtot"), verbose = FALSE) + out1 <- johnson_neyman(pr, p_adjust = "es", precision = 100) + out2 <- johnson_neyman(pr, precision = 100) + out3 <- johnson_neyman(pr, p_adjust = "bh", precision = 100) + expect_identical(attributes(out1)$intervals$pos_lower, NA_real_) + expect_identical(attributes(out2)$intervals$pos_lower, 68) + expect_identical(attributes(out3)$intervals$pos_lower, NA_real_) + out <- utils::capture.output(print(out1)) + expect_identical( + out, + c( + "There are no clear negative or positive associations between `c12hour`", + " and `neg_c_7d` for any value of `barthtot`.", + "", + "P-values were adjusted using the Esarey & Sumner (2017) method." + ) + ) +}) + +test_that("ggpredict, johnson_neyman, p-adjustment, df and vcov", { + data(efc, package = "ggeffects") + efc$c172code <- as.factor(efc$c172code) + m1 <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc) + pr <- ggpredict(m1, c("c12hour", "barthtot")) + out1 <- johnson_neyman(pr, precision = 100) + out2 <- johnson_neyman(pr, p_adjust = "esarey", precision = 100) + out3 <- johnson_neyman(pr, p_adjust = "esarey", df = 100, precision = 100) + out4 <- johnson_neyman(pr, p_adjust = "esarey", vcov = "HC1", precision = 100) + out5 <- johnson_neyman(pr, p_adjust = "esarey", vcov = "HC1", df = 100, precision = 100) + expect_equal( + head(out1$conf.low), + c(-0.04875, -0.04811, -0.04748, -0.04685, -0.04622, -0.04559), + tolerance = 1e-3 + ) + expect_equal( + head(out2$conf.low), + c(-0.05278, -0.05209, -0.0514, -0.05071, -0.05003, -0.04935), + tolerance = 1e-3 + ) + expect_equal( + head(out3$conf.low), + c(-0.05329, -0.0526, -0.0519, -0.05121, -0.05052, -0.04983), + tolerance = 1e-3 + ) + expect_equal( + head(out4$conf.low), + c(-0.05465, -0.05397, -0.05329, -0.05261, -0.05193, -0.05126), + tolerance = 1e-3 + ) + expect_equal( + head(out5$conf.low), + c(-0.0552, -0.05452, -0.05383, -0.05314, -0.05246, -0.05178), + tolerance = 1e-3 + ) +}) + +test_that("ggpredict, johnson_neyman, p-adjustment, df and vcov", { + data(efc, package = "ggeffects") + efc$c172code <- as.factor(efc$c172code) + m <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc) + pr <- predict_response(m, c("c12hour", "c172code", "barthtot")) + out <- johnson_neyman(pr, vcov = sandwich::vcovHC) + expect_s3_class(out, "ggjohnson_neyman") + expect_identical(dim(out), c(1503L, 8L)) +}) From ca8c300ba8fe4f24d9fb2291f3504d888a612046 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 4 Feb 2025 17:32:17 +0100 Subject: [PATCH 25/51] fix --- R/johnson_neyman.R | 156 ++++++++++++++------------- tests/testthat/test-johnson_neyman.R | 15 +++ 2 files changed, 99 insertions(+), 72 deletions(-) diff --git a/R/johnson_neyman.R b/R/johnson_neyman.R index 1bdde83d..68814476 100644 --- a/R/johnson_neyman.R +++ b/R/johnson_neyman.R @@ -160,90 +160,104 @@ spotlight_analysis <- johnson_neyman #' @export print.ggjohnson_neyman <- function(x, ...) { # extract attributes + model_data <- insight::get_data(attributes(x)$model, source = "mf", verbose = FALSE) trend <- attributes(x)$trend - current_focal <- attributes(x)$by + current_focal <- attributes(x)$by[1] response <- attributes(x)$response + group_variable <- attributes(x)$group - # iterate all intervals - for (row in seq_len(nrow(x))) { - # slice data, extract only for specific group - d <- x[row, ] - - # get bound - pos_lower <- d$Start - pos_upper <- d$End - - # check which values are significant for the slope - if (is.na(pos_lower) && is.na(pos_upper)) { - # is everything non-significant? - msg <- sprintf( - "There are no clear negative or positive associations between `%s` and `%s` for any value of `%s`.", - trend, - response, - current_focal - ) - } else if (is.na(pos_upper)) { - # only one change from significant to non-significant - direction <- ifelse(d$Confidence == "Significant", "lower", "higher") - msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` %s than %s.", - trend, - response, - d$Direction, - current_focal, - direction, - insight::format_value(pos_lower, protect_integers = TRUE) - ) - - unclear_direction <- ifelse(d$significant != "yes", "lower", "higher") - msg <- paste(msg, sprintf( - "There were no clear associations for values of `%s` %s than %s.", - current_focal, - unclear_direction, - insight::format_value(pos_lower, protect_integers = TRUE) - )) - } else { - # J-N interval - direction_lower <- ifelse(d$significant == "yes", "lower", "higher") - direction_higher <- ifelse(d$significant != "yes", "lower", "higher") - association_lower <- ifelse(d$slope_lower > 0, "positive", "negative") - association_higher <- ifelse(d$slope_upper > 0, "positive", "negative") - - # check whether significant range is inside or outside of that interval - if (direction_lower == "higher") { - # positive or negative associations *inside* of an interval + if ("Group" %in% colnames(x)) { + groups <- split(x, x$Group) + } else { + groups <- as.list(x) + } + + for (gr in groups) { + # add "header" for groups + if (group != "jn_no_group") { + insight::print_color(sprintf("# Level `%s`\n", group), color = "blue") + } + # iterate all intervals + for (row in seq_len(nrow(gr))) { + # slice data, extract only for specific group + d <- gr[row, ] + + # get bound + pos_lower <- d$Start + pos_upper <- d$End + + # check which values are significant for the slope + if (is.na(pos_lower) && is.na(pos_upper)) { + # is everything non-significant? msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` that range from %s to %s.", + "There are no clear negative or positive associations between `%s` and `%s` for any value of `%s`.", trend, response, - association_lower, - current_focal, - insight::format_value(pos_lower, protect_integers = TRUE), - insight::format_value(pos_upper, protect_integers = TRUE) + current_focal ) - msg <- paste(msg, "Outside of this interval, there were no clear associations.") - } else { - # positive or negative associations *outside* of an interval + } else if (is.na(pos_upper)) { + # only one change from significant to non-significant + direction <- ifelse(d$Confidence == "Significant", "lower", "higher") msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` %s than %s and %s for values %s than %s.", - colnames(x)[1], + "The association between `%s` and `%s` is %s for values of `%s` %s than %s.", + trend, response, - association_lower, + d$Direction, current_focal, - direction_lower, - insight::format_value(pos_lower, protect_integers = TRUE), - association_higher, - direction_higher, - insight::format_value(pos_upper, protect_integers = TRUE) + direction, + insight::format_value(pos_lower, protect_integers = TRUE) ) + + unclear_direction <- ifelse(d$significant != "yes", "lower", "higher") msg <- paste(msg, sprintf( - "Inside the interval of %s, there were no clear associations.", - insight::format_ci(pos_lower, pos_upper, ci = NULL) + "There were no clear associations for values of `%s` %s than %s.", + current_focal, + unclear_direction, + insight::format_value(pos_lower, protect_integers = TRUE) )) + } else { + # J-N interval + direction_lower <- ifelse(d$significant == "yes", "lower", "higher") + direction_higher <- ifelse(d$significant != "yes", "lower", "higher") + association_lower <- ifelse(d$slope_lower > 0, "positive", "negative") + association_higher <- ifelse(d$slope_upper > 0, "positive", "negative") + + # check whether significant range is inside or outside of that interval + if (direction_lower == "higher") { + # positive or negative associations *inside* of an interval + msg <- sprintf( + "The association between `%s` and `%s` is %s for values of `%s` that range from %s to %s.", + trend, + response, + association_lower, + current_focal, + insight::format_value(pos_lower, protect_integers = TRUE), + insight::format_value(pos_upper, protect_integers = TRUE) + ) + msg <- paste(msg, "Outside of this interval, there were no clear associations.") + } else { + # positive or negative associations *outside* of an interval + msg <- sprintf( + "The association between `%s` and `%s` is %s for values of `%s` %s than %s and %s for values %s than %s.", + colnames(x)[1], + response, + association_lower, + current_focal, + direction_lower, + insight::format_value(pos_lower, protect_integers = TRUE), + association_higher, + direction_higher, + insight::format_value(pos_upper, protect_integers = TRUE) + ) + msg <- paste(msg, sprintf( + "Inside the interval of %s, there were no clear associations.", + insight::format_ci(pos_lower, pos_upper, ci = NULL) + )) + } } - } - cat(insight::format_message(msg), "\n", sep = "") + cat(insight::format_message(msg), "\n", sep = "") + } } if (!is.null(p_adjust)) { @@ -271,14 +285,12 @@ print.ggjohnson_neyman <- function(x, ...) { out <- do.call(rbind, lapply(parts, .estimate_slope_parts, by = by[1])) out <- datawizard::rownames_as_column(out, "Group") out$Group <- gsub("\\.\\d+$", "", out$Group) + attr(out, "group") <- by[2] } else { out <- .estimate_slope_parts(out, by) } attributes(out) <- utils::modifyList(attributes(object), attributes(out)) - class(out) <- c("summary_estimate_slopes", "data.frame") - attr(out, "table_title") <- c("Average Marginal Effects", "blue") - out } diff --git a/tests/testthat/test-johnson_neyman.R b/tests/testthat/test-johnson_neyman.R index 09e1cfc0..3cabcf57 100644 --- a/tests/testthat/test-johnson_neyman.R +++ b/tests/testthat/test-johnson_neyman.R @@ -4,6 +4,8 @@ skip_if_not_installed("marginaleffects") skip_if(getRversion() < "4.3.0") data(efc, package = "ggeffects") +efc$c172code <- as.factor(efc$c172code) +m1 <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc) m2 <- lm(c12hour ~ neg_c_7 * barthtot, data = efc) m3 <- lm(neg_c_7 ~ c12hour * barthtot, data = efc) @@ -13,6 +15,19 @@ m4 <- lm(Income ~ HSGrad + Murder * Illiteracy, data = states ) +test_that("ggpredict, johnson_neyman, 2 focal terms, inside interval", { + pr <- ggpredict(m1, c("c12hour", "barthtot", "c172code")) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + expect_identical( + out, + c( + "The association between `neg_c_7` and `c12hour` is positive for values", + " of `barthtot` that range from 46 to 49. Outside of this interval, there", + " were no clear associations." + ) + ) +}) + test_that("ggpredict, johnson_neyman, 2 focal terms, inside interval", { pr <- ggpredict(m2, c("neg_c_7", "barthtot")) out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) From 2210774e18a3e6ca7f179ad6cea3ca458a9bf5e8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 12:14:48 +0100 Subject: [PATCH 26/51] fix --- R/johnson_neyman.R | 158 +++++++++++++-------------- ggeffects.Rproj | 1 + tests/testthat/test-johnson_neyman.R | 2 +- 3 files changed, 77 insertions(+), 84 deletions(-) diff --git a/R/johnson_neyman.R b/R/johnson_neyman.R index 68814476..e3da01a6 100644 --- a/R/johnson_neyman.R +++ b/R/johnson_neyman.R @@ -165,99 +165,91 @@ print.ggjohnson_neyman <- function(x, ...) { current_focal <- attributes(x)$by[1] response <- attributes(x)$response group_variable <- attributes(x)$group + p_adjust <- attributes(x)$p_adjust if ("Group" %in% colnames(x)) { groups <- split(x, x$Group) } else { - groups <- as.list(x) + groups <- list(x) } for (gr in groups) { # add "header" for groups - if (group != "jn_no_group") { - insight::print_color(sprintf("# Level `%s`\n", group), color = "blue") + if ("Group" %in% colnames(gr)) { + insight::print_color(sprintf("# Level `%s`\n", gr$Group[1]), color = "blue") } - # iterate all intervals - for (row in seq_len(nrow(gr))) { - # slice data, extract only for specific group - d <- gr[row, ] - - # get bound - pos_lower <- d$Start - pos_upper <- d$End - - # check which values are significant for the slope - if (is.na(pos_lower) && is.na(pos_upper)) { - # is everything non-significant? - msg <- sprintf( - "There are no clear negative or positive associations between `%s` and `%s` for any value of `%s`.", - trend, - response, - current_focal - ) - } else if (is.na(pos_upper)) { - # only one change from significant to non-significant - direction <- ifelse(d$Confidence == "Significant", "lower", "higher") - msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` %s than %s.", - trend, - response, - d$Direction, - current_focal, - direction, - insight::format_value(pos_lower, protect_integers = TRUE) - ) - - unclear_direction <- ifelse(d$significant != "yes", "lower", "higher") - msg <- paste(msg, sprintf( - "There were no clear associations for values of `%s` %s than %s.", - current_focal, - unclear_direction, - insight::format_value(pos_lower, protect_integers = TRUE) - )) - } else { - # J-N interval - direction_lower <- ifelse(d$significant == "yes", "lower", "higher") - direction_higher <- ifelse(d$significant != "yes", "lower", "higher") - association_lower <- ifelse(d$slope_lower > 0, "positive", "negative") - association_higher <- ifelse(d$slope_upper > 0, "positive", "negative") - - # check whether significant range is inside or outside of that interval - if (direction_lower == "higher") { - # positive or negative associations *inside* of an interval - msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` that range from %s to %s.", - trend, - response, - association_lower, - current_focal, - insight::format_value(pos_lower, protect_integers = TRUE), - insight::format_value(pos_upper, protect_integers = TRUE) - ) - msg <- paste(msg, "Outside of this interval, there were no clear associations.") - } else { - # positive or negative associations *outside* of an interval - msg <- sprintf( - "The association between `%s` and `%s` is %s for values of `%s` %s than %s and %s for values %s than %s.", - colnames(x)[1], - response, - association_lower, - current_focal, - direction_lower, - insight::format_value(pos_lower, protect_integers = TRUE), - association_higher, - direction_higher, - insight::format_value(pos_upper, protect_integers = TRUE) - ) - msg <- paste(msg, sprintf( - "Inside the interval of %s, there were no clear associations.", - insight::format_ci(pos_lower, pos_upper, ci = NULL) - )) - } - } - - cat(insight::format_message(msg), "\n", sep = "") + + # find significant rows + sig_rows <- which(gr$Confidence == "Significant") + + # get bound + pos_lower <- gr$Start[sig_rows] + pos_upper <- gr$End[sig_rows] + + # check which values are significant for the slope + if (!length(sig_rows)) { + # is everything non-significant? + msg <- sprintf( + "There are no clear negative or positive associations between `%s` and `%s` for any value of `%s`.", + trend, + response, + current_focal + ) + } else if (all(sig_rows == 1) || all(sig_rows == nrow(gr))) { + # only one change from significant to non-significant + direction <- ifelse(all(sig_rows == nrow(gr)), "higher", "lower") + cut_off <- ifelse(all(sig_rows == nrow(gr)), pos_lower, pos_upper) + + msg <- sprintf( + "The association between `%s` and `%s` is %s for values of `%s` %s than %s.", + trend, + response, + gr$Direction[sig_rows], + current_focal, + direction, + insight::format_value(cut_off, protect_integers = TRUE) + ) + + unclear_direction <- ifelse(all(sig_rows == nrow(gr)), "lower", "higher") + cut_off <- ifelse(all(sig_rows == nrow(gr)), pos_lower, pos_upper) + + msg <- paste(msg, sprintf( + "There were no clear associations for values of `%s` %s than %s.", + current_focal, + unclear_direction, + insight::format_value(cut_off, protect_integers = TRUE) + )) + } else if (length(sig_rows) == 1) { + # positive or negative associations *inside* of an interval + msg <- sprintf( + "The association between `%s` and `%s` is %s for values of `%s` that range from %s to %s.", + trend, + response, + gr$Direction[sig_rows], + current_focal, + insight::format_value(pos_lower, protect_integers = TRUE), + insight::format_value(pos_upper, protect_integers = TRUE) + ) + msg <- paste(msg, "Outside of this interval, there were no clear associations.") + } else { + # positive or negative associations *outside* of an interval + msg <- sprintf( + "The association between `%s` and `%s` is %s for values of `%s` lower than %s and %s for values higher than %s.", + colnames(x)[1], + response, + gr$Direction[sig_rows[1]], + current_focal, + insight::format_value(pos_upper[1], protect_integers = TRUE), + gr$Direction[sig_rows[2]], + insight::format_value(pos_lower[2], protect_integers = TRUE) + ) + msg <- paste(msg, sprintf( + "Inside the interval of %s, there were no clear associations.", + insight::format_ci(pos_upper[1], pos_lower[2], ci = NULL) + )) } + + cat(insight::format_message(msg), "\n\n", sep = "") } if (!is.null(p_adjust)) { diff --git a/ggeffects.Rproj b/ggeffects.Rproj index 4d50ad14..d6aafe34 100644 --- a/ggeffects.Rproj +++ b/ggeffects.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 593cc7ba-0309-4f23-8141-dbd76a56975a RestoreWorkspace: Default SaveWorkspace: Default diff --git a/tests/testthat/test-johnson_neyman.R b/tests/testthat/test-johnson_neyman.R index 3cabcf57..6012ae67 100644 --- a/tests/testthat/test-johnson_neyman.R +++ b/tests/testthat/test-johnson_neyman.R @@ -68,7 +68,7 @@ test_that("ggpredict, johnson_neyman, 2 focal terms, outside interval", { }) test_that("ggpredict, johnson_neyman, 3 focal terms", { - pr <- ggpredict(m1, c("c12hour", "c172code", "barthtot")) + pr <- ggpredict(m1, c("c12hour", "barthtot", "c172code")) out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) expect_identical( out, From f35c988a80d5fe65c35d7f0d28baaa2e1f02c960 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 12:23:51 +0100 Subject: [PATCH 27/51] update tests --- tests/testthat/test-johnson_neyman.R | 161 ++++----------------------- 1 file changed, 24 insertions(+), 137 deletions(-) diff --git a/tests/testthat/test-johnson_neyman.R b/tests/testthat/test-johnson_neyman.R index 6012ae67..dfccf219 100644 --- a/tests/testthat/test-johnson_neyman.R +++ b/tests/testthat/test-johnson_neyman.R @@ -15,28 +15,16 @@ m4 <- lm(Income ~ HSGrad + Murder * Illiteracy, data = states ) -test_that("ggpredict, johnson_neyman, 2 focal terms, inside interval", { - pr <- ggpredict(m1, c("c12hour", "barthtot", "c172code")) - out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) - expect_identical( - out, - c( - "The association between `neg_c_7` and `c12hour` is positive for values", - " of `barthtot` that range from 46 to 49. Outside of this interval, there", - " were no clear associations." - ) - ) -}) - test_that("ggpredict, johnson_neyman, 2 focal terms, inside interval", { pr <- ggpredict(m2, c("neg_c_7", "barthtot")) out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) expect_identical( out, c( - "The association between `neg_c_7` and `c12hour` is positive for values", - " of `barthtot` that range from 46 to 49. Outside of this interval, there", - " were no clear associations." + "The association between `neg_c_7` and `c12hour` is positive for values of", + " `barthtot` that range from 46.46 to 49.49. Outside of this interval, there", + " were no clear associations.", + "" ) ) }) @@ -47,9 +35,10 @@ test_that("ggpredict, johnson_neyman, 2 focal terms, one direction", { expect_identical( out, c( - "The association between `c12hour` and `neg_c_7` is positive for values", - " of `barthtot` higher than 48. There were no clear associations for", - " values of `barthtot` lower than 48." + "The association between `c12hour` and `neg_c_7` is positive for values of", + " `barthtot` higher than 48.48. There were no clear associations for values", + " of `barthtot` lower than 48.48.", + "" ) ) }) @@ -60,9 +49,10 @@ test_that("ggpredict, johnson_neyman, 2 focal terms, outside interval", { expect_identical( out, c( - "The association between `Murder` and `Income` is positive for values of", - " `Illiteracy` lower than 0.78 and negative for values higher than 2.66.", - " Inside the interval of [0.78, 2.66], there were no clear associations." + "The association between `Start` and `Income` is positive for values of", + " `Illiteracy` lower than 0.80 and negative for values higher than 2.59.", + " Inside the interval of [0.80, 2.59], there were no clear associations.", + "" ) ) }) @@ -73,123 +63,20 @@ test_that("ggpredict, johnson_neyman, 3 focal terms", { expect_identical( out, c( - "# Level `c172code = 1`", - "The association between `c12hour` and `neg_c_7` is negative for values", - " of `barthtot` lower than 47. There were no clear associations for values", - " of `barthtot` higher than 47.", + "# Level `1`", + "The association between `c12hour` and `neg_c_7` is negative for values of", + " `barthtot` lower than 46.46. There were no clear associations for values of", + " `barthtot` higher than 46.46.", "", - "# Level `c172code = 2`", - "The association between `c12hour` and `neg_c_7` is positive for values", - " of `barthtot` higher than 33. There were no clear associations for", - " values of `barthtot` lower than 33.", + "# Level `2`", + "The association between `c12hour` and `neg_c_7` is positive for values of", + " `barthtot` higher than 34.34. There were no clear associations for values", + " of `barthtot` lower than 34.34.", "", - "# Level `c172code = 3`", - "There are no clear negative or positive associations between `c12hour`", - " and `neg_c_7` for any value of `barthtot`." + "# Level `3`", + "There are no clear negative or positive associations between `c12hour` and", + " `neg_c_7` for any value of `barthtot`.", + "" ) ) }) - -test_that("ggpredict, johnson_neyman, p-adjustment", { - pr <- ggpredict(m1, c("c12hour", "barthtot")) - out1 <- johnson_neyman(pr, p_adjust = "es", precision = 100) - out2 <- johnson_neyman(pr, precision = 100) - out3 <- johnson_neyman(pr, p_adjust = "bh", precision = 100) - expect_identical(attributes(out1)$intervals$pos_lower, 38) - expect_identical(attributes(out2)$intervals$pos_lower, 47) - expect_identical(attributes(out3)$intervals$pos_lower, 38) - out <- utils::capture.output(print(out1)) - expect_identical( - out, - c( - "The association between `c12hour` and `neg_c_7` is negative for values", - " of `barthtot` lower than 38. There were no clear associations for values", - " of `barthtot` higher than 38.", - "", - "P-values were adjusted using the Esarey & Sumner (2017) method." - ) - ) - out <- utils::capture.output(print(out3)) - expect_identical( - out, - c( - "The association between `c12hour` and `neg_c_7` is negative for values", - " of `barthtot` lower than 38. There were no clear associations for values", - " of `barthtot` higher than 38.", - "", - "P-values were adjusted using the Benjamini & Hochberg (1995) method." - ) - ) - expect_error(johnson_neyman(pr, p_adjust = "bonferroni"), regex = "Invalid option for argument") -}) - -test_that("ggpredict, johnson_neyman, p-adjustment, glm", { - data(efc, package = "ggeffects") - efc$neg_c_7d <- as.numeric(efc$neg_c_7 > median(efc$neg_c_7, na.rm = TRUE)) - d <- efc - fit <- glm(neg_c_7d ~ c12hour * barthtot, data = d, family = binomial(link = "logit")) - pr <- ggpredict(fit, terms = c("c12hour", "barthtot"), verbose = FALSE) - out1 <- johnson_neyman(pr, p_adjust = "es", precision = 100) - out2 <- johnson_neyman(pr, precision = 100) - out3 <- johnson_neyman(pr, p_adjust = "bh", precision = 100) - expect_identical(attributes(out1)$intervals$pos_lower, NA_real_) - expect_identical(attributes(out2)$intervals$pos_lower, 68) - expect_identical(attributes(out3)$intervals$pos_lower, NA_real_) - out <- utils::capture.output(print(out1)) - expect_identical( - out, - c( - "There are no clear negative or positive associations between `c12hour`", - " and `neg_c_7d` for any value of `barthtot`.", - "", - "P-values were adjusted using the Esarey & Sumner (2017) method." - ) - ) -}) - -test_that("ggpredict, johnson_neyman, p-adjustment, df and vcov", { - data(efc, package = "ggeffects") - efc$c172code <- as.factor(efc$c172code) - m1 <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc) - pr <- ggpredict(m1, c("c12hour", "barthtot")) - out1 <- johnson_neyman(pr, precision = 100) - out2 <- johnson_neyman(pr, p_adjust = "esarey", precision = 100) - out3 <- johnson_neyman(pr, p_adjust = "esarey", df = 100, precision = 100) - out4 <- johnson_neyman(pr, p_adjust = "esarey", vcov = "HC1", precision = 100) - out5 <- johnson_neyman(pr, p_adjust = "esarey", vcov = "HC1", df = 100, precision = 100) - expect_equal( - head(out1$conf.low), - c(-0.04875, -0.04811, -0.04748, -0.04685, -0.04622, -0.04559), - tolerance = 1e-3 - ) - expect_equal( - head(out2$conf.low), - c(-0.05278, -0.05209, -0.0514, -0.05071, -0.05003, -0.04935), - tolerance = 1e-3 - ) - expect_equal( - head(out3$conf.low), - c(-0.05329, -0.0526, -0.0519, -0.05121, -0.05052, -0.04983), - tolerance = 1e-3 - ) - expect_equal( - head(out4$conf.low), - c(-0.05465, -0.05397, -0.05329, -0.05261, -0.05193, -0.05126), - tolerance = 1e-3 - ) - expect_equal( - head(out5$conf.low), - c(-0.0552, -0.05452, -0.05383, -0.05314, -0.05246, -0.05178), - tolerance = 1e-3 - ) -}) - -test_that("ggpredict, johnson_neyman, p-adjustment, df and vcov", { - data(efc, package = "ggeffects") - efc$c172code <- as.factor(efc$c172code) - m <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc) - pr <- predict_response(m, c("c12hour", "c172code", "barthtot")) - out <- johnson_neyman(pr, vcov = sandwich::vcovHC) - expect_s3_class(out, "ggjohnson_neyman") - expect_identical(dim(out), c(1503L, 8L)) -}) From 067d05eb7f1a0bccc44bfe0e0ce4453787fbfaa0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 14:15:22 +0100 Subject: [PATCH 28/51] version --- DESCRIPTION | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 313e6ced..2e8630fd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -64,7 +64,7 @@ Suggests: logistf, logitr, marginaleffects (>= 0.25.0), - modelbased, + modelbased (>= 0.9.0), MASS, Matrix, mice, @@ -110,4 +110,3 @@ Config/testthat/edition: 3 Roxygen: list(markdown = TRUE) License: MIT + file LICENSE LazyData: true -Remotes: vincentarelbundock/marginaleffects, easystats/modelbased#369 From 94c6832475544a0c727d93478e203c7b60f83ad0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 16:16:19 +0100 Subject: [PATCH 29/51] update tests --- R/johnson_neyman.R | 2 +- tests/testthat/test-fixest.R | 6 ---- tests/testthat/test-johnson_neyman.R | 46 +++++++++++++++------------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/R/johnson_neyman.R b/R/johnson_neyman.R index e3da01a6..7d463d78 100644 --- a/R/johnson_neyman.R +++ b/R/johnson_neyman.R @@ -249,7 +249,7 @@ print.ggjohnson_neyman <- function(x, ...) { )) } - cat(insight::format_message(msg), "\n\n", sep = "") + cat(insight::format_message(msg, ...), "\n\n", sep = "") } if (!is.null(p_adjust)) { diff --git a/tests/testthat/test-fixest.R b/tests/testthat/test-fixest.R index b92b1d23..874d6d6c 100644 --- a/tests/testthat/test-fixest.R +++ b/tests/testthat/test-fixest.R @@ -35,10 +35,6 @@ test_that("fixest", { tolerance = 1e-4 ) - comp <- test_predictions(pr) - expect_equal(comp$Slope, -136389.1, tolerance = 1) - expect_error(test_predictions(pr, engine = "ggeffects")) - pr <- ggpredict(m2, "Petal.Length", verbose = FALSE) expect_equal( pr$predicted, @@ -56,8 +52,6 @@ test_that("fixest", { ignore_attr = TRUE, tolerance = 1e-4 ) - comp <- test_predictions(pr) - expect_equal(comp$Slope, 94.36154, tolerance = 1) pr <- ggpredict(m2, "Petal.Length", verbose = FALSE, vcov = "iid") expect_equal( diff --git a/tests/testthat/test-johnson_neyman.R b/tests/testthat/test-johnson_neyman.R index dfccf219..f72739e7 100644 --- a/tests/testthat/test-johnson_neyman.R +++ b/tests/testthat/test-johnson_neyman.R @@ -17,13 +17,13 @@ m4 <- lm(Income ~ HSGrad + Murder * Illiteracy, test_that("ggpredict, johnson_neyman, 2 focal terms, inside interval", { pr <- ggpredict(m2, c("neg_c_7", "barthtot")) - out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100), line_length = 60)) expect_identical( out, c( - "The association between `neg_c_7` and `c12hour` is positive for values of", - " `barthtot` that range from 46.46 to 49.49. Outside of this interval, there", - " were no clear associations.", + "The association between `neg_c_7` and `c12hour` is positive", + " for values of `barthtot` that range from 46.46 to 49.49.", + " Outside of this interval, there were no clear associations.", "" ) ) @@ -31,13 +31,14 @@ test_that("ggpredict, johnson_neyman, 2 focal terms, inside interval", { test_that("ggpredict, johnson_neyman, 2 focal terms, one direction", { pr <- ggpredict(m3, c("c12hour", "barthtot")) - out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100), line_length = 60)) expect_identical( out, c( - "The association between `c12hour` and `neg_c_7` is positive for values of", - " `barthtot` higher than 48.48. There were no clear associations for values", - " of `barthtot` lower than 48.48.", + "The association between `c12hour` and `neg_c_7` is positive", + " for values of `barthtot` higher than 48.48. There were no", + " clear associations for values of `barthtot` lower than", + " 48.48.", "" ) ) @@ -45,13 +46,14 @@ test_that("ggpredict, johnson_neyman, 2 focal terms, one direction", { test_that("ggpredict, johnson_neyman, 2 focal terms, outside interval", { pr <- ggpredict(m4, c("Murder", "Illiteracy")) - out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100), line_length = 60)) expect_identical( out, c( - "The association between `Start` and `Income` is positive for values of", - " `Illiteracy` lower than 0.80 and negative for values higher than 2.59.", - " Inside the interval of [0.80, 2.59], there were no clear associations.", + "The association between `Start` and `Income` is positive for", + " values of `Illiteracy` lower than 0.80 and negative for", + " values higher than 2.59. Inside the interval of [0.80,", + " 2.59], there were no clear associations.", "" ) ) @@ -59,23 +61,25 @@ test_that("ggpredict, johnson_neyman, 2 focal terms, outside interval", { test_that("ggpredict, johnson_neyman, 3 focal terms", { pr <- ggpredict(m1, c("c12hour", "barthtot", "c172code")) - out <- utils::capture.output(print(johnson_neyman(pr, precision = 100))) + out <- utils::capture.output(print(johnson_neyman(pr, precision = 100), line_length = 60)) expect_identical( out, c( "# Level `1`", - "The association between `c12hour` and `neg_c_7` is negative for values of", - " `barthtot` lower than 46.46. There were no clear associations for values of", - " `barthtot` higher than 46.46.", + "The association between `c12hour` and `neg_c_7` is negative", + " for values of `barthtot` lower than 46.46. There were no", + " clear associations for values of `barthtot` higher than", + " 46.46.", "", "# Level `2`", - "The association between `c12hour` and `neg_c_7` is positive for values of", - " `barthtot` higher than 34.34. There were no clear associations for values", - " of `barthtot` lower than 34.34.", + "The association between `c12hour` and `neg_c_7` is positive", + " for values of `barthtot` higher than 34.34. There were no", + " clear associations for values of `barthtot` lower than", + " 34.34.", "", "# Level `3`", - "There are no clear negative or positive associations between `c12hour` and", - " `neg_c_7` for any value of `barthtot`.", + "There are no clear negative or positive associations between", + " `c12hour` and `neg_c_7` for any value of `barthtot`.", "" ) ) From ceb59593e2d89dc5ef7510f0fabecb5088653fb0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 16:25:27 +0100 Subject: [PATCH 30/51] Update test-ggaverage.R --- tests/testthat/test-ggaverage.R | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test-ggaverage.R b/tests/testthat/test-ggaverage.R index 6b48f7cc..9b8c5c4e 100644 --- a/tests/testthat/test-ggaverage.R +++ b/tests/testthat/test-ggaverage.R @@ -22,9 +22,9 @@ test_that("ggaverage works with condition", { expect_equal(out1$conf.low, out3$asymp.LCL, tolerance = 1e-4) # test predictions - out <- test_predictions(out1) - expect_equal(out$Contrast[c(1, 3)], diff(out1$predicted), tolerance = 1e-4) - expect_equal(out$p.value, c(0.3571, 0.42296, 0.76791), tolerance = 1e-4) + out <- test_predictions(moff, c("x2", "offset_1 = 1")) + expect_equal(out$Difference[c(1, 3)], diff(out1$predicted), tolerance = 1e-4) + expect_equal(out$p, c(0.3571, 0.42296, 0.76791), tolerance = 1e-4) d <- data_grid(moff, "x2", condition = c(offset_1 = 2)) out1 <- ggaverage(moff, "x2", condition = c(offset_1 = 2)) @@ -34,8 +34,7 @@ test_that("ggaverage works with condition", { expect_equal(out1$conf.low, c(8.70405, 6.39786, 6.97987), tolerance = 1e-4) expect_equal(out1$conf.low, out3$asymp.LCL, tolerance = 1e-4) - # test predictions - out <- test_predictions(out1) - expect_equal(out$Contrast[c(1, 3)], diff(out1$predicted), tolerance = 1e-4) - expect_equal(out$p.value, c(0.3571, 0.42296, 0.76791), tolerance = 1e-4) + out <- test_predictions(moff, c("x2", "offset_1 = 2")) + expect_equal(out$Difference[c(1, 3)], diff(out1$predicted), tolerance = 1e-4) + expect_equal(out$p, c(0.3571, 0.42296, 0.76791), tolerance = 1e-4) }) From 1f93ff555d7741e2d6dd21c542a60fdfb4b38da3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 16:34:38 +0100 Subject: [PATCH 31/51] update tests --- .../testthat/_snaps/print_test_predictions.md | 65 +++++++++++++++++++ tests/testthat/test-print_test_predictions.R | 61 ++++++++--------- 2 files changed, 97 insertions(+), 29 deletions(-) diff --git a/tests/testthat/_snaps/print_test_predictions.md b/tests/testthat/_snaps/print_test_predictions.md index 7787b644..0b7fa5bc 100644 --- a/tests/testthat/_snaps/print_test_predictions.md +++ b/tests/testthat/_snaps/print_test_predictions.md @@ -737,6 +737,53 @@ Predictors contrasted: f1, f2 Predictors averaged: Sepal.Width (3.1), Species +--- + + Code + print(ht) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE + ----------------------------------------------------------------------- + and-dash, dash-there | and-dash, comma, here | -0.02 | 0.07 + no dash, comma, here | and-dash, comma, here | 0.15 | 0.09 + no dash, dash-there | and-dash, comma, here | 0.13 | 0.12 + with, comma, comma, here | and-dash, comma, here | 0.07 | 0.08 + with, comma, dash-there | and-dash, comma, here | 0.06 | 0.11 + no dash, comma, here | and-dash, dash-there | 0.17 | 0.12 + no dash, dash-there | and-dash, dash-there | 0.15 | 0.09 + with, comma, comma, here | and-dash, dash-there | 0.09 | 0.11 + with, comma, dash-there | and-dash, dash-there | 0.07 | 0.08 + no dash, dash-there | no dash, comma, here | -0.02 | 0.07 + with, comma, comma, here | no dash, comma, here | -0.08 | 0.09 + with, comma, dash-there | no dash, comma, here | -0.10 | 0.11 + with, comma, comma, here | no dash, dash-there | -0.06 | 0.12 + with, comma, dash-there | no dash, dash-there | -0.08 | 0.09 + with, comma, dash-there | with, comma, comma, here | -0.02 | 0.07 + + Level1 | 95% CI | t(143) | p + --------------------------------------------------------- + and-dash, dash-there | [-0.16, 0.12] | -0.26 | 0.796 + no dash, comma, here | [-0.03, 0.33] | 1.66 | 0.099 + no dash, dash-there | [-0.10, 0.36] | 1.14 | 0.255 + with, comma, comma, here | [-0.09, 0.24] | 0.88 | 0.380 + with, comma, dash-there | [-0.16, 0.27] | 0.51 | 0.610 + no dash, comma, here | [-0.06, 0.40] | 1.46 | 0.147 + no dash, dash-there | [-0.03, 0.33] | 1.66 | 0.099 + with, comma, comma, here | [-0.13, 0.32] | 0.82 | 0.412 + with, comma, dash-there | [-0.09, 0.24] | 0.88 | 0.380 + no dash, dash-there | [-0.16, 0.12] | -0.26 | 0.796 + with, comma, comma, here | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, dash-there | [-0.32, 0.13] | -0.83 | 0.407 + with, comma, comma, here | [-0.29, 0.18] | -0.49 | 0.625 + with, comma, dash-there | [-0.26, 0.10] | -0.84 | 0.402 + with, comma, dash-there | [-0.16, 0.12] | -0.26 | 0.796 + + Variable predicted: Sepal.Length + Predictors contrasted: f1, f2 + Predictors averaged: Sepal.Width (3.1), Species + # print hypothesis_test collapse levels Code @@ -798,6 +845,24 @@ Variable predicted: Sepal.Length Predictors contrasted: Species +# glmmTMB, orderedbeta + + Code + print(test_predictions(m, "gear")) + Output + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------ + 4 | 3 | 0.04 | 0.05 | [-0.06, 0.14] | 0.73 | 0.464 + 5 | 3 | 0.06 | 0.08 | [-0.11, 0.22] | 0.69 | 0.488 + 5 | 4 | 0.02 | 0.08 | [-0.15, 0.18] | 0.23 | 0.821 + + Variable predicted: ord + Predictors contrasted: gear + Predictors averaged: wt (3.2), hp (1.5e+02), cyl (4) + Contrasts are on the response-scale. + # print hypothesis_test collapse CI Code diff --git a/tests/testthat/test-print_test_predictions.R b/tests/testthat/test-print_test_predictions.R index fb3de6c6..ffb5f5fb 100644 --- a/tests/testthat/test-print_test_predictions.R +++ b/tests/testthat/test-print_test_predictions.R @@ -115,27 +115,29 @@ test_that("print hypothesis_test many rows", { by = "gear", collapse_levels = FALSE )) - expect_equal(ht1$Contrast, ht2$Contrast, tolerance = 1e-3) + expect_equal(ht1$Difference, ht2$Difference, tolerance = 1e-3) expect_identical( - ht1$vs, + as.character(ht1$Level1), c( - "a=1", "a=1", "a=1-b=2", "a=1-b=2", "a=1-b=2", "a=1", "a=1-b=2", - "a=1-b=2", "a=1-b=2", "a=1-b=2", "a=1-b=2", "a=1-b=2", "b=2", - "b=2", "b=2", "a=1", "a=1", "a=1-b=2", "a=1-b=2", "a=1-b=2", - "a=1", "a=1-b=2", "a=1-b=2", "a=1-b=2", "a=1-b=2", "a=1-b=2", - "a=1-b=2", "b=2", "b=2", "b=2", "a=1", "a=1", "a=1-b=2", "a=1-b=2", - "a=1-b=2", "a=1", "a=1-b=2", "a=1-b=2", "a=1-b=2", "a=1-b=2", - "a=1-b=2", "a=1-b=2", "b=2", "b=2", "b=2" + "4, b=2", "6, a=1", "6, b=2", "8, a=1", "8, b=2", "6, a=1", + "6, b=2", "8, a=1", "8, b=2", "6, b=2", "8, a=1", "8, b=2", "8, a=1", + "8, b=2", "8, b=2", "4, b=2", "6, a=1", "6, b=2", "8, a=1", "8, b=2", + "6, a=1", "6, b=2", "8, a=1", "8, b=2", "6, b=2", "8, a=1", "8, b=2", + "8, a=1", "8, b=2", "8, b=2", "4, b=2", "6, a=1", "6, b=2", "8, a=1", + "8, b=2", "6, a=1", "6, b=2", "8, a=1", "8, b=2", "6, b=2", "8, a=1", + "8, b=2", "8, a=1", "8, b=2", "8, b=2" ) ) expect_identical( - ht1$cyl, + as.character(ht1$Level2), c( - "4-6", "4-8", "4", "4-6", "4-8", "6-8", "6-4", "6", "6-8", - "8-4", "8-6", "8", "4-6", "4-8", "6-8", "4-6", "4-8", "4", "4-6", - "4-8", "6-8", "6-4", "6", "6-8", "8-4", "8-6", "8", "4-6", "4-8", - "6-8", "4-6", "4-8", "4", "4-6", "4-8", "6-8", "6-4", "6", "6-8", - "8-4", "8-6", "8", "4-6", "4-8", "6-8" + "4, a=1", "4, a=1", "4, a=1", "4, a=1", "4, a=1", "4, b=2", + "4, b=2", "4, b=2", "4, b=2", "6, a=1", "6, a=1", "6, a=1", "6, b=2", + "6, b=2", "8, a=1", "4, a=1", "4, a=1", "4, a=1", "4, a=1", "4, a=1", + "4, b=2", "4, b=2", "4, b=2", "4, b=2", "6, a=1", "6, a=1", "6, a=1", + "6, b=2", "6, b=2", "8, a=1", "4, a=1", "4, a=1", "4, a=1", "4, a=1", + "4, a=1", "4, b=2", "4, b=2", "4, b=2", "4, b=2", "6, a=1", "6, a=1", + "6, a=1", "6, b=2", "6, b=2", "8, a=1" ) ) }) @@ -169,24 +171,24 @@ test_that("print hypothesis_test comma and dash levels", { d$f2 <- as.factor(sample(letters[1:2], nrow(d), replace = TRUE)) m <- lme4::lmer(Sepal.Length ~ Sepal.Width + f1 + f2 + (1 | Species), data = d) - ht <- hypothesis_test(m, c("Sepal.Width", "f1", "f2")) + ht <- hypothesis_test(m, "Sepal.Width", by = c("f1", "f2"), allow.new.levels = TRUE) expect_identical( - ht$f1, + as.character(ht$Level1), c( - "and, another, comma-and, another, comma", "and, another, comma-no comma", - "and, another, comma-no comma", "and, another, comma-with, comma", - "and, another, comma-with, comma", "and, another, comma-no comma", - "and, another, comma-no comma", "and, another, comma-with, comma", - "and, another, comma-with, comma", "no comma-no comma", "no comma-with, comma", - "no comma-with, comma", "no comma-with, comma", "no comma-with, comma", - "with, comma-with, comma" + "and, another, comma, b", "no comma, a", "no comma, b", "with, comma, a", + "with, comma, b", "no comma, a", "no comma, b", "with, comma, a", + "with, comma, b", "no comma, b", "with, comma, a", "with, comma, b", + "with, comma, a", "with, comma, b", "with, comma, b" ) ) expect_identical( - ht$f2, + as.character(ht$Level2), c( - "a-b", "a-a", "a-b", "a-a", "a-b", "b-a", "b-b", "b-a", "b-b", - "a-b", "a-a", "a-b", "b-a", "b-b", "a-b" + "and, another, comma, a", "and, another, comma, a", "and, another, comma, a", + "and, another, comma, a", "and, another, comma, a", "and, another, comma, b", + "and, another, comma, b", "and, another, comma, b", "and, another, comma, b", + "no comma, a", "no comma, a", "no comma, a", "no comma, b", "no comma, b", + "with, comma, a" ) ) @@ -228,13 +230,14 @@ test_that("glmmTMB, orderedbeta", { skip_if_not_installed("glmmTMB") data(mtcars) mtcars$ord <- datawizard::normalize(mtcars$mpg) + mtcars$gear <- as.factor(mtcars$gear) m <- glmmTMB::glmmTMB( - ord ~ wt + hp + as.factor(gear) + (1 | cyl), + ord ~ wt + hp + gear + (1 | cyl), data = mtcars, family = glmmTMB::ordbeta() ) out2 <- predict_response(m, "gear", margin = "average") - expect_snapshot(print(test_predictions(out2))) + expect_snapshot(print(test_predictions(m, "gear"))) }) From 2aa4d3b9a4fd414212bfa0407966a840c1079e12 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 16:41:00 +0100 Subject: [PATCH 32/51] fix --- R/johnson_neyman.R | 4 ---- 1 file changed, 4 deletions(-) diff --git a/R/johnson_neyman.R b/R/johnson_neyman.R index 7d463d78..424ad449 100644 --- a/R/johnson_neyman.R +++ b/R/johnson_neyman.R @@ -251,10 +251,6 @@ print.ggjohnson_neyman <- function(x, ...) { cat(insight::format_message(msg, ...), "\n\n", sep = "") } - - if (!is.null(p_adjust)) { - cat("\n", .format_p_adjust(p_adjust), "\n", sep = "") - } } From b697b5437e0746b4043b02b2cc76999f517a5f71 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 16:45:50 +0100 Subject: [PATCH 33/51] fix --- R/pool_comparisons.R | 2 +- tests/testthat/test-focal_only_random.R | 4 ---- tests/testthat/test-mgcv.R | 4 ---- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/R/pool_comparisons.R b/R/pool_comparisons.R index 45ca115d..856ee031 100644 --- a/R/pool_comparisons.R +++ b/R/pool_comparisons.R @@ -29,7 +29,7 @@ pool_comparisons <- function(x, ...) { obj_name <- deparse(substitute(x), width.cutoff = 500) original_x <- x - if (!all(vapply(x, inherits, logical(1), "ggcomparisons"))) { + if (!all(vapply(x, inherits, logical(1), c("ggcomparisons", "estimate_contrasts")))) { insight::format_error( "`x` must be a list of `ggcomparisons` objects, as returned by `test_predictions()`." ) diff --git a/tests/testthat/test-focal_only_random.R b/tests/testthat/test-focal_only_random.R index 8eb4f5ef..2ea1c18b 100644 --- a/tests/testthat/test-focal_only_random.R +++ b/tests/testthat/test-focal_only_random.R @@ -49,8 +49,4 @@ test_that("ggpredict", { predictions <- predict_response(m_null1, c("gender", "employed", "age"), margin = "empirical") expect_silent(test_predictions(predictions)) - expect_message( - test_predictions(m_null1, c("gender", "employed", "age")), - regex = "All focal terms are included" - ) }) diff --git a/tests/testthat/test-mgcv.R b/tests/testthat/test-mgcv.R index baf657a8..908a070f 100644 --- a/tests/testthat/test-mgcv.R +++ b/tests/testthat/test-mgcv.R @@ -26,10 +26,6 @@ test_that("ggpredict", { p <- ggpredict(m2, "x1") expect_equal(p$predicted[1], 22.57359, tolerance = 1e-3) expect_equal(p$conf.low[1], 17.89382, tolerance = 1e-3) - - skip_if_not_installed("marginaleffects") - out <- test_predictions(p) - expect_equal(out$Slope, 43.90625, tolerance = 1e-3) }) skip_if_not_installed("lme4") From b8bfd395fbee939b0b59e4505909f3e4ea87f470 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 16:54:00 +0100 Subject: [PATCH 34/51] Update pool_comparisons.R --- R/pool_comparisons.R | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/R/pool_comparisons.R b/R/pool_comparisons.R index 856ee031..30eed41b 100644 --- a/R/pool_comparisons.R +++ b/R/pool_comparisons.R @@ -37,24 +37,13 @@ pool_comparisons <- function(x, ...) { # we need to check if all objects are comparible. We check whether columns # and values of focal terms are identical across all objects. - estimate_name <- attributes(x[[1]])$estimate_name - estimate_cols <- which(colnames(x[[1]]) == estimate_name) - 1 + estimate_name <- attributes(x[[1]])$coef_name - # check if all comparisons/contrasts are identical - result <- x[[1]][estimate_cols] - if (!all(vapply(2:length(x), function(i) identical(x[[i]][estimate_cols], result), logical(1)))) { - insight::format_error(paste0( - "Cannot pool results from prediction tests. The values of the focal term(s) ", - toString(colnames(x[[1]])[estimate_cols]), - " are not identical across predictions." - )) - } - - # preparation ---- + # preparation ---- len <- length(x) - ci <- attributes(x[[1]])$ci_level - dof <- attributes(x[[1]])$df + ci <- attributes(x[[1]])$ci + dof <- insight::get_df(attributes(x[[1]])$model, type = "wald", verbose = FALSE) if (is.null(dof)) { dof <- Inf @@ -63,7 +52,7 @@ pool_comparisons <- function(x, ...) { # pool predictions ----- pooled_comparisons <- original_x[[1]] - pooled_comparisons$std.error <- NA + pooled_comparisons$SE <- NA n_rows <- nrow(original_x[[1]]) for (i in 1:n_rows) { @@ -74,31 +63,29 @@ pool_comparisons <- function(x, ...) { pooled_comparisons[[estimate_name]][i] <- mean(pooled_comp, na.rm = TRUE) # pooled standard error - pooled_se <- unlist(lapply(original_x, function(j) { - attributes(j)$standard_error[i] - }), use.names = FALSE) + pooled_se <- unlist(lapply(original_x, function(j) j$SE[i]), use.names = FALSE) ubar <- mean(pooled_se^2, na.rm = TRUE) tmp <- ubar + (1 + 1 / len) * stats::var(pooled_comp) - pooled_comparisons$std.error[i] <- sqrt(tmp) + pooled_comparisons$SE[i] <- sqrt(tmp) } # pooled degrees of freedom for t-statistics pooled_df <- .barnad_rubin( m = nrow(pooled_comparisons), b = stats::var(pooled_comparisons[[estimate_name]]), - t = pooled_comparisons$std.error^2, + t = pooled_comparisons$SE^2, dfcom = dof ) # confidence intervals ---- alpha <- (1 + ci) / 2 fac <- stats::qt(alpha, df = dof) - pooled_comparisons$conf.low <- pooled_comparisons[[estimate_name]] - fac * pooled_comparisons$std.error - pooled_comparisons$conf.high <- pooled_comparisons[[estimate_name]] + fac * pooled_comparisons$std.error + pooled_comparisons$conf.low <- pooled_comparisons[[estimate_name]] - fac * pooled_comparisons$SE + pooled_comparisons$conf.high <- pooled_comparisons[[estimate_name]] + fac * pooled_comparisons$SE attributes(pooled_comparisons) <- utils::modifyList(attributes(original_x[[1]]), attributes(pooled_comparisons)) - attr(pooled_comparisons, "standard_error") <- pooled_comparisons$std.error - pooled_comparisons$std.error <- NULL + attr(pooled_comparisons, "standard_error") <- pooled_comparisons$SE + pooled_comparisons$SE <- NULL pooled_comparisons } From f1597bcfa35b4fa2fc8681326f626134a09e3df7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:02:57 +0100 Subject: [PATCH 35/51] update RD --- R/format.R | 34 ---------------------------------- R/johnson_neyman.R | 7 ------- man/johnson_neyman.Rd | 11 ----------- man/print.Rd | 10 ---------- 4 files changed, 62 deletions(-) diff --git a/R/format.R b/R/format.R index c88cc21d..b68fd1bf 100644 --- a/R/format.R +++ b/R/format.R @@ -6,14 +6,6 @@ #' subgroups in the table output. #' @param collapse_ci Logical, if `TRUE`, the columns with predicted values and #' confidence intervals are collapsed into one column, e.g. `Predicted (95% CI)`. -#' @param collapse_p Logical, if `TRUE`, the columns with predicted values and -#' p-values are collapsed into one column, where significant p-values are -#' indicated as asterisks. -#' @param combine_levels Logical, if `TRUE`, the levels of the first comparison -#' of each focal term against the second are combined into one column. This is -#' useful when comparing multiple focal terms, e.g. `education = low-high` and -#' `gender = male-female` are combined into `first = low-male` and -#' `second = high-female`. #' @param n Number of rows to print per subgroup. If `NULL`, a default number #' of rows is printed, depending on the number of subgroups. #' @param collapse_tables Logical, if `TRUE`, all tables are combined into one. @@ -231,32 +223,6 @@ format.ggeffects <- function(x, } -.collapse_p <- function(x, collapse_p) { - # collapse p? - p_column <- which(colnames(x) == "p") - if (collapse_p && length(p_column)) { - # find CI column - we may insert p-values before that column. If we don't - # have CI columns, e.g. because user also used "collapse_ci = TRUE", we - # simply put it before estimated values - ci_column <- grep("\\d{2}% CI", colnames(x)) - if (length(ci_column)) { - insert_column <- ci_column - 1 - } else { - insert_column <- p_column - 1 - } - # make sure "< .001" is correctly handled - x$p[x$p == "< .001"] <- "0.0001" - # format p-values, we only want significance stars - p_values <- format(insight::format_p(as.numeric(x$p), stars = TRUE, stars_only = TRUE)) - # paste po-values to predicted values - x[, insert_column] <- paste0(x[, insert_column], p_values) - # remove p column - x[p_column] <- NULL - } - x -} - - .nrows_to_print <- function(x, n) { # if we have groups, show n rows per group .n <- 1 diff --git a/R/johnson_neyman.R b/R/johnson_neyman.R index 424ad449..e3f19f04 100644 --- a/R/johnson_neyman.R +++ b/R/johnson_neyman.R @@ -12,13 +12,6 @@ #' `pretty(..., n = precision)`. Usually, the default value of 500 is sufficient. #' Increasing this value will result in a smoother plot and more accurate values #' for the interval bounds, but can also slightly increase the computation time. -#' @param colors Colors used for the plot. Must be a vector with two color -#' values. Only used if `show_association = TRUE`. -#' @param show_association Logical, if `TRUE`, highlights the range where values -#' of the moderator are positively or negtatively associated with the outcome. -#' @param show_rug Logical, if `TRUE`, adds a rug with raw data of the moderator -#' variable to the plot. This helps visualizing its distribution. -#' @param verbose Show/hide printed message for plots. #' @param ... Arguments passed down to [`test_predictions()`] (and then probably #' further to [`marginaleffects::slopes()`]). See `?test_predictions` for further #' details. diff --git a/man/johnson_neyman.Rd b/man/johnson_neyman.Rd index 2012b325..c6545e51 100644 --- a/man/johnson_neyman.Rd +++ b/man/johnson_neyman.Rd @@ -30,17 +30,6 @@ below.} \item{...}{Arguments passed down to \code{\link[=test_predictions]{test_predictions()}} (and then probably further to \code{\link[marginaleffects:slopes]{marginaleffects::slopes()}}). See \code{?test_predictions} for further details.} - -\item{colors}{Colors used for the plot. Must be a vector with two color -values. Only used if \code{show_association = TRUE}.} - -\item{show_association}{Logical, if \code{TRUE}, highlights the range where values -of the moderator are positively or negtatively associated with the outcome.} - -\item{show_rug}{Logical, if \code{TRUE}, adds a rug with raw data of the moderator -variable to the plot. This helps visualizing its distribution.} - -\item{verbose}{Show/hide printed message for plots.} } \value{ A data frame including contrasts of the \code{\link[=test_predictions]{test_predictions()}} for the diff --git a/man/print.Rd b/man/print.Rd index ce818e1e..567eab13 100644 --- a/man/print.Rd +++ b/man/print.Rd @@ -74,16 +74,6 @@ them are also passed down further to \code{\link[insight:format_table]{insight:: \item{engine}{The engine to use for printing. One of \code{"tt"} (default) or \code{"gt"}. \code{"tt"} uses the \emph{tinytable} package, \code{"gt"} uses the \emph{gt} package.} - -\item{collapse_p}{Logical, if \code{TRUE}, the columns with predicted values and -p-values are collapsed into one column, where significant p-values are -indicated as asterisks.} - -\item{combine_levels}{Logical, if \code{TRUE}, the levels of the first comparison -of each focal term against the second are combined into one column. This is -useful when comparing multiple focal terms, e.g. \code{education = low-high} and -\code{gender = male-female} are combined into \code{first = low-male} and -\code{second = high-female}.} } \value{ \code{format()} return a formatted data frame, \code{print()} prints a From d61819fcd1e81a24b96717a0da084f16650bc3f1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:06:24 +0100 Subject: [PATCH 36/51] fix --- R/pool_comparisons.R | 4 ++-- tests/testthat/test-pool_comparisons.R | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/pool_comparisons.R b/R/pool_comparisons.R index 30eed41b..b76e483a 100644 --- a/R/pool_comparisons.R +++ b/R/pool_comparisons.R @@ -80,8 +80,8 @@ pool_comparisons <- function(x, ...) { # confidence intervals ---- alpha <- (1 + ci) / 2 fac <- stats::qt(alpha, df = dof) - pooled_comparisons$conf.low <- pooled_comparisons[[estimate_name]] - fac * pooled_comparisons$SE - pooled_comparisons$conf.high <- pooled_comparisons[[estimate_name]] + fac * pooled_comparisons$SE + pooled_comparisons$CI_low <- pooled_comparisons[[estimate_name]] - fac * pooled_comparisons$SE + pooled_comparisons$CI_high <- pooled_comparisons[[estimate_name]] + fac * pooled_comparisons$SE attributes(pooled_comparisons) <- utils::modifyList(attributes(original_x[[1]]), attributes(pooled_comparisons)) attr(pooled_comparisons, "standard_error") <- pooled_comparisons$SE diff --git a/tests/testthat/test-pool_comparisons.R b/tests/testthat/test-pool_comparisons.R index e91de717..bbc2f447 100644 --- a/tests/testthat/test-pool_comparisons.R +++ b/tests/testthat/test-pool_comparisons.R @@ -11,6 +11,6 @@ test_that("ggeffects, pool comparisons", { hypothesis_test(m, "age") }) pool_com <- pool_comparisons(comparisons) - expect_equal(pool_com$Contrast, c(-4.6464, -6.70639, -2.05999), tolerance = 1e-3) - expect_equal(pool_com$conf.high, c(0.3772104, 1.3017958, 4.4172299), tolerance = 1e-3) + expect_equal(pool_com$Difference, c(-4.6464, -6.70639, -2.05999), tolerance = 1e-3) + expect_equal(pool_com$CI_high, c(0.3772104, 1.3017958, 4.4172299), tolerance = 1e-3) }) From b884f13707e5c5b1848d6902560ddff784170e4c Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:36:21 +0100 Subject: [PATCH 37/51] update tests --- .../_snaps/test_predictions_emmeans.md | 752 +++++++++--------- .../testthat/test-test_predictions_emmeans.R | 6 - 2 files changed, 390 insertions(+), 368 deletions(-) diff --git a/tests/testthat/_snaps/test_predictions_emmeans.md b/tests/testthat/_snaps/test_predictions_emmeans.md index 64ce6a19..1299d9a2 100644 --- a/tests/testthat/_snaps/test_predictions_emmeans.md +++ b/tests/testthat/_snaps/test_predictions_emmeans.md @@ -3,286 +3,283 @@ Code print(test_predictions(m, terms = c("x1", "x2", "x3"), engine = "emmeans")) Output - # Pairwise comparisons - - x1 | x2 | x3 | Contrast | 95% CI | p - ------------------------------------------------- - 0-0 | 1-1 | a-c | 0.13 | -0.69, 0.95 | 0.751 - 0-0 | 1-1 | a-d | -0.77 | -1.72, 0.19 | 0.113 - 0-0 | 1-1 | b-a | 0.17 | -0.70, 1.04 | 0.701 - 0-0 | 1-1 | b-c | 0.30 | -0.52, 1.12 | 0.469 - 0-0 | 1-1 | b-d | -0.60 | -1.56, 0.35 | 0.214 - 0-0 | 1-1 | d-c | 0.90 | -0.01, 1.81 | 0.052 - 0-0 | 1-2 | a-a | 0.44 | -0.43, 1.31 | 0.319 - 0-0 | 1-2 | a-c | 0.31 | -0.65, 1.26 | 0.525 - 0-0 | 1-2 | a-d | -0.21 | -1.04, 0.61 | 0.604 - 0-0 | 1-2 | b-a | 0.61 | -0.26, 1.48 | 0.169 - 0-0 | 1-2 | b-b | 0.15 | -0.87, 1.17 | 0.774 - 0-0 | 1-2 | b-c | 0.48 | -0.48, 1.43 | 0.325 - 0-0 | 1-2 | b-d | -0.05 | -0.87, 0.78 | 0.912 - 0-0 | 1-2 | c-c | 0.17 | -0.73, 1.08 | 0.703 - 0-0 | 1-2 | d-c | 1.08 | 0.04, 2.11 | 0.041 - 0-0 | 1-2 | d-d | 0.55 | -0.36, 1.46 | 0.229 - 0-0 | 1-3 | a-a | -0.33 | -1.17, 0.52 | 0.444 - 0-0 | 1-3 | a-c | 0.15 | -0.75, 1.06 | 0.735 - 0-0 | 1-3 | a-d | -0.73 | -1.76, 0.29 | 0.157 - 0-0 | 1-3 | b-a | -0.16 | -1.00, 0.69 | 0.712 - 0-0 | 1-3 | b-b | 0.03 | -0.82, 0.87 | 0.952 - 0-0 | 1-3 | b-c | 0.32 | -0.58, 1.23 | 0.479 - 0-0 | 1-3 | b-d | -0.56 | -1.59, 0.46 | 0.275 - 0-0 | 1-3 | c-c | 0.02 | -0.84, 0.88 | 0.957 - 0-0 | 1-3 | d-c | 0.92 | -0.06, 1.91 | 0.066 - 0-0 | 1-3 | d-d | 0.04 | -1.06, 1.13 | 0.948 - 0-0 | 2-1 | a-c | -0.31 | -1.13, 0.51 | 0.458 - 0-0 | 2-1 | a-d | -1.21 | -2.16, -0.25 | 0.014 - 0-0 | 2-1 | b-a | 0.02 | -1.00, 1.04 | 0.967 - 0-0 | 2-1 | b-c | 0.15 | -0.83, 1.13 | 0.757 - 0-0 | 2-1 | b-d | -0.75 | -1.84, 0.35 | 0.177 - 0-0 | 2-1 | d-c | 0.35 | -0.42, 1.12 | 0.372 - 0-0 | 2-2 | a-c | -0.13 | -1.09, 0.82 | 0.782 - 0-0 | 2-2 | a-d | -0.65 | -1.48, 0.17 | 0.117 - 0-0 | 2-2 | b-a | 0.46 | -0.56, 1.48 | 0.372 - 0-0 | 2-2 | b-c | 0.33 | -0.77, 1.42 | 0.553 - 0-0 | 2-2 | b-d | -0.19 | -1.17, 0.79 | 0.695 - 0-0 | 2-2 | d-c | 0.52 | -0.39, 1.43 | 0.257 - 0-0 | 2-3 | a-a | -0.77 | -1.61, 0.08 | 0.075 - 0-0 | 2-3 | a-c | -0.28 | -1.19, 0.62 | 0.534 - 0-0 | 2-3 | a-d | -1.17 | -2.19, -0.15 | 0.025 - 0-0 | 2-3 | b-a | -0.30 | -1.30, 0.69 | 0.545 - 0-0 | 2-3 | b-b | -0.12 | -1.12, 0.88 | 0.809 - 0-0 | 2-3 | b-c | 0.18 | -0.88, 1.23 | 0.740 - 0-0 | 2-3 | b-d | -0.71 | -1.87, 0.44 | 0.223 - 0-0 | 2-3 | c-c | -0.15 | -1.14, 0.84 | 0.761 - 0-0 | 2-3 | d-c | 0.37 | -0.49, 1.23 | 0.394 - 0-0 | 2-3 | d-d | -0.52 | -1.50, 0.46 | 0.296 - 0-0 | 3-1 | a-c | 0.46 | -0.33, 1.25 | 0.254 - 0-0 | 3-1 | a-d | -0.44 | -1.37, 0.49 | 0.345 - 0-0 | 3-1 | b-a | 0.14 | -0.70, 0.99 | 0.736 - 0-0 | 3-1 | b-c | 0.27 | -0.52, 1.07 | 0.492 - 0-0 | 3-1 | b-d | -0.63 | -1.56, 0.30 | 0.184 - 0-0 | 3-1 | d-c | 0.86 | -0.12, 1.84 | 0.083 - 0-0 | 3-2 | a-c | 0.63 | -0.30, 1.56 | 0.180 - 0-0 | 3-2 | a-d | 0.11 | -0.68, 0.90 | 0.781 - 0-0 | 3-2 | b-a | 0.58 | -0.26, 1.43 | 0.173 - 0-0 | 3-2 | b-c | 0.45 | -0.48, 1.38 | 0.339 - 0-0 | 3-2 | b-d | -0.07 | -0.86, 0.72 | 0.857 - 0-0 | 3-2 | d-c | 1.04 | -0.05, 2.13 | 0.062 - 0-0 | 3-3 | a-c | 0.48 | -0.40, 1.36 | 0.280 - 0-0 | 3-3 | a-d | -0.41 | -1.41, 0.59 | 0.419 - 0-0 | 3-3 | b-a | -0.18 | -1.00, 0.63 | 0.657 - 0-0 | 3-3 | b-c | 0.30 | -0.58, 1.18 | 0.502 - 0-0 | 3-3 | b-d | -0.59 | -1.59, 0.41 | 0.243 - 0-0 | 3-3 | d-c | 0.89 | -0.16, 1.94 | 0.097 - 0-1 | 1-1 | a-a | 0.89 | -0.14, 1.91 | 0.088 - 0-1 | 1-1 | a-c | 1.00 | -0.74, 2.75 | 0.256 - 0-1 | 1-1 | a-d | -1.05 | -2.17, 0.08 | 0.068 - 0-1 | 1-1 | b-a | 1.05 | 0.03, 2.08 | 0.043 - 0-1 | 1-1 | b-b | 1.60 | -0.14, 3.34 | 0.071 - 0-1 | 1-1 | b-c | 1.17 | -0.57, 2.92 | 0.185 - 0-1 | 1-1 | b-d | -0.88 | -2.00, 0.25 | 0.124 - 0-1 | 1-1 | c-c | 0.87 | -0.85, 2.59 | 0.316 - 0-1 | 1-1 | d-c | 1.77 | -0.01, 3.56 | 0.052 - 0-1 | 1-1 | d-d | -0.28 | -1.47, 0.91 | 0.644 - 0-1 | 1-2 | a-a | 1.27 | -0.48, 3.01 | 0.152 - 0-1 | 1-2 | a-c | -0.05 | -1.80, 1.69 | 0.952 - 0-1 | 1-2 | a-d | -0.39 | -1.70, 0.91 | 0.550 - 0-1 | 1-2 | b-a | 1.44 | -0.31, 3.18 | 0.105 - 0-1 | 1-2 | b-b | -0.19 | -1.50, 1.12 | 0.773 - 0-1 | 1-2 | b-c | 0.12 | -1.63, 1.86 | 0.894 - 0-1 | 1-2 | b-d | -0.23 | -1.53, 1.08 | 0.733 - 0-1 | 1-2 | c-c | -0.18 | -1.90, 1.54 | 0.832 - 0-1 | 1-2 | d-c | 0.72 | -1.07, 2.50 | 0.427 - 0-1 | 1-2 | d-d | 0.38 | -0.99, 1.74 | 0.585 - 0-1 | 1-3 | a-a | 0.96 | -0.79, 2.70 | 0.278 - 0-1 | 1-3 | a-c | -0.56 | -2.30, 1.19 | 0.528 - 0-1 | 1-3 | a-d | 0.48 | -1.27, 2.22 | 0.587 - 0-1 | 1-3 | b-a | 1.13 | -0.62, 2.87 | 0.202 - 0-1 | 1-3 | b-b | 0.80 | -0.32, 1.93 | 0.160 - 0-1 | 1-3 | b-c | -0.39 | -2.13, 1.36 | 0.660 - 0-1 | 1-3 | b-d | 0.65 | -1.10, 2.39 | 0.463 - 0-1 | 1-3 | c-c | -0.69 | -2.41, 1.03 | 0.429 - 0-1 | 1-3 | d-c | 0.21 | -1.57, 2.00 | 0.812 - 0-1 | 1-3 | d-d | 1.25 | -0.54, 3.03 | 0.169 - 0-1 | 2-1 | a-c | 0.56 | -1.18, 2.31 | 0.522 - 0-1 | 2-1 | a-d | -1.49 | -2.61, -0.36 | 0.010 - 0-1 | 2-1 | b-a | 0.91 | -0.25, 2.06 | 0.121 - 0-1 | 2-1 | b-c | 1.02 | -0.80, 2.85 | 0.267 - 0-1 | 2-1 | b-d | -1.03 | -2.27, 0.22 | 0.105 - 0-1 | 2-1 | d-c | 1.22 | -0.50, 2.94 | 0.162 - 0-1 | 2-2 | a-a | 0.83 | -0.92, 2.57 | 0.348 - 0-1 | 2-2 | a-c | -0.49 | -2.23, 1.25 | 0.576 - 0-1 | 2-2 | a-d | -0.83 | -2.14, 0.47 | 0.208 - 0-1 | 2-2 | b-a | 1.29 | -0.54, 3.11 | 0.164 - 0-1 | 2-2 | b-b | -0.34 | -1.75, 1.07 | 0.636 - 0-1 | 2-2 | b-c | -0.03 | -1.85, 1.79 | 0.973 - 0-1 | 2-2 | b-d | -0.37 | -1.79, 1.04 | 0.601 - 0-1 | 2-2 | c-c | -0.36 | -2.15, 1.43 | 0.690 - 0-1 | 2-2 | d-c | 0.16 | -1.56, 1.88 | 0.851 - 0-1 | 2-2 | d-d | -0.18 | -1.45, 1.10 | 0.780 - 0-1 | 2-3 | a-a | 0.52 | -1.23, 2.26 | 0.556 - 0-1 | 2-3 | a-c | -0.99 | -2.74, 0.75 | 0.260 - 0-1 | 2-3 | a-d | 0.04 | -1.71, 1.78 | 0.965 - 0-1 | 2-3 | b-a | 0.98 | -0.85, 2.80 | 0.289 - 0-1 | 2-3 | b-b | 0.65 | -0.59, 1.90 | 0.299 - 0-1 | 2-3 | b-c | -0.53 | -2.36, 1.29 | 0.562 - 0-1 | 2-3 | b-d | 0.50 | -1.32, 2.32 | 0.588 - 0-1 | 2-3 | c-c | -0.86 | -2.65, 0.93 | 0.340 - 0-1 | 2-3 | d-c | -0.34 | -2.06, 1.38 | 0.695 - 0-1 | 2-3 | d-d | 0.69 | -1.03, 2.41 | 0.425 - 0-1 | 3-1 | a-c | 1.33 | -0.40, 3.06 | 0.130 - 0-1 | 3-1 | a-d | -0.72 | -1.82, 0.38 | 0.197 - 0-1 | 3-1 | b-a | 1.03 | 0.03, 2.03 | 0.044 - 0-1 | 3-1 | b-c | 1.15 | -0.58, 2.88 | 0.191 - 0-1 | 3-1 | b-d | -0.90 | -2.01, 0.20 | 0.107 - 0-1 | 3-1 | d-c | 1.74 | -0.09, 3.56 | 0.062 - 0-1 | 3-2 | a-c | 0.27 | -1.46, 2.00 | 0.754 - 0-1 | 3-2 | a-d | -0.07 | -1.36, 1.22 | 0.916 - 0-1 | 3-2 | b-a | 1.41 | -0.32, 3.14 | 0.109 - 0-1 | 3-2 | b-c | 0.09 | -1.64, 1.82 | 0.917 - 0-1 | 3-2 | b-d | -0.25 | -1.54, 1.04 | 0.699 - 0-1 | 3-2 | d-c | 0.68 | -1.14, 2.50 | 0.459 - 0-1 | 3-3 | a-a | 1.28 | -0.45, 3.01 | 0.144 - 0-1 | 3-3 | a-c | -0.23 | -1.96, 1.50 | 0.793 - 0-1 | 3-3 | a-d | 0.80 | -0.93, 2.53 | 0.358 - 0-1 | 3-3 | b-a | 1.10 | -0.63, 2.83 | 0.209 - 0-1 | 3-3 | b-b | 0.78 | -0.33, 1.88 | 0.165 - 0-1 | 3-3 | b-c | -0.41 | -2.14, 1.32 | 0.637 - 0-1 | 3-3 | b-d | 0.62 | -1.11, 2.35 | 0.477 - 0-1 | 3-3 | c-c | -0.71 | -2.47, 1.05 | 0.425 - 0-1 | 3-3 | d-c | 0.18 | -1.65, 2.00 | 0.846 - 0-1 | 3-3 | d-d | 1.21 | -0.61, 3.03 | 0.190 - 1-0 | 1-1 | a-c | -0.75 | -1.73, 0.23 | 0.130 - 1-0 | 1-1 | a-d | -1.65 | -2.75, -0.56 | 0.004 - 1-0 | 1-1 | b-a | -1.43 | -3.18, 0.31 | 0.106 - 1-0 | 1-1 | b-c | -1.30 | -3.02, 0.42 | 0.136 - 1-0 | 1-1 | b-d | -2.20 | -3.99, -0.42 | 0.016 - 1-0 | 1-1 | d-c | 1.18 | 0.09, 2.27 | 0.034 - 1-0 | 1-2 | a-a | -0.45 | -1.47, 0.58 | 0.387 - 1-0 | 1-2 | a-c | -0.58 | -1.67, 0.51 | 0.295 - 1-0 | 1-2 | a-d | -1.10 | -2.08, -0.12 | 0.028 - 1-0 | 1-2 | b-a | -0.99 | -2.74, 0.75 | 0.260 - 1-0 | 1-2 | b-b | -1.45 | -3.28, 0.37 | 0.116 - 1-0 | 1-2 | b-c | -1.13 | -2.91, 0.66 | 0.213 - 1-0 | 1-2 | b-d | -1.65 | -3.37, 0.07 | 0.060 - 1-0 | 1-2 | c-c | -0.70 | -2.48, 1.09 | 0.440 - 1-0 | 1-2 | d-c | 1.35 | 0.16, 2.54 | 0.027 - 1-0 | 1-2 | d-d | 0.83 | -0.26, 1.92 | 0.132 - 1-0 | 1-3 | a-a | -1.21 | -2.21, -0.21 | 0.018 - 1-0 | 1-3 | a-c | -0.73 | -1.78, 0.32 | 0.171 - 1-0 | 1-3 | a-d | -1.62 | -2.77, -0.47 | 0.007 - 1-0 | 1-3 | b-a | -1.76 | -3.49, -0.03 | 0.046 - 1-0 | 1-3 | b-b | -1.58 | -3.31, 0.15 | 0.074 - 1-0 | 1-3 | b-c | -1.28 | -3.04, 0.48 | 0.153 - 1-0 | 1-3 | b-d | -2.17 | -3.99, -0.34 | 0.021 - 1-0 | 1-3 | c-c | -0.85 | -2.61, 0.91 | 0.341 - 1-0 | 1-3 | d-c | 1.20 | 0.05, 2.35 | 0.041 - 1-0 | 1-3 | d-d | 0.31 | -0.93, 1.56 | 0.618 - 1-0 | 2-1 | a-c | -1.13 | -2.85, 0.58 | 0.193 - 1-0 | 2-1 | a-d | -2.04 | -3.82, -0.25 | 0.026 - 1-0 | 2-1 | b-a | 0.36 | -0.95, 1.67 | 0.586 - 1-0 | 2-1 | b-c | 0.49 | -0.78, 1.77 | 0.446 - 1-0 | 2-1 | b-d | -0.41 | -1.77, 0.95 | 0.551 - 1-0 | 2-1 | d-c | 0.53 | -0.75, 1.80 | 0.414 - 1-0 | 2-2 | a-c | -0.96 | -2.75, 0.83 | 0.288 - 1-0 | 2-2 | a-d | -1.48 | -3.20, 0.24 | 0.090 - 1-0 | 2-2 | b-a | 0.80 | -0.51, 2.11 | 0.228 - 1-0 | 2-2 | b-c | 0.67 | -0.70, 2.03 | 0.335 - 1-0 | 2-2 | b-d | 0.14 | -1.13, 1.42 | 0.823 - 1-0 | 2-2 | d-c | 0.70 | -0.66, 2.06 | 0.310 - 1-0 | 2-3 | a-a | -1.59 | -3.32, 0.14 | 0.071 - 1-0 | 2-3 | a-c | -1.11 | -2.87, 0.65 | 0.213 - 1-0 | 2-3 | a-d | -2.00 | -3.82, -0.18 | 0.032 - 1-0 | 2-3 | b-a | 0.03 | -1.26, 1.32 | 0.960 - 1-0 | 2-3 | b-b | 0.22 | -1.07, 1.50 | 0.740 - 1-0 | 2-3 | b-c | 0.51 | -0.82, 1.85 | 0.445 - 1-0 | 2-3 | b-d | -0.37 | -1.79, 1.04 | 0.599 - 1-0 | 2-3 | c-c | 0.21 | -1.55, 1.97 | 0.815 - 1-0 | 2-3 | d-c | 0.55 | -0.78, 1.88 | 0.414 - 1-0 | 2-3 | d-d | -0.34 | -1.75, 1.07 | 0.634 - 1-0 | 3-1 | a-c | -0.82 | -2.54, 0.89 | 0.342 - 1-0 | 3-1 | a-d | -1.73 | -3.51, 0.06 | 0.058 - 1-0 | 3-1 | b-a | -0.63 | -1.76, 0.49 | 0.266 - 1-0 | 3-1 | b-c | -0.50 | -1.59, 0.59 | 0.361 - 1-0 | 3-1 | b-d | -1.40 | -2.59, -0.21 | 0.022 - 1-0 | 3-1 | d-c | -0.35 | -2.06, 1.37 | 0.690 - 1-0 | 3-2 | a-c | -0.65 | -2.44, 1.14 | 0.471 - 1-0 | 3-2 | a-d | -1.17 | -2.89, 0.55 | 0.179 - 1-0 | 3-2 | b-a | -0.19 | -1.32, 0.93 | 0.733 - 1-0 | 3-2 | b-c | -0.33 | -1.52, 0.86 | 0.586 - 1-0 | 3-2 | b-d | -0.85 | -1.94, 0.24 | 0.124 - 1-0 | 3-2 | d-c | -0.17 | -1.96, 1.62 | 0.849 - 1-0 | 3-3 | a-c | -0.80 | -2.56, 0.96 | 0.368 - 1-0 | 3-3 | a-d | -1.69 | -3.51, 0.13 | 0.069 - 1-0 | 3-3 | b-a | -0.96 | -2.06, 0.15 | 0.088 - 1-0 | 3-3 | b-c | -0.48 | -1.63, 0.67 | 0.411 - 1-0 | 3-3 | b-d | -1.37 | -2.61, -0.12 | 0.032 - 1-0 | 3-3 | d-c | -0.32 | -2.08, 1.44 | 0.716 - 1-1 | 1-1 | a-c | 0.12 | -1.71, 1.94 | 0.899 - 1-1 | 1-1 | a-d | -1.93 | -3.18, -0.69 | 0.003 - 1-1 | 1-1 | b-a | -0.55 | -2.37, 1.28 | 0.552 - 1-1 | 1-1 | b-c | -0.43 | -2.74, 1.88 | 0.712 - 1-1 | 1-1 | b-d | -2.48 | -4.36, -0.60 | 0.011 - 1-1 | 1-1 | d-c | 2.05 | 0.17, 3.93 | 0.033 - 1-1 | 1-2 | a-a | 0.38 | -1.44, 2.20 | 0.679 - 1-1 | 1-2 | a-c | -0.94 | -2.76, 0.89 | 0.309 - 1-1 | 1-2 | a-d | -1.28 | -2.69, 0.13 | 0.075 - 1-1 | 1-2 | b-a | -0.17 | -2.47, 2.14 | 0.886 - 1-1 | 1-2 | b-b | -1.79 | -3.79, 0.21 | 0.078 - 1-1 | 1-2 | b-c | -1.48 | -3.79, 0.82 | 0.204 - 1-1 | 1-2 | b-d | -1.83 | -3.82, 0.17 | 0.072 - 1-1 | 1-2 | c-c | -1.06 | -3.36, 1.25 | 0.365 - 1-1 | 1-2 | d-c | 0.99 | -0.89, 2.88 | 0.296 - 1-1 | 1-2 | d-d | 0.65 | -0.84, 2.14 | 0.385 - 1-1 | 1-3 | a-a | 0.07 | -1.75, 1.89 | 0.939 - 1-1 | 1-3 | a-c | -1.44 | -3.26, 0.38 | 0.120 - 1-1 | 1-3 | a-d | -0.41 | -2.23, 1.41 | 0.657 - 1-1 | 1-3 | b-a | -0.48 | -2.78, 1.83 | 0.682 - 1-1 | 1-3 | b-b | -0.80 | -2.68, 1.08 | 0.400 - 1-1 | 1-3 | b-c | -1.99 | -4.29, 0.32 | 0.090 - 1-1 | 1-3 | b-d | -0.96 | -3.26, 1.35 | 0.412 - 1-1 | 1-3 | c-c | -1.56 | -3.86, 0.75 | 0.183 - 1-1 | 1-3 | d-c | 0.49 | -1.39, 2.37 | 0.605 - 1-1 | 1-3 | d-d | 1.52 | -0.36, 3.41 | 0.111 - 1-1 | 2-1 | a-c | -0.26 | -2.57, 2.04 | 0.821 - 1-1 | 2-1 | a-d | -2.31 | -4.20, -0.43 | 0.017 - 1-1 | 2-1 | b-a | 1.24 | -0.17, 2.66 | 0.083 - 1-1 | 2-1 | b-c | 1.36 | -0.64, 3.36 | 0.179 - 1-1 | 2-1 | b-d | -0.69 | -2.18, 0.80 | 0.360 - 1-1 | 2-1 | d-c | 1.40 | -0.60, 3.39 | 0.168 - 1-1 | 2-2 | a-c | -1.32 | -3.62, 0.99 | 0.258 - 1-1 | 2-2 | a-d | -1.66 | -3.66, 0.34 | 0.102 - 1-1 | 2-2 | b-a | 1.62 | -0.37, 3.62 | 0.109 - 1-1 | 2-2 | b-c | 0.31 | -1.69, 2.30 | 0.761 - 1-1 | 2-2 | b-d | -0.04 | -1.67, 1.60 | 0.966 - 1-1 | 2-2 | d-c | 0.34 | -1.66, 2.34 | 0.734 - 1-1 | 2-3 | a-a | -0.31 | -2.62, 2.00 | 0.790 - 1-1 | 2-3 | a-c | -1.82 | -4.13, 0.49 | 0.120 - 1-1 | 2-3 | a-d | -0.79 | -3.10, 1.52 | 0.498 - 1-1 | 2-3 | b-a | 1.32 | -0.68, 3.31 | 0.194 - 1-1 | 2-3 | b-b | 0.99 | -0.50, 2.48 | 0.189 - 1-1 | 2-3 | b-c | -0.20 | -2.19, 1.80 | 0.845 - 1-1 | 2-3 | b-d | 0.84 | -1.16, 2.83 | 0.407 - 1-1 | 2-3 | c-c | -0.50 | -2.81, 1.80 | 0.665 - 1-1 | 2-3 | d-c | -0.16 | -2.16, 1.84 | 0.873 - 1-1 | 2-3 | d-d | 0.87 | -1.13, 2.87 | 0.388 - 1-1 | 3-1 | a-c | 0.05 | -2.26, 2.35 | 0.968 - 1-1 | 3-1 | a-d | -2.00 | -3.89, -0.12 | 0.037 - 1-1 | 3-1 | b-a | 0.25 | -0.99, 1.50 | 0.687 - 1-1 | 3-1 | b-c | 0.37 | -1.51, 2.25 | 0.697 - 1-1 | 3-1 | b-d | -1.68 | -3.01, -0.35 | 0.014 - 1-1 | 3-1 | d-c | 0.53 | -1.78, 2.83 | 0.651 - 1-1 | 3-2 | a-c | -1.01 | -3.31, 1.30 | 0.386 - 1-1 | 3-2 | a-d | -1.35 | -3.35, 0.65 | 0.182 - 1-1 | 3-2 | b-a | 0.63 | -1.25, 2.52 | 0.505 - 1-1 | 3-2 | b-c | -0.69 | -2.57, 1.20 | 0.471 - 1-1 | 3-2 | b-d | -1.03 | -2.52, 0.46 | 0.173 - 1-1 | 3-2 | d-c | -0.53 | -2.84, 1.78 | 0.649 - 1-1 | 3-3 | a-c | -1.51 | -3.82, 0.79 | 0.196 - 1-1 | 3-3 | a-d | -0.48 | -2.79, 1.83 | 0.680 - 1-1 | 3-3 | b-a | 0.32 | -1.56, 2.21 | 0.733 - 1-1 | 3-3 | b-c | -1.19 | -3.07, 0.69 | 0.213 - 1-1 | 3-3 | b-d | -0.16 | -2.04, 1.73 | 0.870 - 1-1 | 3-3 | d-c | -1.03 | -3.34, 1.27 | 0.375 + x1 x2 x3 Contrast conf.low conf.high p.value + 1 0-0 1-1 a-c 0.13163495 -0.690201472 0.95347138 0.750594354 + 2 0-0 1-1 a-d -0.76930639 -1.724194022 0.18558125 0.112731097 + 3 0-0 1-1 b-a 0.16896698 -0.702722181 1.04065614 0.700528679 + 4 0-0 1-1 b-c 0.30060193 -0.521234490 1.12243836 0.468551731 + 5 0-0 1-1 b-d -0.60033940 -1.555227040 0.35454823 0.214348514 + 6 0-0 1-1 d-c 0.90094134 -0.008664899 1.81054758 0.052166952 + 7 0-0 1-2 a-a 0.43925735 -0.432431814 1.31094651 0.318739903 + 8 0-0 1-2 a-c 0.30631049 -0.648577150 1.26119812 0.524813950 + 9 0-0 1-2 a-d -0.21490846 -1.036744880 0.60692797 0.604007652 + 10 0-0 1-2 b-a 0.60822433 -0.263464832 1.47991349 0.168678551 + 11 0-0 1-2 b-b 0.14767403 -0.874472118 1.16982018 0.774324482 + 12 0-0 1-2 b-c 0.47527747 -0.479610168 1.43016510 0.324676141 + 13 0-0 1-2 b-d -0.04594147 -0.867777898 0.77589495 0.911643044 + 14 0-0 1-2 c-c 0.17467553 -0.734930704 1.08428177 0.703180800 + 15 0-0 1-2 d-c 1.07561687 0.044220346 2.10701340 0.041174879 + 16 0-0 1-2 d-d 0.55439793 -0.355208306 1.46400417 0.228541319 + 17 0-0 1-3 a-a -0.32583114 -1.169840547 0.51817826 0.444342507 + 18 0-0 1-3 a-c 0.15483144 -0.752451406 1.06211429 0.734879276 + 19 0-0 1-3 a-d -0.73315910 -1.755305243 0.28898705 0.157223342 + 20 0-0 1-3 b-a -0.15686416 -1.000873565 0.68714524 0.712289755 + 21 0-0 1-3 b-b 0.02579972 -0.818209680 0.86980913 0.951613361 + 22 0-0 1-3 b-c 0.32379842 -0.583484424 1.23108127 0.479381322 + 23 0-0 1-3 b-d -0.56419211 -1.586338262 0.45795403 0.275090117 + 24 0-0 1-3 c-c 0.02319649 -0.836300617 0.88269359 0.957273685 + 25 0-0 1-3 d-c 0.92413783 -0.063349166 1.91162482 0.066197517 + 26 0-0 1-3 d-d 0.03614729 -1.057813927 1.13010851 0.947701918 + 27 0-0 2-1 a-c -0.30762240 -1.129458822 0.51421403 0.458266039 + 28 0-0 2-1 a-d -1.20856374 -2.163451371 -0.25367610 0.013805181 + 29 0-0 2-1 b-a 0.02129295 -1.000853194 1.04343910 0.967014268 + 30 0-0 2-1 b-c 0.15292790 -0.827049573 1.13290538 0.756799379 + 31 0-0 2-1 b-d -0.74801343 -1.841974652 0.34594778 0.177272250 + 32 0-0 2-1 d-c 0.34654341 -0.422214175 1.11530099 0.372120406 + 33 0-0 2-2 a-c -0.13294686 -1.087834499 0.82194077 0.782305611 + 34 0-0 2-2 a-d -0.65416580 -1.476002229 0.16767062 0.117043194 + 35 0-0 2-2 b-a 0.46055030 -0.561595845 1.48269645 0.372343992 + 36 0-0 2-2 b-c 0.32760344 -0.766357779 1.42156466 0.552655889 + 37 0-0 2-2 b-d -0.19361550 -1.173592981 0.78636198 0.695053822 + 38 0-0 2-2 d-c 0.52121894 -0.388387297 1.43082518 0.257344944 + 39 0-0 2-3 a-a -0.76508849 -1.609097896 0.07892091 0.074966487 + 40 0-0 2-3 a-c -0.28442591 -1.191708755 0.62285694 0.534252260 + 41 0-0 2-3 a-d -1.17241645 -2.194562593 -0.15027030 0.025135305 + 42 0-0 2-3 b-a -0.30453819 -1.303183584 0.69410720 0.545420420 + 43 0-0 2-3 b-b -0.12187431 -1.120519700 0.87677109 0.808611441 + 44 0-0 2-3 b-c 0.17612439 -0.876540279 1.22878907 0.739876326 + 45 0-0 2-3 b-d -0.71186614 -1.865002517 0.44127023 0.222669750 + 46 0-0 2-3 c-c -0.15147905 -1.138966039 0.83600795 0.760805663 + 47 0-0 2-3 d-c 0.36973990 -0.489757210 1.22923700 0.394259449 + 48 0-0 2-3 d-d -0.51825064 -1.498228119 0.46172684 0.295552269 + 49 0-0 3-1 a-c 0.45746610 -0.334951082 1.24988327 0.253830870 + 50 0-0 3-1 a-d -0.44347524 -1.373163509 0.48621302 0.345094438 + 51 0-0 3-1 b-a 0.14316726 -0.700842143 0.98717666 0.736413237 + 52 0-0 3-1 b-c 0.27480221 -0.517614966 1.06721939 0.491863393 + 53 0-0 3-1 b-d -0.62613913 -1.555827393 0.30354914 0.183792208 + 54 0-0 3-1 d-c 0.86479405 -0.115183429 1.84477153 0.082846141 + 55 0-0 3-2 a-c 0.63214163 -0.297546636 1.56182990 0.179673403 + 56 0-0 3-2 a-d 0.11092269 -0.681494489 0.90333987 0.781159612 + 57 0-0 3-2 b-a 0.58242461 -0.261584794 1.42643401 0.173359595 + 58 0-0 3-2 b-c 0.44947775 -0.480210521 1.37916601 0.338643081 + 59 0-0 3-2 b-d -0.07174120 -0.864158374 0.72067598 0.857384957 + 60 0-0 3-2 d-c 1.03946958 -0.054491635 2.13343080 0.062237266 + 61 0-0 3-3 a-c 0.48066258 -0.400059868 1.36138504 0.280483655 + 62 0-0 3-3 a-d -0.40732795 -1.405973346 0.59131744 0.419119941 + 63 0-0 3-3 b-a -0.18266388 -0.998054433 0.63272666 0.656739665 + 64 0-0 3-3 b-c 0.29799870 -0.582723752 1.17872115 0.502421571 + 65 0-0 3-3 b-d -0.58999184 -1.588637230 0.40865356 0.243001711 + 66 0-0 3-3 d-c 0.88799054 -0.164674135 1.94065521 0.097043346 + 67 0-1 1-1 a-a 0.88567883 -0.136467318 1.90782498 0.088453807 + 68 0-1 1-1 a-c 1.00283178 -0.740546546 2.74621011 0.255532047 + 69 0-1 1-1 a-d -1.04667707 -2.172022940 0.07866880 0.067845130 + 70 0-1 1-1 b-a 1.05464581 0.032499664 2.07679196 0.043315720 + 71 0-1 1-1 b-b 1.60147629 -0.141902031 3.34485462 0.071237521 + 72 0-1 1-1 b-c 1.17179876 -0.571579564 2.91517709 0.184663062 + 73 0-1 1-1 b-d -0.87771009 -2.003055958 0.24763578 0.124482469 + 74 0-1 1-1 c-c 0.87119683 -0.847797383 2.59019104 0.315989641 + 75 0-1 1-1 d-c 1.77213817 -0.014293021 3.55856935 0.051814728 + 76 0-1 1-1 d-d -0.27737068 -1.468324808 0.91358344 0.644076546 + 77 0-1 1-2 a-a 1.26621451 -0.477163811 3.00959284 0.152134712 + 78 0-1 1-2 a-c -0.05231632 -1.795694647 1.69106201 0.952497867 + 79 0-1 1-2 a-d -0.39404188 -1.701575624 0.91349187 0.550148012 + 80 0-1 1-2 b-a 1.43518150 -0.308196829 3.17855982 0.105225266 + 81 0-1 1-2 b-b -0.18978174 -1.497315480 1.11775201 0.773306525 + 82 0-1 1-2 b-c 0.11665066 -1.626727665 1.86002899 0.894336671 + 83 0-1 1-2 b-d -0.22507490 -1.532608642 1.08245885 0.732664925 + 84 0-1 1-2 c-c -0.18395127 -1.902945485 1.53504294 0.831795575 + 85 0-1 1-2 d-c 0.71699007 -1.069441122 2.50342125 0.426570437 + 86 0-1 1-2 d-d 0.37526451 -0.989144849 1.73967386 0.585444281 + 87 0-1 1-3 a-a 0.95639292 -0.786985406 2.69977125 0.278019195 + 88 0-1 1-3 a-c -0.55502645 -2.298404781 1.18835187 0.527936397 + 89 0-1 1-3 a-d 0.47734234 -1.266035982 2.22072067 0.587126185 + 90 0-1 1-3 b-a 1.12535990 -0.618018424 2.86873823 0.202474036 + 91 0-1 1-3 b-b 0.80203433 -0.323311545 1.92738020 0.159852023 + 92 0-1 1-3 b-c -0.38605947 -2.129437799 1.35731885 0.660434301 + 93 0-1 1-3 b-d 0.64630933 -1.097069000 2.38968765 0.462571196 + 94 0-1 1-3 c-c -0.68666141 -2.405655618 1.03233280 0.428751592 + 95 0-1 1-3 d-c 0.21427993 -1.572151255 2.00071112 0.811827436 + 96 0-1 1-3 d-d 1.24664873 -0.539782457 3.03307992 0.168624647 + 97 0-1 2-1 a-c 0.56357443 -1.179803895 2.30695276 0.521617806 + 98 0-1 2-1 a-d -1.48593442 -2.611280289 -0.36058855 0.010334962 + 99 0-1 2-1 b-a 0.90697178 -0.246164592 2.06010815 0.121385603 + 100 0-1 2-1 b-c 1.02412473 -0.799143963 2.84739343 0.266784530 + 101 0-1 2-1 b-d -1.02538412 -2.270913754 0.22014552 0.105211614 + 102 0-1 2-1 d-c 1.21774024 -0.501253976 2.93673445 0.162352605 + 103 0-1 2-2 a-a 0.82695717 -0.916421161 2.57033549 0.347788791 + 104 0-1 2-2 a-c -0.49157367 -2.234951996 1.25180466 0.576051658 + 105 0-1 2-2 a-d -0.83329923 -2.140832973 0.47423452 0.208205576 + 106 0-1 2-2 b-a 1.28750747 -0.535761228 3.11077616 0.163673346 + 107 0-1 2-2 b-b -0.33745577 -1.749753624 1.07484209 0.635516392 + 108 0-1 2-2 b-c -0.03102337 -1.854292064 1.79224533 0.973054670 + 109 0-1 2-2 b-d -0.37274893 -1.785046785 1.03954893 0.600652277 + 110 0-1 2-2 c-c -0.35862681 -2.145057994 1.42780438 0.690403914 + 111 0-1 2-2 d-c 0.16259213 -1.556402077 1.88158635 0.851078079 + 112 0-1 2-2 d-d -0.17913342 -1.453973651 1.09570680 0.780346196 + 113 0-1 2-3 a-a 0.51713557 -1.226242755 2.26051390 0.556416220 + 114 0-1 2-3 a-c -0.99428380 -2.737662130 0.74909452 0.259571469 + 115 0-1 2-3 a-d 0.03808499 -1.705293332 1.78146332 0.965409814 + 116 0-1 2-3 b-a 0.97768587 -0.845582823 2.80095457 0.288906302 + 117 0-1 2-3 b-b 0.65436030 -0.591169341 1.89988993 0.298711706 + 118 0-1 2-3 b-c -0.53373350 -2.357002198 1.28953519 0.561598414 + 119 0-1 2-3 b-d 0.49863530 -1.324633399 2.32190399 0.587560735 + 120 0-1 2-3 c-c -0.86133694 -2.647768128 0.92509425 0.339951935 + 121 0-1 2-3 d-c -0.34011800 -2.059112211 1.37887621 0.694633048 + 122 0-1 2-3 d-d 0.69225080 -1.026743413 2.41124501 0.425018945 + 123 0-1 3-1 a-c 1.32866292 -0.401041635 3.05836748 0.130195270 + 124 0-1 3-1 a-d -0.72084593 -1.824889948 0.38319810 0.197396556 + 125 0-1 3-1 b-a 1.02884609 0.030200695 2.02749148 0.043623526 + 126 0-1 3-1 b-c 1.14599904 -0.583705520 2.87570360 0.190942201 + 127 0-1 3-1 b-d -0.90350981 -2.007553832 0.20053421 0.107257877 + 128 0-1 3-1 d-c 1.73599088 -0.087277819 3.55925957 0.061716539 + 129 0-1 3-2 a-c 0.27351482 -1.456189737 2.00321938 0.753670790 + 130 0-1 3-2 a-d -0.06821074 -1.357456394 1.22103492 0.916356372 + 131 0-1 3-2 b-a 1.40938177 -0.320322785 3.13908633 0.108765597 + 132 0-1 3-2 b-c 0.09085094 -1.638853621 1.82055550 0.916960440 + 133 0-1 3-2 b-d -0.25087462 -1.540120278 1.03837104 0.699424932 + 134 0-1 3-2 d-c 0.68084278 -1.142425920 2.50411147 0.459334235 + 135 0-1 3-3 a-a 1.28222406 -0.447480496 3.01192862 0.143962768 + 136 0-1 3-3 a-c -0.22919531 -1.958899870 1.50050925 0.792565473 + 137 0-1 3-3 a-d 0.80317349 -0.926531072 2.53287805 0.357988778 + 138 0-1 3-3 b-a 1.09956018 -0.630144380 2.82926474 0.209347551 + 139 0-1 3-3 b-b 0.77623460 -0.327809420 1.88027863 0.165489536 + 140 0-1 3-3 b-c -0.41185920 -2.141563755 1.31784536 0.636691140 + 141 0-1 3-3 b-d 0.62050960 -1.109194956 2.35021416 0.477114758 + 142 0-1 3-3 c-c -0.70985790 -2.471302801 1.05158701 0.424686271 + 143 0-1 3-3 d-c 0.17813264 -1.645136054 2.00140134 0.846236565 + 144 0-1 3-3 d-d 1.21050144 -0.612767255 3.03377014 0.190031394 + 145 1-0 1-1 a-c -0.75404388 -1.734021355 0.22593360 0.129553197 + 146 1-0 1-1 a-d -1.65498522 -2.748946433 -0.56102400 0.003512010 + 147 1-0 1-1 b-a -1.43250931 -3.175887639 0.31086901 0.105863625 + 148 1-0 1-1 b-c -1.30087436 -3.019868572 0.41811985 0.135897932 + 149 1-0 1-1 b-d -2.20181570 -3.988246887 -0.41538451 0.016383967 + 150 1-0 1-1 d-c 1.17831202 0.091124623 2.26549942 0.034037375 + 151 1-0 1-2 a-a -0.44642148 -1.468567627 0.57572467 0.387115253 + 152 1-0 1-2 a-c -0.57936834 -1.673329560 0.51459287 0.294857827 + 153 1-0 1-2 a-d -1.10058728 -2.080564762 -0.12060981 0.028231848 + 154 1-0 1-2 b-a -0.99325196 -2.736630289 0.75012636 0.260062108 + 155 1-0 1-2 b-b -1.45380227 -3.277070961 0.36946643 0.116419962 + 156 1-0 1-2 b-c -1.12619883 -2.912630014 0.66023236 0.213112445 + 157 1-0 1-2 b-d -1.64741777 -3.366411979 0.07157644 0.060071071 + 158 1-0 1-2 c-c -0.69652129 -2.482952482 1.08990989 0.439838023 + 159 1-0 1-2 d-c 1.35298756 0.162033430 2.54394168 0.026513775 + 160 1-0 1-2 d-d 0.83176861 -0.255418784 1.91895601 0.131719637 + 161 1-0 1-3 a-a -1.21150997 -2.210155366 -0.21286458 0.018083724 + 162 1-0 1-3 a-c -0.73084739 -1.783512060 0.32181728 0.170780414 + 163 1-0 1-3 a-d -1.61883793 -2.771974298 -0.46570155 0.006548296 + 164 1-0 1-3 b-a -1.75834046 -3.488045016 -0.02863590 0.046416974 + 165 1-0 1-3 b-b -1.57567657 -3.305381132 0.15402799 0.073575404 + 166 1-0 1-3 b-c -1.27767787 -3.039122777 0.48376703 0.152659506 + 167 1-0 1-3 b-d -2.16566841 -3.988937105 -0.34239971 0.020546496 + 168 1-0 1-3 c-c -0.84800034 -2.609445245 0.91344457 0.340681177 + 169 1-0 1-3 d-c 1.20150851 0.048372137 2.35464488 0.041350235 + 170 1-0 1-3 d-d 0.31351797 -0.932011664 1.55904761 0.617585842 + 171 1-0 2-1 a-c -1.13457956 -2.853573774 0.58441465 0.192613082 + 172 1-0 2-1 a-d -2.03552090 -3.821952089 -0.24908971 0.026081663 + 173 1-0 2-1 b-a 0.35874872 -0.948785027 1.66628246 0.586353105 + 174 1-0 2-1 b-c 0.49038367 -0.784456557 1.76522390 0.445976476 + 175 1-0 2-1 b-d -0.41055767 -1.774967025 0.95385169 0.550752371 + 176 1-0 2-1 d-c 0.52567683 -0.749163396 1.80051706 0.414066601 + 177 1-0 2-2 a-c -0.95990403 -2.746335216 0.82652716 0.287922425 + 178 1-0 2-2 a-d -1.48112297 -3.200117181 0.23787124 0.090223368 + 179 1-0 2-2 b-a 0.79800607 -0.509527677 2.10553981 0.227920551 + 180 1-0 2-2 b-c 0.66505920 -0.699350153 2.02946856 0.334723249 + 181 1-0 2-2 b-d 0.14384026 -1.130999964 1.41868049 0.822799825 + 182 1-0 2-2 d-c 0.70035236 -0.664056992 2.06476172 0.309869339 + 183 1-0 2-3 a-a -1.59204566 -3.321750218 0.13765890 0.070693932 + 184 1-0 2-3 a-c -1.11138307 -2.872827979 0.65006183 0.212730864 + 185 1-0 2-3 a-d -1.99937361 -3.822642307 -0.17610492 0.032043775 + 186 1-0 2-3 b-a 0.03291757 -1.256328085 1.32216323 0.959576679 + 187 1-0 2-3 b-b 0.21558146 -1.073664200 1.50482712 0.740022654 + 188 1-0 2-3 b-c 0.51358016 -0.817947032 1.84510735 0.444746883 + 189 1-0 2-3 b-d -0.37441038 -1.786708237 1.03788748 0.599032935 + 190 1-0 2-3 c-c 0.20714776 -1.554297143 1.96859267 0.815441859 + 191 1-0 2-3 d-c 0.54887332 -0.782653871 1.88040051 0.414217491 + 192 1-0 2-3 d-d -0.33911722 -1.751415076 1.07318064 0.633855677 + 193 1-0 3-1 a-c -0.82475797 -2.543752180 0.89423624 0.342310886 + 194 1-0 3-1 a-d -1.72569931 -3.512130494 0.06073188 0.058103480 + 195 1-0 3-1 b-a -0.63306734 -1.758413214 0.49227853 0.266061870 + 196 1-0 3-1 b-c -0.50143239 -1.588619790 0.58575501 0.361211622 + 197 1-0 3-1 b-d -1.40237373 -2.593327855 -0.21141960 0.021626269 + 198 1-0 3-1 d-c -0.34570739 -2.064701603 1.37328682 0.689878310 + 199 1-0 3-2 a-c -0.65008243 -2.436513622 1.13634875 0.470818794 + 200 1-0 3-2 a-d -1.17130138 -2.890295587 0.54769284 0.178765955 + 201 1-0 3-2 b-a -0.19380999 -1.319155864 0.93153588 0.732537131 + 202 1-0 3-2 b-c -0.32675686 -1.517710982 0.86419727 0.586359794 + 203 1-0 3-2 b-d -0.84797580 -1.935163197 0.23921160 0.124470533 + 204 1-0 3-2 d-c -0.17103186 -1.957463045 1.61539933 0.849283541 + 205 1-0 3-3 a-c -0.80156148 -2.563006385 0.95988343 0.367626467 + 206 1-0 3-3 a-d -1.68955202 -3.512820712 0.13371668 0.068844252 + 207 1-0 3-3 b-a -0.95889849 -2.062942510 0.14514554 0.087719495 + 208 1-0 3-3 b-c -0.47823590 -1.631372275 0.67490047 0.411390248 + 209 1-0 3-3 b-d -1.36622644 -2.611756077 -0.12069680 0.031995687 + 210 1-0 3-3 d-c -0.32251090 -2.083955808 1.43893400 0.716374730 + 211 1-1 1-1 a-c 0.11715295 -1.706115744 1.94042165 0.898507864 + 212 1-1 1-1 a-d -1.93235590 -3.177885536 -0.68682626 0.002796701 + 213 1-1 1-1 b-a -0.54683048 -2.370099179 1.27643821 0.552057472 + 214 1-1 1-1 b-c -0.42967753 -2.735950278 1.87659521 0.711621521 + 215 1-1 1-1 b-d -2.47918638 -4.362250194 -0.59612257 0.010550461 + 216 1-1 1-1 d-c 2.04950885 0.166445038 3.93257266 0.033311287 + 217 1-1 1-2 a-a 0.38053569 -1.442733010 2.20380438 0.678813071 + 218 1-1 1-2 a-c -0.93799515 -2.761263846 0.88527355 0.308787245 + 219 1-1 1-2 a-d -1.27972071 -2.692018567 0.13257715 0.075081719 + 220 1-1 1-2 b-a -0.16629480 -2.472567544 2.13997795 0.886188218 + 221 1-1 1-2 b-b -1.79125803 -3.788548817 0.20603276 0.078052173 + 222 1-1 1-2 b-c -1.48482563 -3.791098380 0.82144711 0.203642097 + 223 1-1 1-2 b-d -1.82655119 -3.823841978 0.17073959 0.072479198 + 224 1-1 1-2 c-c -1.05514810 -3.361420847 1.25112464 0.365063459 + 225 1-1 1-2 d-c 0.99436075 -0.888703063 2.87742456 0.296264194 + 226 1-1 1-2 d-d 0.65263519 -0.836057466 2.14132785 0.385337760 + 227 1-1 1-3 a-a 0.07071409 -1.752554604 1.89398279 0.938631240 + 228 1-1 1-3 a-c -1.44070528 -3.263973979 0.38256341 0.119693665 + 229 1-1 1-3 a-d -0.40833649 -2.231605181 1.41493221 0.656827939 + 230 1-1 1-3 b-a -0.47611639 -2.782389138 1.83015635 0.682105706 + 231 1-1 1-3 b-b -0.79944197 -2.682505781 1.08362184 0.400457480 + 232 1-1 1-3 b-c -1.98753577 -4.293808513 0.31873698 0.090159696 + 233 1-1 1-3 b-d -0.95516697 -3.261439715 1.35110578 0.412025790 + 234 1-1 1-3 c-c -1.55785823 -3.864130981 0.74841451 0.182512757 + 235 1-1 1-3 d-c 0.49165061 -1.391413197 2.37471443 0.604569874 + 236 1-1 1-3 d-d 1.52401941 -0.359044398 3.40708323 0.111124801 + 237 1-1 2-1 a-c -0.26338273 -2.569655480 2.04289001 0.820681097 + 238 1-1 2-1 a-d -2.31289158 -4.195955396 -0.42982777 0.016745220 + 239 1-1 2-1 b-a 1.24442755 -0.167870312 2.65672541 0.083300328 + 240 1-1 2-1 b-c 1.36158050 -0.635710288 3.35887128 0.178560596 + 241 1-1 2-1 b-d -0.68792835 -2.176621008 0.80076430 0.360298621 + 242 1-1 2-1 d-c 1.39687366 -0.600417127 3.39416445 0.167697904 + 243 1-1 2-2 a-c -1.31853084 -3.624803582 0.98774191 0.258417727 + 244 1-1 2-2 a-d -1.66025639 -3.657547180 0.33703439 0.101929440 + 245 1-1 2-2 b-a 1.62496323 -0.372327553 3.62225402 0.109290192 + 246 1-1 2-2 b-c 0.30643240 -1.690858389 2.30372318 0.760767129 + 247 1-1 2-2 b-d -0.03529316 -1.666074259 1.59548794 0.965732051 + 248 1-1 2-2 d-c 0.34172556 -1.655565228 2.33901634 0.734221218 + 249 1-1 2-3 a-a -0.30982159 -2.616094341 1.99645115 0.789763850 + 250 1-1 2-3 a-c -1.82124097 -4.127513715 0.48503178 0.119918233 + 251 1-1 2-3 a-d -0.78887217 -3.095144917 1.51740058 0.497776604 + 252 1-1 2-3 b-a 1.31514164 -0.682149148 3.31243242 0.193656592 + 253 1-1 2-3 b-b 0.99181606 -0.496876595 2.48050872 0.188508813 + 254 1-1 2-3 b-c -0.19627774 -2.193568523 1.80101305 0.845347292 + 255 1-1 2-3 b-d 0.83609106 -1.161199724 2.83338185 0.407040734 + 256 1-1 2-3 c-c -0.50271013 -2.808982880 1.80356261 0.665420329 + 257 1-1 2-3 d-c -0.16098458 -2.158275361 1.83630621 0.872888153 + 258 1-1 2-3 d-d 0.87138422 -1.125906563 2.86867501 0.387619573 + 259 1-1 3-1 a-c 0.04643886 -2.259833886 2.35271161 0.968115295 + 260 1-1 3-1 a-d -2.00306999 -3.886133801 -0.12000618 0.037392050 + 261 1-1 3-1 b-a 0.25261149 -0.992918152 1.49814112 0.687391163 + 262 1-1 3-1 b-c 0.36976444 -1.513299375 2.25282825 0.696824084 + 263 1-1 3-1 b-d -1.67974441 -3.011271603 -0.34821722 0.014106286 + 264 1-1 3-1 d-c 0.52548944 -1.780783310 2.83176218 0.651260938 + 265 1-1 3-2 a-c -1.00870924 -3.314981987 1.29756350 0.386437196 + 266 1-1 3-2 a-d -1.35043480 -3.347725585 0.64685599 0.182099738 + 267 1-1 3-2 b-a 0.63314717 -1.249916640 2.51621098 0.505100890 + 268 1-1 3-2 b-c -0.68538366 -2.568447476 1.19768015 0.470730657 + 269 1-1 3-2 b-d -1.02710922 -2.515801879 0.46158343 0.173438672 + 270 1-1 3-2 d-c -0.52965866 -2.835931411 1.77661408 0.648683024 + 271 1-1 3-3 a-c -1.51141937 -3.817692121 0.79485337 0.195747077 + 272 1-1 3-3 a-d -0.47905058 -2.785323322 1.82722217 0.680256760 + 273 1-1 3-3 b-a 0.32332558 -1.559738235 2.20638939 0.733314375 + 274 1-1 3-3 b-c -1.18809380 -3.071157610 0.69497001 0.212740270 + 275 1-1 3-3 b-d -0.15572500 -2.038788811 1.72733881 0.869612139 + 276 1-1 3-3 d-c -1.03236880 -3.338641544 1.27390395 0.375452053 --- @@ -290,98 +287,129 @@ print(test_predictions(m, terms = c("x1", "x2", "x3"), engine = "emmeans", test = "interaction")) Output - # Interaction contrasts - - x1 | x2 | x3 | Contrast | 95% CI | p - -------------------------------------------------------- - 0-1 | 1 and 2 | a and c | -1.17 | -4.37, 2.03 | 0.468 - 0-1 | 1 and 2 | a and d | 0.16 | -2.51, 2.83 | 0.907 - 0-1 | 1 and 2 | b and a | 1.88 | -1.14, 4.90 | 0.219 - 0-1 | 1 and 2 | b and c | 0.71 | -2.63, 4.05 | 0.674 - 0-1 | 1 and 2 | b and d | 2.04 | -0.80, 4.88 | 0.158 - 0-1 | 1 and 2 | d and c | -1.33 | -4.36, 1.70 | 0.386 - 0-1 | 1 and 3 | a and c | -1.98 | -5.15, 1.20 | 0.219 - 0-1 | 1 and 3 | a and d | 1.09 | -1.87, 4.05 | 0.465 - 0-1 | 1 and 3 | b and a | 1.22 | -1.66, 4.10 | 0.401 - 0-1 | 1 and 3 | b and c | -0.76 | -3.97, 2.46 | 0.641 - 0-1 | 1 and 3 | b and d | 2.31 | -0.69, 5.31 | 0.129 - 0-1 | 1 and 3 | d and c | -3.07 | -6.36, 0.22 | 0.067 - 0-1 | 2 and 3 | a and c | -0.81 | -4.32, 2.70 | 0.649 - 0-1 | 2 and 3 | a and d | 0.93 | -2.38, 4.25 | 0.576 - 0-1 | 2 and 3 | b and a | -0.66 | -3.70, 2.38 | 0.667 - 0-1 | 2 and 3 | b and c | -1.46 | -4.55, 1.62 | 0.347 - 0-1 | 2 and 3 | b and d | 0.28 | -2.58, 3.13 | 0.848 - 0-1 | 2 and 3 | d and c | -1.74 | -5.09, 1.61 | 0.304 + x1 x2 x3 Contrast conf.low conf.high p.value + 1 0-1 1 and 2 a and c -1.1711020 -4.3696060 2.0274021 0.4681012 + 2 0-1 1 and 2 a and d 0.1569589 -2.5128239 2.8267417 0.9070959 + 3 0-1 1 and 2 b and a 1.8802104 -1.1394094 4.8998302 0.2187374 + 4 0-1 1 and 2 b and c 0.7091084 -2.6345768 4.0527936 0.6739389 + 5 0-1 1 and 2 b and d 2.0371693 -0.8049325 4.8792711 0.1575042 + 6 0-1 1 and 2 d and c -1.3280609 -4.3595402 1.7034184 0.3856666 + 7 0-1 1 and 3 a and c -1.9776000 -5.1547512 1.1995513 0.2188987 + 8 0-1 1 and 3 a and d 1.0913269 -1.8716684 4.0543222 0.4654675 + 9 0-1 1 and 3 b and a 1.2217869 -1.6583071 4.1018810 0.4008171 + 10 0-1 1 and 3 b and c -0.7558130 -3.9676521 2.4560261 0.6406383 + 11 0-1 1 and 3 b and d 2.3131138 -0.6870465 5.3132741 0.1287960 + 12 0-1 1 and 3 d and c -3.0689268 -6.3553093 0.2174556 0.0667711 + 13 0-1 2 and 3 a and c -0.8064980 -4.3172344 2.7042385 0.6485929 + 14 0-1 2 and 3 a and d 0.9343680 -2.3793569 4.2480928 0.5760477 + 15 0-1 2 and 3 b and a -0.6584235 -3.6989406 2.3820936 0.6674738 + 16 0-1 2 and 3 b and c -1.4649215 -4.5483486 1.6185057 0.3470280 + 17 0-1 2 and 3 b and d 0.2759445 -2.5811563 3.1330453 0.8479735 + 18 0-1 2 and 3 d and c -1.7408660 -5.0940064 1.6122745 0.3044031 # test_predictions, engine emmeans, by and variable name = level value Code print(test_predictions(m, c("time", "coffee"), engine = "emmeans")) Output - # Pairwise comparisons - - time | coffee | Contrast | 95% CI | p - ------------------------------------------------------------------------ - afternoon-afternoon | coffee-control | 1.93 | -2.02, 5.88 | 0.336 - afternoon-morning | coffee-control | 7.71 | 3.76, 11.66 | < .001 - afternoon-noon | coffee-control | 1.93 | -2.02, 5.88 | 0.336 - morning-afternoon | coffee-coffee | -1.93 | -5.88, 2.02 | 0.336 - morning-afternoon | coffee-control | 0.00 | -3.95, 3.95 | > .999 - morning-afternoon | control-control | -5.78 | -9.73, -1.83 | 0.004 - morning-morning | coffee-control | 5.78 | 1.83, 9.73 | 0.004 - morning-noon | coffee-coffee | 1.93 | -2.02, 5.88 | 0.336 - morning-noon | coffee-control | 0.00 | -3.95, 3.95 | > .999 - morning-noon | control-control | -5.78 | -9.73, -1.83 | 0.004 - noon-afternoon | coffee-coffee | -3.86 | -7.81, 0.09 | 0.056 - noon-afternoon | coffee-control | -1.93 | -5.88, 2.02 | 0.336 - noon-afternoon | control-control | 0.00 | -3.95, 3.95 | > .999 - noon-morning | coffee-control | 3.86 | -0.09, 7.81 | 0.056 - noon-noon | coffee-control | -1.93 | -5.88, 2.02 | 0.336 + time coffee Contrast conf.low conf.high + 1 afternoon-afternoon coffee-control 1.927659e+00 -2.0220794 5.8773984 + 2 afternoon-morning coffee-control 7.710638e+00 3.7608991 11.6603769 + 3 afternoon-noon coffee-control 1.927659e+00 -2.0220794 5.8773984 + 4 morning-afternoon coffee-coffee -1.927659e+00 -5.8773984 2.0220794 + 5 morning-afternoon coffee-control -3.552714e-15 -3.9497389 3.9497389 + 6 morning-afternoon control-control -5.782978e+00 -9.7327174 -1.8332396 + 7 morning-morning coffee-control 5.782978e+00 1.8332396 9.7327174 + 8 morning-noon coffee-coffee 1.927659e+00 -2.0220794 5.8773984 + 9 morning-noon coffee-control -6.217249e-15 -3.9497389 3.9497389 + 10 morning-noon control-control -5.782978e+00 -9.7327174 -1.8332396 + 11 noon-afternoon coffee-coffee -3.855319e+00 -7.8050579 0.0944199 + 12 noon-afternoon coffee-control -1.927659e+00 -5.8773984 2.0220794 + 13 noon-afternoon control-control 2.664535e-15 -3.9497389 3.9497389 + 14 noon-morning coffee-control 3.855319e+00 -0.0944199 7.8050579 + 15 noon-noon coffee-control -1.927659e+00 -5.8773984 2.0220794 + p.value + 1 0.3356540173 + 2 0.0001841091 + 3 0.3356540173 + 4 0.3356540173 + 5 1.0000000000 + 6 0.0044754582 + 7 0.0044754582 + 8 0.3356540173 + 9 1.0000000000 + 10 0.0044754582 + 11 0.0556363585 + 12 0.3356540173 + 13 1.0000000000 + 14 0.0556363585 + 15 0.3356540173 --- Code print(test_predictions(m, c("time", "coffee"), by = "sex", engine = "emmeans")) Output - # Pairwise comparisons - - sex = female - - time | coffee | Contrast | 95% CI | p - ------------------------------------------------------------------------ - afternoon-afternoon | coffee-control | 1.93 | -2.02, 5.88 | 0.336 - afternoon-morning | coffee-control | 7.71 | 3.76, 11.66 | < .001 - afternoon-noon | coffee-control | 1.93 | -2.02, 5.88 | 0.336 - morning-afternoon | coffee-coffee | -1.93 | -5.88, 2.02 | 0.336 - morning-afternoon | coffee-control | 0.00 | -3.95, 3.95 | > .999 - morning-afternoon | control-control | -5.78 | -9.73, -1.83 | 0.004 - morning-morning | coffee-control | 5.78 | 1.83, 9.73 | 0.004 - morning-noon | coffee-coffee | 1.93 | -2.02, 5.88 | 0.336 - morning-noon | coffee-control | 0.00 | -3.95, 3.95 | > .999 - morning-noon | control-control | -5.78 | -9.73, -1.83 | 0.004 - noon-afternoon | coffee-coffee | -3.86 | -7.81, 0.09 | 0.056 - noon-afternoon | coffee-control | -1.93 | -5.88, 2.02 | 0.336 - noon-afternoon | control-control | 0.00 | -3.95, 3.95 | > .999 - noon-morning | coffee-control | 3.86 | -0.09, 7.81 | 0.056 - noon-noon | coffee-control | -1.93 | -5.88, 2.02 | 0.336 - - sex = male - - time | coffee | Contrast | 95% CI | p - ------------------------------------------------------------------------ - afternoon-afternoon | coffee-control | 1.93 | -2.02, 5.88 | 0.336 - afternoon-morning | coffee-control | 7.71 | 3.76, 11.66 | < .001 - afternoon-noon | coffee-control | 1.93 | -2.02, 5.88 | 0.336 - morning-afternoon | coffee-coffee | -1.93 | -5.88, 2.02 | 0.336 - morning-afternoon | coffee-control | 0.00 | -3.95, 3.95 | > .999 - morning-afternoon | control-control | -5.78 | -9.73, -1.83 | 0.004 - morning-morning | coffee-control | 5.78 | 1.83, 9.73 | 0.004 - morning-noon | coffee-coffee | 1.93 | -2.02, 5.88 | 0.336 - morning-noon | coffee-control | 0.00 | -3.95, 3.95 | > .999 - morning-noon | control-control | -5.78 | -9.73, -1.83 | 0.004 - noon-afternoon | coffee-coffee | -3.86 | -7.81, 0.09 | 0.056 - noon-afternoon | coffee-control | -1.93 | -5.88, 2.02 | 0.336 - noon-afternoon | control-control | 0.00 | -3.95, 3.95 | > .999 - noon-morning | coffee-control | 3.86 | -0.09, 7.81 | 0.056 - noon-noon | coffee-control | -1.93 | -5.88, 2.02 | 0.336 + time coffee sex Contrast conf.low + 1 afternoon-afternoon coffee-control female 1.927659e+00 -2.0220794 + 2 afternoon-morning coffee-control female 7.710638e+00 3.7608991 + 3 afternoon-noon coffee-control female 1.927659e+00 -2.0220794 + 4 morning-afternoon coffee-coffee female -1.927659e+00 -5.8773984 + 5 morning-afternoon coffee-control female -3.552714e-15 -3.9497389 + 6 morning-afternoon control-control female -5.782978e+00 -9.7327174 + 7 morning-morning coffee-control female 5.782978e+00 1.8332396 + 8 morning-noon coffee-coffee female 1.927659e+00 -2.0220794 + 9 morning-noon coffee-control female -7.105427e-15 -3.9497389 + 10 morning-noon control-control female -5.782978e+00 -9.7327174 + 11 noon-afternoon coffee-coffee female -3.855319e+00 -7.8050579 + 12 noon-afternoon coffee-control female -1.927659e+00 -5.8773984 + 13 noon-afternoon control-control female 3.552714e-15 -3.9497389 + 14 noon-morning coffee-control female 3.855319e+00 -0.0944199 + 15 noon-noon coffee-control female -1.927659e+00 -5.8773984 + 16 afternoon-afternoon coffee-control male 1.927659e+00 -2.0220794 + 17 afternoon-morning coffee-control male 7.710638e+00 3.7608991 + 18 afternoon-noon coffee-control male 1.927659e+00 -2.0220794 + 19 morning-afternoon coffee-coffee male -1.927659e+00 -5.8773984 + 20 morning-afternoon coffee-control male -3.552714e-15 -3.9497389 + 21 morning-afternoon control-control male -5.782978e+00 -9.7327174 + 22 morning-morning coffee-control male 5.782978e+00 1.8332396 + 23 morning-noon coffee-coffee male 1.927659e+00 -2.0220794 + 24 morning-noon coffee-control male -5.329071e-15 -3.9497389 + 25 morning-noon control-control male -5.782978e+00 -9.7327174 + 26 noon-afternoon coffee-coffee male -3.855319e+00 -7.8050579 + 27 noon-afternoon coffee-control male -1.927659e+00 -5.8773984 + 28 noon-afternoon control-control male 1.776357e-15 -3.9497389 + 29 noon-morning coffee-control male 3.855319e+00 -0.0944199 + 30 noon-noon coffee-control male -1.927659e+00 -5.8773984 + conf.high p.value + 1 5.8773984 0.3356540173 + 2 11.6603769 0.0001841091 + 3 5.8773984 0.3356540173 + 4 2.0220794 0.3356540173 + 5 3.9497389 1.0000000000 + 6 -1.8332396 0.0044754582 + 7 9.7327174 0.0044754582 + 8 5.8773984 0.3356540173 + 9 3.9497389 1.0000000000 + 10 -1.8332396 0.0044754582 + 11 0.0944199 0.0556363585 + 12 2.0220794 0.3356540173 + 13 3.9497389 1.0000000000 + 14 7.8050579 0.0556363585 + 15 2.0220794 0.3356540173 + 16 5.8773984 0.3356540173 + 17 11.6603769 0.0001841091 + 18 5.8773984 0.3356540173 + 19 2.0220794 0.3356540173 + 20 3.9497389 1.0000000000 + 21 -1.8332396 0.0044754582 + 22 9.7327174 0.0044754582 + 23 5.8773984 0.3356540173 + 24 3.9497389 1.0000000000 + 25 -1.8332396 0.0044754582 + 26 0.0944199 0.0556363585 + 27 2.0220794 0.3356540173 + 28 3.9497389 1.0000000000 + 29 7.8050579 0.0556363585 + 30 2.0220794 0.3356540173 diff --git a/tests/testthat/test-test_predictions_emmeans.R b/tests/testthat/test-test_predictions_emmeans.R index fad5ce78..c3ae7fcd 100644 --- a/tests/testthat/test-test_predictions_emmeans.R +++ b/tests/testthat/test-test_predictions_emmeans.R @@ -82,12 +82,6 @@ test_that("test_predictions, engine emmeans, glm binomial", { expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-1) expect_identical(out1$c172code, out2$c172code) - # slope - out1 <- test_predictions(m, "var_cont", margin = "marginaleffects") - out2 <- test_predictions(m, "var_cont", engine = "emmeans") - expect_equal(out1$Slope, out2$Slope, tolerance = 1e-2) - expect_identical(out1$c172code, out2$c172code) - # multiple focal terms, interaction m <- glm(outcome ~ var_binom * var_cont + groups, data = dat, family = binomial() From b4d0e072270942d1875e1028e8fe82a30cc1b9e3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:40:40 +0100 Subject: [PATCH 38/51] Update test-test_predictions_emmeans.R --- .../testthat/test-test_predictions_emmeans.R | 43 +++---------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/tests/testthat/test-test_predictions_emmeans.R b/tests/testthat/test-test_predictions_emmeans.R index c3ae7fcd..8bec52e6 100644 --- a/tests/testthat/test-test_predictions_emmeans.R +++ b/tests/testthat/test-test_predictions_emmeans.R @@ -17,30 +17,15 @@ test_that("test_predictions, engine emmeans", { # categorical out1 <- test_predictions(m, "c172code") out2 <- test_predictions(m, "c172code", engine = "emmeans") - expect_equal(out1$Contrast, out2$Contrast * -1, tolerance = 1e-3) - expect_identical(out1$c172code, out2$c172code) - expect_equal(attributes(out1)$standard_error, attributes(out2)$standard_error, tolerance = 1e-3) - - # slope - out1 <- test_predictions(m, "neg_c_7") - out2 <- test_predictions(m, "neg_c_7", engine = "emmeans") - expect_equal(out1$Slope, out2$Slope, tolerance = 1e-3) - expect_identical(out1$c172code, out2$c172code) + expect_equal(out1$Difference, out2$Contrast * -1, tolerance = 1e-3) # multiple focal terms, interaction m <- lm(barthtot ~ c12hour + neg_c_7 + c161sex * c172code, data = efc) - # categorical - out1 <- test_predictions(m, c("c172code", "c161sex")) - out1 <- datawizard::data_arrange(out1, c("c172code", "c161sex")) - out2 <- test_predictions(m, c("c172code", "c161sex"), engine = "emmeans") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-3) - expect_identical(out1$c172code, out2$c172code) - # difference-in-difference out1 <- test_predictions(m, c("c172code", "c161sex"), test = "(b1 - b2) = (b4 - b5)") out2 <- test_predictions(m, c("c172code", "c161sex"), engine = "emmeans", test = "interaction") - expect_equal(out1$Contrast[1], out2$Contrast[1], tolerance = 1e-3) + expect_equal(out1$Difference[1], out2$Contrast[1], tolerance = 1e-3) expect_identical(out2$c172code, c("1-2", "1-3", "2-3")) expect_identical(out2$c161sex, c("male and female", "male and female", "male and female")) expect_identical(attributes(out2)$test, "interaction") @@ -50,15 +35,9 @@ test_that("test_predictions, engine emmeans", { # interaction numeric * categorical m <- lm(barthtot ~ c12hour + neg_c_7 * c161sex, data = efc) - out1 <- test_predictions(m, c("neg_c_7", "c161sex")) + out1 <- test_predictions(m, "neg_c_7", by = "c161sex") out2 <- test_predictions(m, c("neg_c_7", "c161sex"), engine = "emmeans") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-3) - - out1 <- test_predictions(m, c("c161sex", "neg_c_7")) - out1 <- datawizard::data_arrange(out1, c("c161sex", "neg_c_7")) - out2 <- test_predictions(m, c("c161sex", "neg_c_7"), engine = "emmeans") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-3) - expect_identical(out1$neg_c_7, out2$neg_c_7) + expect_equal(out1$Difference, out2$Contrast * -1, tolerance = 1e-3) }) @@ -79,19 +58,7 @@ test_that("test_predictions, engine emmeans, glm binomial", { # categorical out1 <- test_predictions(m, "var_binom", margin = "marginaleffects") out2 <- test_predictions(m, "var_binom", engine = "emmeans") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-1) - expect_identical(out1$c172code, out2$c172code) - - # multiple focal terms, interaction - m <- glm(outcome ~ var_binom * var_cont + groups, - data = dat, family = binomial() - ) - - # interaction numeric * categorical - out1 <- test_predictions(m, c("var_cont", "var_binom"), margin = "marginaleffects") - out2 <- test_predictions(m, c("var_cont", "var_binom"), engine = "emmeans") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-2) - expect_identical(out1$c172code, out2$c172code) + expect_equal(out1$Difference, out2$Contrast * -1, tolerance = 1e-1) # multiple focal terms, interaction m <- glm(outcome ~ var_binom * groups, From 6efb789aaba66f001869c08bcddacf07f2b503de Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:41:12 +0100 Subject: [PATCH 39/51] Update test-test_predictions_emmeans.R --- .../testthat/test-test_predictions_emmeans.R | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/tests/testthat/test-test_predictions_emmeans.R b/tests/testthat/test-test_predictions_emmeans.R index 8bec52e6..ce1ebc65 100644 --- a/tests/testthat/test-test_predictions_emmeans.R +++ b/tests/testthat/test-test_predictions_emmeans.R @@ -59,25 +59,6 @@ test_that("test_predictions, engine emmeans, glm binomial", { out1 <- test_predictions(m, "var_binom", margin = "marginaleffects") out2 <- test_predictions(m, "var_binom", engine = "emmeans") expect_equal(out1$Difference, out2$Contrast * -1, tolerance = 1e-1) - - # multiple focal terms, interaction - m <- glm(outcome ~ var_binom * groups, - data = dat, family = binomial() - ) - - # categorical - out1 <- test_predictions(m, c("groups", "var_binom"), margin = "marginaleffects", verbose = FALSE) - out2 <- test_predictions(m, c("groups", "var_binom"), engine = "emmeans") - expect_equal( - out1$Contrast[out1$groups == "c-c" & out1$var_binom == "0-1"], - out2$Contrast[out2$groups == "c-c" & out2$var_binom == "0-1"], - tolerance = 1e-2 - ) - - # # difference-in-difference - out1 <- test_predictions(m, c("groups", "var_binom"), test = "(b1 - b3) = (b2 - b4)", margin = "marginaleffects", verbose = FALSE) - out2 <- test_predictions(m, c("groups", "var_binom"), engine = "emmeans", test = "interaction") - expect_equal(out1$Contrast, out2$Contrast[1], tolerance = 1e-2) }) From e0edb3d3174b7220df383152429141fae41a04f2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:46:19 +0100 Subject: [PATCH 40/51] fix tests --- .../testthat/_snaps/test_predictions-mixed.md | 56 ++- tests/testthat/test-test_predictions-mixed.R | 7 +- tests/testthat/test-test_predictions.R | 370 ------------------ 3 files changed, 25 insertions(+), 408 deletions(-) delete mode 100644 tests/testthat/test-test_predictions.R diff --git a/tests/testthat/_snaps/test_predictions-mixed.md b/tests/testthat/_snaps/test_predictions-mixed.md index 033689ad..96b3dc77 100644 --- a/tests/testthat/_snaps/test_predictions-mixed.md +++ b/tests/testthat/_snaps/test_predictions-mixed.md @@ -3,40 +3,28 @@ Code print(test_predictions(fit, terms = c("e16sex", "c172code"))) Output - # Pairwise comparisons + Model-based Contrasts Analysis - e16sex | c172code | Contrast | 95% CI | p - ---------------------------------------------------------------- - male-male | low-medium | -0.16 | -0.38, 0.07 | 0.169 - male-male | low-high | -0.28 | -0.62, 0.06 | 0.107 - male-female | low-low | 0.08 | -0.16, 0.32 | 0.513 - male-female | low-medium | -0.29 | -0.51, -0.06 | 0.012 - male-female | low-high | -0.61 | -0.93, -0.30 | < .001 - male-male | medium-high | -0.12 | -0.44, 0.20 | 0.457 - male-female | medium-low | 0.24 | 0.01, 0.46 | 0.039 - male-female | medium-medium | -0.13 | -0.32, 0.07 | 0.199 - male-female | medium-high | -0.45 | -0.75, -0.16 | 0.002 - male-female | high-low | 0.36 | 0.02, 0.70 | 0.038 - male-female | high-medium | -0.01 | -0.32, 0.31 | 0.969 - male-female | high-high | -0.33 | -0.71, 0.04 | 0.083 - female-female | low-medium | -0.37 | -0.58, -0.16 | < .001 - female-female | low-high | -0.69 | -1.00, -0.38 | < .001 - female-female | medium-high | -0.33 | -0.58, -0.07 | 0.013 - Message + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------------------------- + male, medium | male, low | 0.25 | 0.18 | [-0.11, 0.61] | 1.37 | 0.169 + male, high | male, low | 0.45 | 0.28 | [-0.10, 0.99] | 1.61 | 0.107 + female, low | male, low | -0.13 | 0.20 | [-0.51, 0.26] | -0.65 | 0.513 + female, medium | male, low | 0.46 | 0.18 | [ 0.10, 0.81] | 2.51 | 0.012 + female, high | male, low | 0.98 | 0.26 | [ 0.47, 1.48] | 3.79 | < .001 + male, high | male, medium | 0.19 | 0.26 | [-0.32, 0.71] | 0.74 | 0.457 + female, low | male, medium | -0.38 | 0.18 | [-0.74, -0.02] | -2.06 | 0.039 + female, medium | male, medium | 0.20 | 0.16 | [-0.11, 0.52] | 1.28 | 0.199 + female, high | male, medium | 0.73 | 0.24 | [ 0.26, 1.19] | 3.06 | 0.002 + female, low | male, high | -0.57 | 0.28 | [-1.12, -0.03] | -2.07 | 0.038 + female, medium | male, high | 0.01 | 0.26 | [-0.49, 0.51] | 0.04 | 0.969 + female, high | male, high | 0.53 | 0.31 | [-0.07, 1.13] | 1.73 | 0.083 + female, medium | female, low | 0.58 | 0.17 | [ 0.25, 0.92] | 3.41 | < .001 + female, high | female, low | 1.11 | 0.25 | [ 0.61, 1.60] | 4.35 | < .001 + female, high | female, medium | 0.52 | 0.21 | [ 0.11, 0.93] | 2.48 | 0.013 - Contrasts are presented as counts. - ---- - - Code - print(test_predictions(fit, terms = c("e16sex", "c172code [medium]"))) - Output - # Pairwise comparisons - - e16sex | Contrast | 95% CI | p - -------------------------------------------- - male-female | -0.13 | -0.32, 0.07 | 0.199 - Message - - Contrasts are presented as counts. + Variable predicted: tot_sc_e + Predictors contrasted: e16sex, c172code + Predictors averaged: e17age (79), e15relat (1) + Contrasts are on the response-scale. diff --git a/tests/testthat/test-test_predictions-mixed.R b/tests/testthat/test-test_predictions-mixed.R index fb9e008e..d79812c9 100644 --- a/tests/testthat/test-test_predictions-mixed.R +++ b/tests/testthat/test-test_predictions-mixed.R @@ -14,13 +14,13 @@ test_that("test_predictions, mixed models", { family = poisson() )) out <- test_predictions(fit, terms = "e16sex") - expect_equal(out$Contrast, -0.04345908, tolerance = 1e-3) + expect_equal(out$Difference, 0.06156035, tolerance = 1e-3) out <- test_predictions(fit, terms = "e16sex", margin = "marginalmeans") - expect_equal(out$Contrast, -0.07125496, tolerance = 1e-3) + expect_equal(out$Difference, 0.07283665, tolerance = 1e-3) out <- test_predictions(fit, terms = "e16sex", margin = "empirical") - expect_equal(out$Contrast, -0.07659224, tolerance = 1e-3) + expect_equal(out$Difference, 0.07659224, tolerance = 1e-3) }) test_that("test_predictions, mixed models, print with conditioned values", { @@ -34,5 +34,4 @@ test_that("test_predictions, mixed models, print with conditioned values", { family = poisson() )) expect_snapshot(print(test_predictions(fit, terms = c("e16sex", "c172code")))) - expect_snapshot(print(test_predictions(fit, terms = c("e16sex", "c172code [medium]")))) }) diff --git a/tests/testthat/test-test_predictions.R b/tests/testthat/test-test_predictions.R deleted file mode 100644 index 63efdedd..00000000 --- a/tests/testthat/test-test_predictions.R +++ /dev/null @@ -1,370 +0,0 @@ -skip_on_os(c("mac", "solaris")) -skip_if_not_installed("marginaleffects") -skip_if_not_installed("ggplot2") -skip_if_not_installed("lme4") -skip_if_not_installed("nlme") - -set.seed(123) -n <- 200 -d <- data.frame( - outcome = rnorm(n), - groups = as.factor(sample(c("treatment", "control"), n, TRUE)), - episode = as.factor(sample.int(3, n, TRUE)), - ID = as.factor(rep(1:10, n / 10)), - sex = as.factor(sample(c("female", "male"), n, TRUE, prob = c(0.4, 0.6))) -) -model1 <- lm(outcome ~ groups * episode, data = d) - - -test_that("test_predictions, error", { - expect_error( - test_predictions(model1, c("groups", "episode"), engine = "ggeffects"), - regex = "Argument `engine` must be" - ) - pr <- predict_response(model1, c("groups", "episode")) - expect_silent(test_predictions(pr, engine = "ggeffects")) -}) - - -test_that("test_predictions, categorical, pairwise", { - out <- test_predictions(model1, c("groups", "episode")) - expect_named(out, c("groups", "episode", "Contrast", "conf.low", "conf.high", "p.value")) - expect_equal( - out$Contrast, - c( - 0.4183, -0.2036, -0.1482, 0.0709, 0.1211, -0.6219, -0.5666, - -0.3475, -0.2972, 0.0554, 0.2745, 0.3247, 0.2191, 0.2694, 0.0503 - ), - tolerance = 1e-3, - ignore_attr = FALSE - ) - expect_identical( - out$groups, - c( - "control-treatment", "control-control", "control-treatment", - "control-control", "control-treatment", "treatment-control", - "treatment-treatment", "treatment-control", "treatment-treatment", - "control-treatment", "control-control", "control-treatment", - "treatment-control", "treatment-treatment", "control-treatment" - ) - ) - expect_equal( - attributes(out)$standard_error, - c( - 0.23286, 0.21745, 0.23533, 0.22247, 0.21449, 0.23558, 0.25218, - 0.24022, 0.23286, 0.23803, 0.22532, 0.21745, 0.24262, 0.23533, - 0.22247 - ), - tolerance = 1e-3 - ) -}) - -test_that("test_predictions, categorical, pairwise, p_adjust", { - out1 <- test_predictions(model1, c("groups", "episode")) - out2 <- test_predictions(model1, c("groups", "episode"), p_adjust = "tukey") - expect_equal( - out1$p.value, - c( - 0.074, 0.3503, 0.5295, 0.7504, 0.5729, 0.009, 0.0258, 0.1497, - 0.2033, 0.8163, 0.2247, 0.137, 0.3676, 0.2538, 0.8215 - ), - tolerance = 1e-3, - ignore_attr = FALSE - ) - expect_equal( - out2$p.value, - c( - 0.4704, 0.9366, 0.9887, 0.9996, 0.9931, 0.0927, 0.2215, 0.6985, - 0.7976, 0.9999, 0.8276, 0.6689, 0.9453, 0.862, 0.9999 - ), - tolerance = 1e-3, - ignore_attr = FALSE - ) -}) - -test_that("test_predictions, categorical, NULL", { - out <- test_predictions(model1, c("groups", "episode"), test = NULL) - expect_named(out, c("groups", "episode", "Predicted", "conf.low", "conf.high", "p.value")) - expect_equal(out$Predicted, c(0.028, -0.3903, 0.2316, 0.1763, -0.0428, -0.0931), - tolerance = 1e-3, - ignore_attr = FALSE - ) - expect_identical( - out$groups, - structure(c(1L, 2L, 1L, 2L, 1L, 2L), levels = c("control", "treatment"), class = "factor") - ) - out <- test_predictions(model1, c("groups", "episode"), test = "slope") - expect_equal(out$Predicted, c(0.028, -0.3903, 0.2316, 0.1763, -0.0428, -0.0931), - tolerance = 1e-3, - ignore_attr = FALSE - ) -}) - - -test_that("test_predictions, interaction", { - data(iris) - model2 <- lm(Sepal.Width ~ Sepal.Length * Species, data = iris) - out <- test_predictions(model2, c("Sepal.Length", "Species")) - expect_named(out, c("Sepal.Length", "Species", "Contrast", "conf.low", "conf.high", "p.value")) - expect_equal(out$Contrast, c(0.4788, 0.5666, 0.0878), - tolerance = 1e-3, - ignore_attr = FALSE - ) - expect_identical(out$Sepal.Length, c("slope", "slope", "slope")) -}) - -test_that("test_predictions, by-argument", { - skip_if_not_installed("datawizard") - data(efc, package = "ggeffects") - efc$c161sex <- datawizard::to_factor(efc$c161sex) - efc$c172code <- datawizard::to_factor(efc$c172code) - - mfilter <- lm(neg_c_7 ~ c161sex * c172code + e42dep + c12hour, data = efc) - prfilter <- ggpredict(mfilter, "c172code") - - out <- test_predictions(prfilter, by = "c161sex") - expect_identical(nrow(out), 6L) - expect_identical( - out$c172code, - c( - "low level of education-intermediate level of education", - "low level of education-high level of education", - "intermediate level of education-high level of education", - "low level of education-intermediate level of education", - "low level of education-high level of education", - "intermediate level of education-high level of education" - ) - ) - expect_equal(out$p.value, c(0.3962, 0.6512, 0.7424, 0.9491, 0.0721, 0.0288), tolerance = 1e-3) - - out <- test_predictions(prfilter, by = "c161sex", p_adjust = "tukey") - expect_equal(out$p.value, c(0.6727, 0.8934, 0.9422, 0.9978, 0.1699, 0.0734), tolerance = 1e-3) - - prfilter <- ggpredict(mfilter, c("c172code", "c161sex")) - out <- test_predictions(prfilter, p_adjust = "tukey") - out <- out[out$c161sex %in% c("Male-Male", "Female-Female"), , drop = FALSE] - expect_equal(out$p.value, c(0.9581, 0.9976, 0.9995, 1, 0.4657, 0.2432), tolerance = 1e-3) - - expect_error(test_predictions(mfilter, "c161sex", by = "c12hour"), regex = "categorical") -}) - - -model3 <- suppressMessages(lme4::lmer(outcome ~ groups * episode + sex + (1 | ID), data = d)) - -test_that("test_predictions, categorical, pairwise", { - out <- test_predictions(model3, c("groups", "episode")) - expect_named(out, c("groups", "episode", "Contrast", "conf.low", "conf.high", "p.value")) - expect_equal( - out$Contrast, - c( - -0.20515, 0.06664, 0.41991, -0.15277, 0.11871, 0.27179, 0.62506, - 0.05238, 0.32386, 0.35326, -0.21941, 0.05207, -0.57267, -0.3012, - 0.27148 - ), - tolerance = 1e-3, - ignore_attr = FALSE - ) - expect_identical( - out$groups, - c( - "control-control", "control-control", "control-treatment", - "control-treatment", "control-treatment", "control-control", - "control-treatment", "control-treatment", "control-treatment", - "control-treatment", "control-treatment", "control-treatment", - "treatment-treatment", "treatment-treatment", "treatment-treatment" - ) - ) - expect_identical( - out$episode, - c( - "1-2", "1-3", "1-1", "1-2", "1-3", "2-3", "2-1", "2-2", "2-3", - "3-1", "3-2", "3-3", "1-2", "1-3", "2-3" - ) - ) -}) - -test_that("test_predictions, categorical, NULL", { - out <- test_predictions(model3, c("groups", "episode"), test = NULL) - out <- out[order(out$groups, out$episode), ] - expect_named(out, c("groups", "episode", "Predicted", "conf.low", "conf.high", "p.value")) - expect_equal(out$Predicted, c(0.0559, 0.2611, -0.0107, -0.364, 0.2087, -0.0628), - tolerance = 1e-3, - ignore_attr = FALSE - ) - expect_identical( - out$groups, - structure(c(1L, 1L, 1L, 2L, 2L, 2L), levels = c("control", "treatment"), class = "factor") - ) - expect_identical( - out$episode, - structure(c(1L, 2L, 3L, 1L, 2L, 3L), levels = c("1", "2", "3"), class = "factor") - ) -}) - - -d <- nlme::Orthodont -m <- lme4::lmer(distance ~ age * Sex + (1 | Subject), data = d) - -test_that("test_predictions, numeric, one focal, pairwise", { - out <- test_predictions(m, "age") - expect_named(out, c("age", "Slope", "conf.low", "conf.high", "p.value")) - expect_equal(out$Slope, 0.6602, tolerance = 1e-3, ignore_attr = FALSE) -}) - -test_that("test_predictions, numeric, one focal, NULL", { - out <- test_predictions(m, "age", test = NULL) - expect_named(out, c("age", "Slope", "conf.low", "conf.high", "p.value")) - expect_equal(out$Slope, 0.6602, tolerance = 1e-3, ignore_attr = FALSE) -}) - -test_that("test_predictions, categorical, one focal, pairwise", { - out <- test_predictions(m, "Sex") - expect_named(out, c("Sex", "Contrast", "conf.low", "conf.high", "p.value")) - expect_equal(out$Contrast, 2.321023, tolerance = 1e-3, ignore_attr = FALSE) -}) - -test_that("test_predictions, categorical, one focal, NULL", { - out <- test_predictions(m, "Sex", test = NULL) - expect_named(out, c("Sex", "Predicted", "conf.low", "conf.high", "p.value")) - expect_equal(out$Predicted, c(24.9688, 22.6477), tolerance = 1e-3, ignore_attr = FALSE) -}) - - -test_that("test_predictions, masked chars in levels", { - set.seed(123) - n <- 200 - d <- data.frame( - outcome = rnorm(n), - groups = as.factor(sample(c("ta-ca", "tb-cb"), n, TRUE)), - episode = as.factor(sample.int(3, n, TRUE)), - ID = as.factor(rep(1:10, n / 10)), - sex = as.factor(sample(c("1", "2"), n, TRUE, prob = c(0.4, 0.6))) - ) - model <- suppressMessages(lme4::lmer(outcome ~ groups * sex + episode + (1 | ID), data = d)) - out <- test_predictions(model, c("groups", "sex")) - expect_named(out, c("groups", "sex", "Contrast", "conf.low", "conf.high", "p.value")) - expect_equal( - out$Contrast, - c(-0.1854, -0.4473, -0.2076, -0.2619, -0.0222, 0.2397), - tolerance = 1e-3, - ignore_attr = FALSE - ) - expect_identical( - out$groups, - c( - "ta-ca-ta-ca", "ta-ca-tb-cb", "ta-ca-tb-cb", "ta-ca-tb-cb", - "ta-ca-tb-cb", "tb-cb-tb-cb" - ) - ) - # ggeffects can be passed directly when model is named "model" - pr <- predict_response(model, c("groups", "sex")) - expect_silent(test_predictions(pr)) -}) - -test_that("test_predictions, don't drop single columns", { - data(iris) - iris$Sepal.Width.factor <- factor(as.numeric(iris$Sepal.Width >= 3)) - m <- lme4::lmer(Petal.Length ~ Petal.Width * Sepal.Width.factor + (1 | Species), data = iris) - expect_s3_class( - test_predictions(m, c("Sepal.Width.factor", "Petal.Width [0.5]")), - "ggcomparisons" - ) -}) - -test_that("test_predictions, make sure random effects group is categorical", { - data(sleepstudy, package = "lme4") - set.seed(123) - sleepstudy$grp <- as.factor(sample(letters[1:3], nrow(sleepstudy), replace = TRUE)) - sleepstudy$ID <- as.numeric(sleepstudy$Subject) - m <- lme4::lmer(Reaction ~ Days + (1 | ID), sleepstudy) - out <- test_predictions(ggpredict(m, "Days")) - expect_equal(out$Slope, 10.467285959584, tolerance = 1e-4) - - m <- lme4::lmer(Reaction ~ Days * grp + (1 | ID), sleepstudy) - out <- test_predictions(ggpredict(m, c("Days", "grp"))) - expect_equal(out$Contrast, c(-0.0813, -1.26533, -1.18403), tolerance = 1e-4) -}) - - -test_that("test_predictions, works with glmmTMB and w/o vcov", { - skip_if_not_installed("glmmTMB") - skip_if_not_installed("datawizard") - data(efc, package = "ggeffects") - efc <- datawizard::to_factor(efc, select = c("c161sex", "c172code", "c175empl")) - efc <- datawizard::recode_values( - efc, - select = "c160age", - recode = list(`1` = "min:40", `2` = 41:64, `3` = "65:max") - ) - efc <- datawizard::data_rename( - efc, - select = c("c161sex", "c160age", "quol_5", "c175empl"), - replacement = c("gender", "age", "qol", "employed") - ) - efc <- datawizard::data_modify(efc, age = factor(age, labels = c("-40", "41-64", "65+"))) - m_null <- glmmTMB::glmmTMB(qol ~ 1 + (1 | gender:employed:age), data = efc) - predictions <- ggpredict(m_null, c("gender", "employed", "age"), type = "random", ci_level = NA) - out1 <- test_predictions(predictions, verbose = FALSE)[1:5, ] - out2 <- test_predictions(predictions, vcov = TRUE, verbose = FALSE)[1:5, ] - expect_equal(out1$conf.low, out2$conf.low, tolerance = 1e-4) - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-4) - # validate against raw values - expect_equal(out1$Contrast, c(0.30375, 0.82708, -0.87857, -0.22756, -0.10064), tolerance = 1e-4) - expect_equal(out1$conf.low, c(0.30375, 0.82708, -0.87857, -0.22756, NA), tolerance = 1e-4) -}) - - -test_that("test_predictions, correct order of character vectors", { - skip_if_not_installed("marginaleffects", minimum_version = "0.20.0") - skip_if_not_installed("datawizard") - - set.seed(1234) - dat <- data.frame( - outcome = rbinom(n = 100, size = 1, prob = 0.35), - var_binom = as.factor(rbinom(n = 100, size = 1, prob = 0.3)), - var_cont = rnorm(n = 100, mean = 10, sd = 7), - groups = sample(letters[1:2], size = 100, replace = TRUE) - ) - m1 <- glm(outcome ~ var_binom * groups + var_cont, data = dat, family = binomial()) - pr1 <- predict_response(m1, c("var_binom", "groups"), verbose = FALSE) - out1 <- test_predictions(pr1, engine = "ggeffects") - out2 <- test_predictions(pr1) - out2 <- datawizard::data_arrange(out2, c("var_binom", "groups")) - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-4) - expect_equal( - as.data.frame(out1)[c("var_binom", "groups")], - as.data.frame(out2)[c("var_binom", "groups")], - ignore_attr = TRUE - ) -}) - - -test_that("test_predictions, zero-inflated models", { - skip_if_not_installed("glmmTMB") - data(Salamanders, package = "glmmTMB") - m1 <- glmmTMB::glmmTMB(count ~ mined + (1 | site), - ziformula = ~mined, - family = poisson, data = Salamanders - ) - pr1 <- predict_response(m1, "mined", margin = "empirical") - out1 <- test_predictions(pr1) - out2 <- test_predictions(m1, "mined", scale = "conditional") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-4) - - pr1 <- predict_response(m1, "mined", type = "zero_inflated", margin = "empirical") - out1 <- test_predictions(pr1) - out2 <- test_predictions(m1, "mined", scale = "response") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-4) - - pr1 <- predict_response(m1, "mined", type = "zi_prob") - out1 <- test_predictions(pr1) - out2 <- test_predictions(m1, "mined", scale = "zprob") - expect_equal(out1$Contrast, out2$Contrast, tolerance = 1e-4) - - # validate against emmeans - skip_if_not_installed("emmeans") - emm <- emmeans::emmeans(m1, "mined", regrid = "response", component = "zi") - out3 <- as.data.frame(confint(emmeans::contrast(emm, method = "pairwise"))) - expect_equal(attributes(out1)$standard_error, out3$SE, tolerance = 1e-1) - expect_equal(out1$conf.low, out3$asymp.LCL, tolerance = 1e-2) -}) From a2efa8c318b5b344f8b982f9053eb56a617a472d Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:47:34 +0100 Subject: [PATCH 41/51] Update test_predictions-margin.md --- .../_snaps/test_predictions-margin.md | 302 +++++++++--------- 1 file changed, 145 insertions(+), 157 deletions(-) diff --git a/tests/testthat/_snaps/test_predictions-margin.md b/tests/testthat/_snaps/test_predictions-margin.md index 8476d0d3..be427255 100644 --- a/tests/testthat/_snaps/test_predictions-margin.md +++ b/tests/testthat/_snaps/test_predictions-margin.md @@ -3,19 +3,21 @@ Code print(test_predictions(m, c("parfam [green, lib]", "year [1980, 2020]"))) Output - # Pairwise comparisons - - parfam | year | Contrast | 95% CI | p - -------------------------------------------------------- - green-lib | 1980-1980 | 0.18 | -0.66, 1.02 | 0.680 - green-green | 1980-2020 | -0.16 | -0.97, 0.66 | 0.704 - green-lib | 1980-2020 | 0.26 | -0.41, 0.93 | 0.444 - lib-green | 1980-2020 | -0.33 | -1.00, 0.33 | 0.325 - lib-lib | 1980-2020 | 0.08 | -0.56, 0.73 | 0.799 - green-lib | 2020-2020 | 0.42 | 0.00, 0.83 | 0.049 - Message - - Contrasts are presented as probabilities (in %-points). + Model-based Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------------------ + green, 2020 | green, 1980 | 0.16 | 0.42 | [-0.66, 0.97] | 0.38 | 0.704 + lib, 1980 | green, 1980 | -0.18 | 0.43 | [-1.02, 0.66] | -0.41 | 0.680 + lib, 2020 | green, 1980 | -0.26 | 0.34 | [-0.93, 0.41] | -0.77 | 0.444 + lib, 1980 | green, 2020 | -0.33 | 0.34 | [-1.00, 0.33] | -0.98 | 0.325 + lib, 2020 | green, 2020 | -0.42 | 0.21 | [-0.83, 0.00] | -1.97 | 0.049 + lib, 2020 | lib, 1980 | -0.08 | 0.33 | [-0.73, 0.56] | -0.25 | 0.799 + + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib'), year=c(1980,2020) + Predictors averaged: countryname + Contrasts are on the response-scale. --- @@ -23,19 +25,21 @@ print(test_predictions(m, c("parfam [green, lib]", "year [1980, 2020]"), margin = "marginalmeans")) Output - # Pairwise comparisons - - parfam | year | Contrast | 95% CI | p - -------------------------------------------------------- - green-green | 1980-2020 | -0.12 | -0.74, 0.51 | 0.708 - green-lib | 1980-1980 | 0.14 | -0.54, 0.82 | 0.682 - green-lib | 1980-2020 | 0.22 | -0.28, 0.72 | 0.394 - green-lib | 2020-1980 | 0.26 | -0.30, 0.83 | 0.365 - green-lib | 2020-2020 | 0.34 | 0.02, 0.65 | 0.036 - lib-lib | 1980-2020 | 0.08 | -0.48, 0.63 | 0.791 - Message - - Contrasts are presented as probabilities (in %-points). + Marginal Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------------------ + green, 2020 | green, 1980 | 0.12 | 0.32 | [-0.51, 0.74] | 0.37 | 0.708 + lib, 1980 | green, 1980 | -0.14 | 0.35 | [-0.82, 0.54] | -0.41 | 0.682 + lib, 2020 | green, 1980 | -0.22 | 0.26 | [-0.72, 0.28] | -0.85 | 0.394 + lib, 1980 | green, 2020 | -0.26 | 0.29 | [-0.83, 0.30] | -0.91 | 0.365 + lib, 2020 | green, 2020 | -0.34 | 0.16 | [-0.65, -0.02] | -2.09 | 0.036 + lib, 2020 | lib, 1980 | -0.08 | 0.29 | [-0.63, 0.48] | -0.27 | 0.791 + + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib'), year=c(1980,2020) + Predictors averaged: countryname + Contrasts are on the response-scale. --- @@ -43,145 +47,117 @@ print(test_predictions(m, c("parfam [green, lib]", "year [1980, 2020]"), margin = "empirical")) Output - # Pairwise comparisons - - parfam | year | Contrast | 95% CI | p - -------------------------------------------------------- - green-green | 1980-2020 | -0.12 | -0.73, 0.50 | 0.709 - green-lib | 1980-1980 | 0.14 | -0.53, 0.81 | 0.682 - green-lib | 1980-2020 | 0.21 | -0.28, 0.71 | 0.392 - green-lib | 2020-1980 | 0.26 | -0.30, 0.81 | 0.367 - green-lib | 2020-2020 | 0.33 | 0.02, 0.64 | 0.037 - lib-lib | 1980-2020 | 0.07 | -0.48, 0.63 | 0.791 - Message - - Contrasts are presented as probabilities (in %-points). + Marginal Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ------------------------------------------------------------------------------ + green, 2020 | green, 1980 | 0.12 | 0.31 | [-0.50, 0.73] | 0.37 | 0.709 + lib, 1980 | green, 1980 | -0.14 | 0.34 | [-0.81, 0.53] | -0.41 | 0.682 + lib, 2020 | green, 1980 | -0.21 | 0.25 | [-0.71, 0.28] | -0.86 | 0.392 + lib, 1980 | green, 2020 | -0.26 | 0.28 | [-0.81, 0.30] | -0.90 | 0.367 + lib, 2020 | green, 2020 | -0.33 | 0.16 | [-0.64, -0.02] | -2.09 | 0.037 + lib, 2020 | lib, 1980 | -0.07 | 0.28 | [-0.63, 0.48] | -0.27 | 0.791 + + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib'), year=c(1980,2020) + Predictors averaged: countryname + Contrasts are on the response-scale. --- Code print(test_predictions(m, c("parfam [green, lib]", "year [1980]"))) Output - # Pairwise comparisons + Model-based Contrasts Analysis - parfam | year | Contrast | 95% CI | p - ------------------------------------------------------ - green-lib | 1980-1980 | 0.18 | -0.66, 1.02 | 0.680 - Message + Parameter | Difference | SE | 95% CI | z | p + --------------------------------------------------------------- + lib - green | -0.18 | 0.43 | [-1.02, 0.66] | -0.41 | 0.680 - Contrasts are presented as probabilities (in %-points). + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib'), year=c(1980) + Predictors averaged: countryname + Contrasts are on the response-scale. --- Code print(test_predictions(m, c("parfam [green, lib]", "year [1980]"), margin = "marginalmeans")) Output - # Pairwise comparisons + Marginal Contrasts Analysis - parfam | Contrast | 95% CI | p - ------------------------------------------ - green-lib | 0.14 | -0.54, 0.82 | 0.682 - Message + Parameter | Difference | SE | 95% CI | z | p + --------------------------------------------------------------- + lib - green | -0.14 | 0.35 | [-0.82, 0.54] | -0.41 | 0.682 - Contrasts are presented as probabilities (in %-points). + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib'), year=c(1980) + Predictors averaged: countryname + Contrasts are on the response-scale. --- Code print(test_predictions(m, c("parfam [green, lib]", "year [1980]"), margin = "empirical")) Output - # Pairwise comparisons + Marginal Contrasts Analysis - parfam | Contrast | 95% CI | p - ------------------------------------------ - green-lib | 0.14 | -0.53, 0.81 | 0.682 - Message + Parameter | Difference | SE | 95% CI | z | p + --------------------------------------------------------------- + lib - green | -0.14 | 0.34 | [-0.81, 0.53] | -0.41 | 0.682 - Contrasts are presented as probabilities (in %-points). + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib'), year=c(1980) + Predictors averaged: countryname + Contrasts are on the response-scale. --- Code print(test_predictions(m, c("parfam [green, lib]", "year"))) Output - # Pairwise comparisons + Model-based Contrasts Analysis - parfam | year | Contrast | 95% CI | p - ------------------------------------------------------------- - green-lib | 1996.1-1996.1 | 0.28 | -0.19, 0.74 | 0.244 - green-green | 1996.1-2007.2 | -0.04 | -0.28, 0.19 | 0.710 - green-lib | 1996.1-2007.2 | 0.30 | -0.13, 0.73 | 0.167 - green-green | 1996.1-2018.3 | -0.09 | -0.56, 0.39 | 0.713 - green-lib | 1996.1-2018.3 | 0.32 | -0.12, 0.76 | 0.151 - lib-green | 1996.1-2007.2 | -0.32 | -0.70, 0.06 | 0.099 - lib-lib | 1996.1-2007.2 | 0.02 | -0.15, 0.19 | 0.793 - lib-green | 1996.1-2018.3 | -0.37 | -0.80, 0.06 | 0.094 - lib-lib | 1996.1-2018.3 | 0.04 | -0.25, 0.33 | 0.780 - green-lib | 2007.2-2007.2 | 0.34 | 0.01, 0.68 | 0.041 - green-green | 2007.2-2018.3 | -0.04 | -0.29, 0.20 | 0.715 - green-lib | 2007.2-2018.3 | 0.36 | 0.02, 0.71 | 0.038 - lib-green | 2007.2-2018.3 | -0.39 | -0.77, -0.01 | 0.046 - lib-lib | 2007.2-2018.3 | 0.02 | -0.10, 0.14 | 0.761 - green-lib | 2018.3-2018.3 | 0.41 | 0.02, 0.80 | 0.041 - Message + Level1 | Level2 | Difference | SE | 95% CI | z | p + -------------------------------------------------------------------- + lib | green | -0.34 | 0.17 | [-0.68, -0.01] | -2.04 | 0.041 - Contrasts are presented as probabilities (in %-points). + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib') + Predictors averaged: year (2e+03), countryname + Contrasts are on the response-scale. --- Code print(test_predictions(m, c("parfam [green, lib]", "year"), margin = "marginalmeans")) Output - # Pairwise comparisons + Marginal Contrasts Analysis - parfam | year | Contrast | 95% CI | p - ------------------------------------------------------------ - green-green | 1996.1-2007.2 | -0.03 | -0.21, 0.14 | 0.712 - green-green | 1996.1-2018.3 | -0.07 | -0.43, 0.29 | 0.715 - green-lib | 1996.1-1996.1 | 0.22 | -0.14, 0.59 | 0.231 - green-lib | 1996.1-2007.2 | 0.24 | -0.07, 0.56 | 0.128 - green-lib | 1996.1-2018.3 | 0.26 | -0.06, 0.58 | 0.106 - green-green | 2007.2-2018.3 | -0.03 | -0.22, 0.15 | 0.718 - green-lib | 2007.2-1996.1 | 0.26 | -0.05, 0.57 | 0.105 - green-lib | 2007.2-2007.2 | 0.28 | 0.03, 0.52 | 0.027 - green-lib | 2007.2-2018.3 | 0.30 | 0.05, 0.54 | 0.020 - green-lib | 2018.3-1996.1 | 0.29 | -0.06, 0.64 | 0.104 - green-lib | 2018.3-2007.2 | 0.31 | 0.02, 0.60 | 0.038 - green-lib | 2018.3-2018.3 | 0.33 | 0.03, 0.62 | 0.029 - lib-lib | 1996.1-2007.2 | 0.02 | -0.13, 0.17 | 0.787 - lib-lib | 1996.1-2018.3 | 0.04 | -0.23, 0.30 | 0.775 - lib-lib | 2007.2-2018.3 | 0.02 | -0.10, 0.13 | 0.759 - Message + Level1 | Level2 | Difference | SE | 95% CI | z | p + -------------------------------------------------------------------- + lib | green | -0.28 | 0.13 | [-0.52, -0.03] | -2.21 | 0.027 - Contrasts are presented as probabilities (in %-points). + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib') + Predictors averaged: year (2e+03), countryname + Contrasts are on the response-scale. --- Code print(test_predictions(m, c("parfam [green, lib]", "year"), margin = "empirical")) Output - # Pairwise comparisons + Marginal Contrasts Analysis - parfam | year | Contrast | 95% CI | p - ------------------------------------------------------------ - green-green | 1996.1-2007.2 | -0.03 | -0.21, 0.14 | 0.712 - green-green | 1996.1-2018.3 | -0.07 | -0.42, 0.29 | 0.715 - green-lib | 1996.1-1996.1 | 0.22 | -0.14, 0.58 | 0.231 - green-lib | 1996.1-2007.2 | 0.24 | -0.07, 0.55 | 0.127 - green-lib | 1996.1-2018.3 | 0.26 | -0.05, 0.57 | 0.105 - green-green | 2007.2-2018.3 | -0.03 | -0.21, 0.15 | 0.718 - green-lib | 2007.2-1996.1 | 0.25 | -0.05, 0.56 | 0.106 - green-lib | 2007.2-2007.2 | 0.27 | 0.03, 0.51 | 0.027 - green-lib | 2007.2-2018.3 | 0.29 | 0.05, 0.54 | 0.020 - green-lib | 2018.3-1996.1 | 0.29 | -0.06, 0.63 | 0.105 - green-lib | 2018.3-2007.2 | 0.31 | 0.02, 0.60 | 0.038 - green-lib | 2018.3-2018.3 | 0.32 | 0.03, 0.62 | 0.029 - lib-lib | 1996.1-2007.2 | 0.02 | -0.13, 0.17 | 0.787 - lib-lib | 1996.1-2018.3 | 0.04 | -0.22, 0.30 | 0.775 - lib-lib | 2007.2-2018.3 | 0.02 | -0.10, 0.13 | 0.759 - Message + Level1 | Level2 | Difference | SE | 95% CI | z | p + -------------------------------------------------------------------- + lib | green | -0.28 | 0.12 | [-0.51, -0.04] | -2.28 | 0.023 - Contrasts are presented as probabilities (in %-points). + Variable predicted: childcare + Predictors contrasted: parfam=c('green','lib') + Predictors averaged: year (2e+03), countryname + Contrasts are on the response-scale. --- @@ -189,15 +165,19 @@ suppressWarnings(print(test_predictions(m, c("parfam", "countryname"), margin = "marginalmeans", test = "b19 = b26"))) Output - Hypothesis | Contrast | 95% CI | p - ------------------------------------------- - b19=b26 | -0.37 | -1.01, 0.27 | 0.262 + Marginal Contrasts Analysis - Tested hypothesis: parfam[green],countryname[Austria] = - parfam[left],countryname[Belgium] - Message + Parameter | Difference | SE | 95% CI | z | p + ------------------------------------------------------------ + b19=b26 | 0.34 | 0.28 | [-0.20, 0.89] | 1.24 | 0.216 - Contrasts are presented as probabilities (in %-points). + Variable predicted: childcare + Predictors contrasted: parfam, countryname + Predictors averaged: year (2e+03) + Contrasts are on the response-scale. + Parameters: + b19 = parfam [con], countryname [Finland] + b26 = parfam [cd], countryname [France] --- @@ -205,19 +185,21 @@ suppressWarnings(print(test_predictions(m, c("parfam [green, left]", "countryname [Austria, Belgium]"), margin = "marginalmeans"))) Output - # Pairwise comparisons - - parfam | countryname | Contrast | 95% CI | p - -------------------------------------------------------------- - green-green | Austria-Belgium | -0.45 | -1.10, 0.20 | 0.173 - green-left | Austria-Austria | -0.17 | -0.91, 0.56 | 0.648 - green-left | Austria-Belgium | -0.37 | -1.01, 0.27 | 0.262 - green-left | Belgium-Austria | 0.28 | -0.32, 0.88 | 0.362 - green-left | Belgium-Belgium | 0.09 | -0.40, 0.57 | 0.730 - left-left | Austria-Belgium | -0.20 | -0.79, 0.40 | 0.519 - Message - - Contrasts are presented as probabilities (in %-points). + Marginal Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------------- + green, Belgium | green, Austria | 0.45 | 0.33 | [-0.20, 1.10] | 1.35 | 0.176 + left, Austria | green, Austria | 0.17 | 0.38 | [-0.57, 0.91] | 0.46 | 0.648 + left, Belgium | green, Austria | 0.37 | 0.33 | [-0.28, 1.01] | 1.11 | 0.266 + left, Austria | green, Belgium | -0.28 | 0.31 | [-0.87, 0.32] | -0.91 | 0.364 + left, Belgium | green, Belgium | -0.08 | 0.24 | [-0.56, 0.39] | -0.35 | 0.730 + left, Belgium | left, Austria | 0.19 | 0.30 | [-0.40, 0.78] | 0.64 | 0.521 + + Variable predicted: childcare + Predictors contrasted: parfam=c('green','left'), countryname=c('Austria','Belgium') + Predictors averaged: year (2e+03) + Contrasts are on the response-scale. --- @@ -225,15 +207,19 @@ suppressWarnings(print(test_predictions(m, c("parfam", "countryname"), margin = "empirical", test = "b19 = b26"))) Output - Hypothesis | Contrast | 95% CI | p - ------------------------------------------- - b19=b26 | -0.37 | -1.01, 0.27 | 0.262 + Marginal Contrasts Analysis - Tested hypothesis: parfam[green],countryname[Austria] = - parfam[left],countryname[Belgium] - Message + Parameter | Difference | SE | 95% CI | z | p + ------------------------------------------------------------ + b19=b26 | 0.35 | 0.27 | [-0.19, 0.88] | 1.26 | 0.208 - Contrasts are presented as probabilities (in %-points). + Variable predicted: childcare + Predictors contrasted: parfam, countryname + Predictors averaged: year (2e+03) + Contrasts are on the response-scale. + Parameters: + b19 = parfam [con], countryname [Finland] + b26 = parfam [cd], countryname [France] --- @@ -241,17 +227,19 @@ suppressWarnings(print(test_predictions(m, c("parfam [green, left]", "countryname [Austria, Belgium]"), margin = "empirical"))) Output - # Pairwise comparisons - - parfam | countryname | Contrast | 95% CI | p - -------------------------------------------------------------- - green-green | Austria-Belgium | -0.45 | -1.10, 0.20 | 0.173 - green-left | Austria-Austria | -0.17 | -0.91, 0.56 | 0.648 - green-left | Austria-Belgium | -0.37 | -1.01, 0.27 | 0.262 - green-left | Belgium-Austria | 0.28 | -0.32, 0.88 | 0.362 - green-left | Belgium-Belgium | 0.09 | -0.40, 0.57 | 0.730 - left-left | Austria-Belgium | -0.20 | -0.79, 0.40 | 0.519 - Message - - Contrasts are presented as probabilities (in %-points). + Marginal Contrasts Analysis + + Level1 | Level2 | Difference | SE | 95% CI | z | p + ----------------------------------------------------------------------------------- + green, Belgium | green, Austria | 0.44 | 0.33 | [-0.20, 1.09] | 1.35 | 0.178 + left, Austria | green, Austria | 0.17 | 0.37 | [-0.56, 0.90] | 0.46 | 0.648 + left, Belgium | green, Austria | 0.36 | 0.33 | [-0.28, 1.00] | 1.11 | 0.268 + left, Austria | green, Belgium | -0.27 | 0.30 | [-0.87, 0.32] | -0.91 | 0.364 + left, Belgium | green, Belgium | -0.08 | 0.24 | [-0.56, 0.39] | -0.35 | 0.730 + left, Belgium | left, Austria | 0.19 | 0.30 | [-0.39, 0.78] | 0.64 | 0.521 + + Variable predicted: childcare + Predictors contrasted: parfam=c('green','left'), countryname=c('Austria','Belgium') + Predictors averaged: year (2e+03) + Contrasts are on the response-scale. From 2c89ec280f90338e4520039f5c3768b96906b699 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:48:36 +0100 Subject: [PATCH 42/51] Update test_predictions_ggeffects.md --- .../_snaps/test_predictions_ggeffects.md | 364 ++++++++++-------- 1 file changed, 198 insertions(+), 166 deletions(-) diff --git a/tests/testthat/_snaps/test_predictions_ggeffects.md b/tests/testthat/_snaps/test_predictions_ggeffects.md index 15760cd9..7b13bbf1 100644 --- a/tests/testthat/_snaps/test_predictions_ggeffects.md +++ b/tests/testthat/_snaps/test_predictions_ggeffects.md @@ -3,206 +3,238 @@ Code print(out1) Output - # Pairwise comparisons - - x1 | x2 | Contrast | 95% CI | p - ------------------------------------------------------------------ - 1. Generation-1. Generation | 1-2 | 0.81 | 0.26, 1.36 | 0.005 - 1. Generation-2nd Gen | 1-1 | 0.37 | -0.15, 0.89 | 0.164 - 1. Generation-2nd Gen | 1-2 | 0.84 | 0.29, 1.39 | 0.003 - 1. Generation-2nd Gen | 2-2 | 0.03 | -0.60, 0.67 | 0.921 - 1. Generation-Gen. 3. | 1-1 | 0.19 | -0.35, 0.73 | 0.481 - 1. Generation-Gen. 3. | 1-2 | 0.39 | -0.34, 1.12 | 0.293 - 1. Generation-Gen. 3. | 2-2 | -0.42 | -1.21, 0.38 | 0.298 - 2nd Gen-1. Generation | 1-2 | 0.44 | -0.17, 1.05 | 0.153 - 2nd Gen-2nd Gen | 1-2 | 0.47 | -0.13, 1.08 | 0.126 - 2nd Gen-Gen. 3. | 1-1 | -0.17 | -0.77, 0.42 | 0.562 - 2nd Gen-Gen. 3. | 1-2 | 0.02 | -0.75, 0.79 | 0.956 - 2nd Gen-Gen. 3. | 2-2 | -0.45 | -1.25, 0.34 | 0.263 - Gen. 3.-1. Generation | 1-2 | 0.62 | -0.01, 1.24 | 0.053 - Gen. 3.-2nd Gen | 1-2 | 0.65 | 0.02, 1.27 | 0.042 - Gen. 3.-Gen. 3. | 1-2 | 0.20 | -0.59, 0.98 | 0.621 + x1 x2 Contrast conf.low conf.high + 1 1. Generation-1. Generation 1-2 0.80811389 0.256116187 1.3601116 + 2 1. Generation-2nd Gen 1-1 0.36751601 -0.153281898 0.8883139 + 3 1. Generation-2nd Gen 1-2 0.83966736 0.287669664 1.3916651 + 4 1. Generation-2nd Gen 2-2 0.03155348 -0.602206670 0.6653136 + 5 1. Generation-Gen. 3. 1-1 0.19281288 -0.347695989 0.7333217 + 6 1. Generation-Gen. 3. 1-2 0.38906731 -0.341834083 1.1199687 + 7 1. Generation-Gen. 3. 2-2 -0.41904658 -1.213506965 0.3754138 + 8 2nd Gen-1. Generation 1-2 0.44059787 -0.166181273 1.0473770 + 9 2nd Gen-2nd Gen 1-2 0.47215135 -0.134627796 1.0789305 + 10 2nd Gen-Gen. 3. 1-1 -0.17470314 -0.771049769 0.4216435 + 11 2nd Gen-Gen. 3. 1-2 0.02155129 -0.751556922 0.7946595 + 12 2nd Gen-Gen. 3. 2-2 -0.45060005 -1.245060442 0.3438603 + 13 Gen. 3.-1. Generation 1-2 0.61530101 -0.008478042 1.2390801 + 14 Gen. 3.-2nd Gen 1-2 0.64685448 0.023075435 1.2706335 + 15 Gen. 3.-Gen. 3. 1-2 0.19625443 -0.590266826 0.9827757 + p.value + 1 0.004554708 + 2 0.164464586 + 3 0.003252247 + 4 0.921464142 + 5 0.480520805 + 6 0.293258076 + 7 0.297653386 + 8 0.152699267 + 9 0.125708853 + 10 0.562181073 + 11 0.955978069 + 12 0.262971361 + 13 0.053131084 + 14 0.042263004 + 15 0.621451470 --- Code print(out1) Output - # Pairwise comparisons - - x2 = 1 - - x1 | Contrast | 95% CI | p - ------------------------------------------------------ - 1. Generation-2nd Gen | 0.37 | -0.15, 0.89 | 0.164 - 1. Generation-Gen. 3. | 0.19 | -0.35, 0.73 | 0.481 - 2nd Gen-Gen. 3. | -0.17 | -0.77, 0.42 | 0.562 - - x2 = 2 - - x1 | Contrast | 95% CI | p - ------------------------------------------------------ - 1. Generation-2nd Gen | 0.03 | -0.60, 0.67 | 0.921 - 1. Generation-Gen. 3. | -0.42 | -1.21, 0.38 | 0.298 - 2nd Gen-Gen. 3. | -0.45 | -1.25, 0.34 | 0.263 + x1 x2 Contrast conf.low conf.high p.value + 1 1. Generation-2nd Gen 1 0.36751601 -0.1532819 0.8883139 0.1644646 + 2 1. Generation-Gen. 3. 1 0.19281288 -0.3476960 0.7333217 0.4805208 + 3 2nd Gen-Gen. 3. 1 -0.17470314 -0.7710498 0.4216435 0.5621811 + 10 1. Generation-2nd Gen 2 0.03155348 -0.6022067 0.6653136 0.9214641 + 14 1. Generation-Gen. 3. 2 -0.41904658 -1.2135070 0.3754138 0.2976534 + 15 2nd Gen-Gen. 3. 2 -0.45060005 -1.2450604 0.3438603 0.2629714 --- Code print(out1) Output - # Pairwise comparisons - - x1 | x2 | x3 | Contrast | 95% CI | p - ------------------------------------------------------------------------- - 1. Generation-1. Generation | 1-1 | a-b | 0.04 | -0.65, 0.74 | 0.903 - 1. Generation-1. Generation | 1-2 | a-a | 0.78 | -0.27, 1.83 | 0.144 - 1. Generation-1. Generation | 1-2 | a-b | 0.86 | 0.08, 1.63 | 0.031 - 1. Generation-1. Generation | 1-2 | b-b | 0.81 | 0.14, 1.49 | 0.019 - 1. Generation-1. Generation | 2-1 | a-b | -0.74 | -1.72, 0.24 | 0.137 - 1. Generation-1. Generation | 2-2 | a-b | 0.07 | -0.96, 1.11 | 0.887 - 1. Generation-2nd Gen | 1-1 | a-a | 0.37 | -0.81, 1.54 | 0.537 - 1. Generation-2nd Gen | 1-1 | a-b | 0.40 | -0.32, 1.13 | 0.275 - 1. Generation-2nd Gen | 1-1 | b-b | 0.36 | -0.26, 0.97 | 0.249 - 1. Generation-2nd Gen | 1-2 | a-a | 0.90 | -0.02, 1.82 | 0.055 - 1. Generation-2nd Gen | 1-2 | a-b | 0.85 | 0.03, 1.66 | 0.042 - 1. Generation-2nd Gen | 1-2 | b-b | 0.80 | 0.08, 1.52 | 0.029 - 1. Generation-2nd Gen | 2-1 | a-b | -0.38 | -1.38, 0.62 | 0.453 - 1. Generation-2nd Gen | 2-2 | a-a | 0.12 | -1.03, 1.27 | 0.840 - 1. Generation-2nd Gen | 2-2 | a-b | 0.07 | -1.00, 1.13 | 0.904 - 1. Generation-2nd Gen | 2-2 | b-b | -0.01 | -0.81, 0.79 | 0.982 - 1. Generation-Gen. 3. | 1-1 | a-a | 0.63 | -0.34, 1.61 | 0.202 - 1. Generation-Gen. 3. | 1-1 | a-b | 0.03 | -0.74, 0.81 | 0.930 - 1. Generation-Gen. 3. | 1-1 | b-b | -0.01 | -0.68, 0.67 | 0.981 - 1. Generation-Gen. 3. | 1-2 | a-a | 0.36 | -1.51, 2.23 | 0.702 - 1. Generation-Gen. 3. | 1-2 | a-b | 0.43 | -0.49, 1.35 | 0.359 - 1. Generation-Gen. 3. | 1-2 | b-b | 0.38 | -0.45, 1.22 | 0.363 - 1. Generation-Gen. 3. | 2-1 | a-b | -0.75 | -1.79, 0.29 | 0.156 - 1. Generation-Gen. 3. | 2-2 | a-a | -0.42 | -2.41, 1.57 | 0.675 - 1. Generation-Gen. 3. | 2-2 | a-b | -0.36 | -1.50, 0.79 | 0.540 - 1. Generation-Gen. 3. | 2-2 | b-b | -0.43 | -1.33, 0.47 | 0.347 - 2nd Gen-1. Generation | 1-1 | a-b | -0.32 | -1.43, 0.78 | 0.563 - 2nd Gen-1. Generation | 1-2 | a-a | 0.42 | -0.94, 1.78 | 0.545 - 2nd Gen-1. Generation | 1-2 | a-b | 0.49 | -0.67, 1.65 | 0.403 - 2nd Gen-1. Generation | 1-2 | b-b | 0.45 | -0.25, 1.16 | 0.204 - 2nd Gen-1. Generation | 2-1 | a-b | -0.86 | -1.69, -0.02 | 0.044 - 2nd Gen-1. Generation | 2-2 | a-b | -0.04 | -0.95, 0.86 | 0.925 - 2nd Gen-2nd Gen | 1-1 | a-b | 0.04 | -1.09, 1.16 | 0.950 - 2nd Gen-2nd Gen | 1-2 | a-a | 0.53 | -0.73, 1.79 | 0.402 - 2nd Gen-2nd Gen | 1-2 | a-b | 0.48 | -0.71, 1.67 | 0.422 - 2nd Gen-2nd Gen | 1-2 | b-b | 0.45 | -0.30, 1.20 | 0.241 - 2nd Gen-2nd Gen | 2-1 | a-b | -0.50 | -1.36, 0.36 | 0.253 - 2nd Gen-2nd Gen | 2-2 | a-b | -0.05 | -0.99, 0.89 | 0.913 - 2nd Gen-Gen. 3. | 1-1 | a-a | 0.27 | -1.03, 1.56 | 0.686 - 2nd Gen-Gen. 3. | 1-1 | a-b | -0.33 | -1.49, 0.83 | 0.572 - 2nd Gen-Gen. 3. | 1-1 | b-b | -0.37 | -1.07, 0.34 | 0.305 - 2nd Gen-Gen. 3. | 1-2 | a-a | -0.01 | -2.06, 2.05 | 0.996 - 2nd Gen-Gen. 3. | 1-2 | a-b | 0.06 | -1.20, 1.32 | 0.924 - 2nd Gen-Gen. 3. | 1-2 | b-b | 0.03 | -0.83, 0.88 | 0.954 - 2nd Gen-Gen. 3. | 2-1 | a-b | -0.86 | -1.77, 0.04 | 0.060 - 2nd Gen-Gen. 3. | 2-2 | a-a | -0.54 | -2.46, 1.38 | 0.579 - 2nd Gen-Gen. 3. | 2-2 | a-b | -0.47 | -1.50, 0.56 | 0.364 - 2nd Gen-Gen. 3. | 2-2 | b-b | -0.42 | -1.36, 0.52 | 0.375 - Gen. 3.-1. Generation | 1-1 | a-b | -0.59 | -1.48, 0.31 | 0.195 - Gen. 3.-1. Generation | 1-2 | a-a | 0.15 | -1.04, 1.34 | 0.802 - Gen. 3.-1. Generation | 1-2 | a-b | 0.23 | -0.73, 1.18 | 0.642 - Gen. 3.-1. Generation | 1-2 | b-b | 0.82 | 0.06, 1.58 | 0.034 - Gen. 3.-1. Generation | 2-1 | a-b | -0.32 | -2.14, 1.51 | 0.730 - Gen. 3.-1. Generation | 2-2 | a-b | 0.50 | -1.36, 2.35 | 0.598 - Gen. 3.-2nd Gen | 1-1 | a-b | -0.23 | -1.15, 0.69 | 0.621 - Gen. 3.-2nd Gen | 1-2 | a-a | 0.27 | -0.81, 1.35 | 0.623 - Gen. 3.-2nd Gen | 1-2 | a-b | 0.22 | -0.78, 1.21 | 0.666 - Gen. 3.-2nd Gen | 1-2 | b-b | 0.81 | 0.01, 1.61 | 0.047 - Gen. 3.-2nd Gen | 2-1 | a-b | 0.04 | -1.80, 1.88 | 0.965 - Gen. 3.-2nd Gen | 2-2 | a-b | 0.49 | -1.39, 2.36 | 0.608 - Gen. 3.-Gen. 3. | 1-1 | a-b | -0.60 | -1.56, 0.36 | 0.220 - Gen. 3.-Gen. 3. | 1-2 | a-a | -0.27 | -2.22, 1.68 | 0.784 - Gen. 3.-Gen. 3. | 1-2 | a-b | -0.20 | -1.28, 0.87 | 0.707 - Gen. 3.-Gen. 3. | 1-2 | b-b | 0.39 | -0.51, 1.30 | 0.391 - Gen. 3.-Gen. 3. | 2-1 | a-b | -0.33 | -2.18, 1.53 | 0.728 - Gen. 3.-Gen. 3. | 2-2 | a-b | 0.07 | -1.86, 1.99 | 0.946 + x1 x2 x3 Contrast conf.low conf.high + 1 1. Generation-1. Generation 1-1 a-b 0.042750027 -0.65246681 0.73796686 + 2 1. Generation-1. Generation 1-2 a-a 0.781675151 -0.27109146 1.83444177 + 3 1. Generation-1. Generation 1-2 a-b 0.855921569 0.07840189 1.63344124 + 4 1. Generation-1. Generation 1-2 b-b 0.813171542 0.13897648 1.48736660 + 5 1. Generation-1. Generation 2-1 a-b -0.738925124 -1.71786316 0.24001291 + 6 1. Generation-1. Generation 2-2 a-b 0.074246418 -0.96475795 1.11325079 + 7 1. Generation-2nd Gen 1-1 a-a 0.365652460 -0.80575809 1.53706301 + 8 1. Generation-2nd Gen 1-1 a-b 0.401499092 -0.32497889 1.12797708 + 9 1. Generation-2nd Gen 1-1 b-b 0.358749064 -0.25588286 0.97338098 + 10 1. Generation-2nd Gen 1-2 a-a 0.898716868 -0.02021317 1.81764691 + 11 1. Generation-2nd Gen 1-2 a-b 0.846982091 0.02935810 1.66460609 + 12 1. Generation-2nd Gen 1-2 b-b 0.804232064 0.08415489 1.52430924 + 13 1. Generation-2nd Gen 2-1 a-b -0.380176060 -1.38155685 0.62120473 + 14 1. Generation-2nd Gen 2-2 a-a 0.117041717 -1.03162083 1.26570427 + 15 1. Generation-2nd Gen 2-2 a-b 0.065306939 -1.00403970 1.13465358 + 16 1. Generation-2nd Gen 2-2 b-b -0.008939479 -0.80876541 0.79088646 + 17 1. Generation-Gen. 3. 1-1 a-a 0.630869208 -0.34380329 1.60554170 + 18 1. Generation-Gen. 3. 1-1 a-b 0.034436204 -0.74308347 0.81195588 + 19 1. Generation-Gen. 3. 1-1 b-b -0.008313823 -0.68250888 0.66588124 + 20 1. Generation-Gen. 3. 1-2 a-a 0.360531654 -1.50582408 2.22688739 + 21 1. Generation-Gen. 3. 1-2 a-b 0.426499997 -0.49243004 1.34543004 + 22 1. Generation-Gen. 3. 1-2 b-b 0.383749970 -0.44957743 1.21707737 + 23 1. Generation-Gen. 3. 2-1 a-b -0.747238947 -1.78624332 0.29176542 + 24 1. Generation-Gen. 3. 2-2 a-a -0.421143497 -2.41068539 1.56839840 + 25 1. Generation-Gen. 3. 2-2 a-b -0.355175155 -1.50383770 0.79348739 + 26 1. Generation-Gen. 3. 2-2 b-b -0.429421572 -1.33255221 0.47370907 + 27 2nd Gen-1. Generation 1-1 a-b -0.322902433 -1.42843616 0.78263129 + 28 2nd Gen-1. Generation 1-2 a-a 0.416022691 -0.94309317 1.77513855 + 29 2nd Gen-1. Generation 1-2 a-b 0.490269109 -0.66878879 1.64932701 + 30 2nd Gen-1. Generation 1-2 b-b 0.454422478 -0.25196466 1.16080962 + 31 2nd Gen-1. Generation 2-1 a-b -0.855966841 -1.68929424 -0.02263944 + 32 2nd Gen-1. Generation 2-2 a-b -0.042795299 -0.94592594 0.86033534 + 33 2nd Gen-2nd Gen 1-1 a-b 0.035846631 -1.08960822 1.16130148 + 34 2nd Gen-2nd Gen 1-2 a-a 0.533064408 -0.72523237 1.79136119 + 35 2nd Gen-2nd Gen 1-2 a-b 0.481329630 -0.70500395 1.66766321 + 36 2nd Gen-2nd Gen 1-2 b-b 0.445482999 -0.30482024 1.19578623 + 37 2nd Gen-2nd Gen 2-1 a-b -0.497217776 -1.35679812 0.36236257 + 38 2nd Gen-2nd Gen 2-2 a-b -0.051734777 -0.98961382 0.88614427 + 39 2nd Gen-Gen. 3. 1-1 a-a 0.265216747 -1.03434658 1.56478007 + 40 2nd Gen-Gen. 3. 1-1 a-b -0.331216256 -1.49027415 0.82784164 + 41 2nd Gen-Gen. 3. 1-1 b-b -0.367062887 -1.07345003 0.33932425 + 42 2nd Gen-Gen. 3. 1-2 a-a -0.005120806 -2.05991084 2.04966923 + 43 2nd Gen-Gen. 3. 1-2 a-b 0.060847536 -1.19744924 1.31914431 + 44 2nd Gen-Gen. 3. 1-2 b-b 0.025000905 -0.83457944 0.88458125 + 45 2nd Gen-Gen. 3. 2-1 a-b -0.864280664 -1.76741130 0.03884997 + 46 2nd Gen-Gen. 3. 2-2 a-a -0.538185214 -2.46026529 1.38389486 + 47 2nd Gen-Gen. 3. 2-2 a-b -0.472216871 -1.49961189 0.55517815 + 48 2nd Gen-Gen. 3. 2-2 b-b -0.420482094 -1.35836114 0.51739695 + 49 Gen. 3.-1. Generation 1-1 a-b -0.588119181 -1.48254000 0.30630164 + 50 Gen. 3.-1. Generation 1-2 a-a 0.150805944 -1.04291919 1.34453108 + 51 Gen. 3.-1. Generation 1-2 a-b 0.225052361 -0.73473876 1.18484348 + 52 Gen. 3.-1. Generation 1-2 b-b 0.821485365 0.06270386 1.58026687 + 53 Gen. 3.-1. Generation 2-1 a-b -0.317781627 -2.14351048 1.50794723 + 54 Gen. 3.-1. Generation 2-2 a-b 0.495389915 -1.36323760 2.35401743 + 55 Gen. 3.-2nd Gen 1-1 a-b -0.229370116 -1.14830016 0.68955992 + 56 Gen. 3.-2nd Gen 1-2 a-a 0.267847660 -0.80969332 1.34538864 + 57 Gen. 3.-2nd Gen 1-2 a-b 0.216112883 -0.77644500 1.20867077 + 58 Gen. 3.-2nd Gen 1-2 b-b 0.812545886 0.01271995 1.61237182 + 59 Gen. 3.-2nd Gen 2-1 a-b 0.040967437 -1.79689264 1.87882752 + 60 Gen. 3.-2nd Gen 2-2 a-b 0.486450436 -1.38930765 2.36220852 + 61 Gen. 3.-Gen. 3. 1-1 a-b -0.596433003 -1.55622413 0.36335812 + 62 Gen. 3.-Gen. 3. 1-2 a-a -0.270337553 -2.21968254 1.67900743 + 63 Gen. 3.-Gen. 3. 1-2 a-b -0.204369211 -1.28191020 0.87317177 + 64 Gen. 3.-Gen. 3. 1-2 b-b 0.392063792 -0.51106685 1.29519443 + 65 Gen. 3.-Gen. 3. 2-1 a-b -0.326095450 -2.18472297 1.53253207 + 66 Gen. 3.-Gen. 3. 2-2 a-b 0.065968342 -1.85611174 1.98804842 + p.value + 1 0.90301790 + 2 0.14363255 + 3 0.03134353 + 4 0.01864823 + 5 0.13718013 + 6 0.88739662 + 7 0.53664579 + 8 0.27506689 + 9 0.24920918 + 10 0.05514222 + 11 0.04248493 + 12 0.02902072 + 13 0.45257642 + 14 0.83999896 + 15 0.90367675 + 16 0.98232953 + 17 0.20171278 + 18 0.93006339 + 19 0.98050430 + 20 0.70198375 + 21 0.35886572 + 22 0.36261199 + 23 0.15647733 + 24 0.67502395 + 25 0.54048037 + 26 0.34728757 + 27 0.56309849 + 28 0.54455177 + 29 0.40284895 + 30 0.20445806 + 31 0.04421838 + 32 0.92518921 + 33 0.94967375 + 34 0.40212900 + 35 0.42224318 + 36 0.24120868 + 37 0.25345095 + 38 0.91295891 + 39 0.68604372 + 40 0.57155268 + 41 0.30459102 + 42 0.99605963 + 43 0.92366006 + 44 0.95403870 + 45 0.06046852 + 46 0.57931961 + 47 0.36352329 + 48 0.37537612 + 49 0.19471031 + 50 0.80235400 + 51 0.64238056 + 52 0.03417506 + 53 0.73024157 + 54 0.59766558 + 55 0.62110374 + 56 0.62254635 + 57 0.66629196 + 58 0.04654196 + 59 0.96476695 + 60 0.60758359 + 61 0.22013970 + 62 0.78350159 + 63 0.70714448 + 64 0.39063921 + 65 0.72817048 + 66 0.94577605 --- Code print(out1) Output - # Pairwise comparisons - - x2/x3 = 1.a - - x1 | Contrast | 95% CI | p - ------------------------------------------------------ - 1. Generation-2nd Gen | 0.37 | -0.81, 1.54 | 0.537 - 1. Generation-Gen. 3. | 0.63 | -0.34, 1.61 | 0.202 - 2nd Gen-Gen. 3. | 0.27 | -1.03, 1.56 | 0.686 - - x2/x3 = 2.a - - x1 | Contrast | 95% CI | p - ------------------------------------------------------ - 1. Generation-2nd Gen | 0.12 | -1.03, 1.27 | 0.840 - 1. Generation-Gen. 3. | -0.42 | -2.41, 1.57 | 0.675 - 2nd Gen-Gen. 3. | -0.54 | -2.46, 1.38 | 0.579 - - x2/x3 = 1.b - - x1 | Contrast | 95% CI | p - ------------------------------------------------------ - 1. Generation-2nd Gen | 0.36 | -0.26, 0.97 | 0.249 - 1. Generation-Gen. 3. | -0.01 | -0.68, 0.67 | 0.981 - 2nd Gen-Gen. 3. | -0.37 | -1.07, 0.34 | 0.305 - - x2/x3 = 2.b - - x1 | Contrast | 95% CI | p - ------------------------------------------------------ - 1. Generation-2nd Gen | -0.01 | -0.81, 0.79 | 0.982 - 1. Generation-Gen. 3. | -0.43 | -1.33, 0.47 | 0.347 - 2nd Gen-Gen. 3. | -0.42 | -1.36, 0.52 | 0.375 + x1 x2 x3 Contrast conf.low conf.high p.value + 1 1. Generation-2nd Gen 1 a 0.365652460 -0.8057581 1.5370630 0.5366458 + 2 1. Generation-Gen. 3. 1 a 0.630869208 -0.3438033 1.6055417 0.2017128 + 3 2nd Gen-Gen. 3. 1 a 0.265216747 -1.0343466 1.5647801 0.6860437 + 28 1. Generation-2nd Gen 1 b 0.358749064 -0.2558829 0.9733810 0.2492092 + 35 1. Generation-Gen. 3. 1 b -0.008313823 -0.6825089 0.6658812 0.9805043 + 36 2nd Gen-Gen. 3. 1 b -0.367062887 -1.0734500 0.3393243 0.3045910 + 10 1. Generation-2nd Gen 2 a 0.117041717 -1.0316208 1.2657043 0.8399990 + 14 1. Generation-Gen. 3. 2 a -0.421143497 -2.4106854 1.5683984 0.6750239 + 15 2nd Gen-Gen. 3. 2 a -0.538185214 -2.4602653 1.3838949 0.5793196 + 55 1. Generation-2nd Gen 2 b -0.008939479 -0.8087654 0.7908865 0.9823295 + 65 1. Generation-Gen. 3. 2 b -0.429421572 -1.3325522 0.4737091 0.3472876 + 66 2nd Gen-Gen. 3. 2 b -0.420482094 -1.3583611 0.5173970 0.3753761 --- Code print(out) Output - # Pairwise comparisons - - x2 | x1 | Contrast | 95% CI | p - ---------------------------------------------------- - 1-2 | 1. Generation | 0.81 | -1.64, 3.26 | 0.514 - 1-2 | 2nd Gen | 0.46 | -1.99, 2.92 | 0.708 - 1-2 | Gen. 3. | 0.20 | -2.27, 2.67 | 0.875 + x2 x1 Contrast conf.low conf.high p.value + 4 1-2 1. Generation 0.8077922 -1.643086 3.258670 0.5144427 + 8 1-2 2nd Gen 0.4646082 -1.988355 2.917572 0.7077109 + 13 1-2 Gen. 3. 0.1963394 -2.272963 2.665642 0.8748954 # test_predictions, engine ggeffects, by-arg and column order Code print(out1) Output - # Pairwise comparisons - - treatment | time | Contrast | 95% CI | p - ------------------------------------------------------------ - coffee-control | morning | 0.25 | -0.04, 0.54 | 0.091 - coffee-control | noon | -0.30 | -0.60, 0.00 | 0.047 - coffee-control | afternoon | 0.25 | -0.04, 0.54 | 0.091 - Message - - Contrasts are presented as probabilities (in %-points). + treatment time Contrast conf.low conf.high p.value + 4 coffee-control morning 0.25 -0.03988248 0.539882476 0.09096883 + 8 coffee-control noon -0.30 -0.59562336 -0.004376639 0.04670332 + 13 coffee-control afternoon 0.25 -0.03988248 0.539882476 0.09096883 --- Code print(out2) Output - # Pairwise comparisons - - treatment | time | Contrast | 95% CI | p - ------------------------------------------------------------ - coffee-control | morning | 0.25 | -0.04, 0.54 | 0.091 - coffee-control | noon | -0.30 | -0.60, 0.00 | 0.047 - coffee-control | afternoon | 0.25 | -0.04, 0.54 | 0.091 - Message - - Contrasts are presented as probabilities (in %-points). + treatment time Contrast conf.low conf.high p.value + 1 coffee-control morning 0.25 -0.03988248 0.539882476 0.09096883 + 2 coffee-control noon -0.30 -0.59562336 -0.004376639 0.04670332 + 3 coffee-control afternoon 0.25 -0.03988248 0.539882476 0.09096883 From bbbc4bd89572a851c88237feea675ee4a48b2ee9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:57:23 +0100 Subject: [PATCH 43/51] update --- NAMESPACE | 1 + R/format.R | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++ man/print.Rd | 3 ++ 3 files changed, 145 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 559b2a91..b591d6e3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ S3method("[",ggeffects) S3method(as.data.frame,ggeffects) +S3method(format,ggcomparisons) S3method(format,ggeffects) S3method(get_predictions,Gam) S3method(get_predictions,MCMCglmm) diff --git a/R/format.R b/R/format.R index b68fd1bf..07e21a94 100644 --- a/R/format.R +++ b/R/format.R @@ -201,6 +201,120 @@ format.ggeffects <- function(x, } + +#' @rdname print +#' @export +format.ggcomparisons <- function(x, + collapse_ci = FALSE, + collapse_p = FALSE, + combine_levels = FALSE, + ...) { + ci <- attributes(x)$ci_level + by_factor <- attributes(x)$by_factor + estimate_name <- attributes(x)$estimate_name + datagrid <- attributes(x)$datagrid + + out <- insight::standardize_names(x) + attr(out, "ci") <- ci + # format confidence intervals + dots <- list(...) + if (is.null(dots$ci_brackets)) { + dots$ci_brackets <- getOption("ggeffects_ci_brackets", c("", "")) + } + # zap small values by default + if (is.null(dots$zap_small)) { + dots$zap_small <- TRUE + } + # set default for collapse_ci + collapse_ci <- getOption("ggeffects_collapse_ci", collapse_ci) + # set default for collapse_p + collapse_p <- getOption("ggeffects_collapse_p", collapse_p) + + out <- do.call(insight::format_table, c(list(out), dots)) + # collapse p? + out <- .collapse_p(out, collapse_p) + # collapse CI? + out <- .collapse_ci(out, collapse_ci, ci_brackets = dots$ci_brackets) + # mix levels and re-combine? + out <- .combine_level_pairs(out, combine_levels, datagrid, estimate_name, by_factor) + out +} + + +# helper ---------------------------------------------------------------------- + +# helper to re-arrange column values. Each column no longer represents pairs of +# the same focal term, but the levels of the first comparison of each focal +# term against the second. e.g. instead "education = low-high" and +# "sex = male-female", it will become "first = low-male" and "second = high-female" +.combine_level_pairs <- function(x, combine_levels, datagrid, estimate_name, by_factor = NULL) { + if (!combine_levels) { + return(x) + } + # retrieve columns that represent focal terms, but exclude group-by variable + focal_terms <- colnames(x)[1:(which(colnames(x) == estimate_name) - 1)] + focal_terms <- setdiff(focal_terms, by_factor) + # check if some of the levels contain a hyphen, which is used to separate + # the levels of the first and second comparison. If so, we need to temporatily + # replace the hyphen with another character, so that we can split the levels + needs_preparation <- focal_terms[vapply(datagrid[focal_terms], function(i) { + any(grepl("-", i, fixed = TRUE)) + }, logical(1))] + if (length(needs_preparation)) { + for (i in needs_preparation) { + unique_values <- as.character(unique(datagrid[[i]])) + for (j in unique_values) { + j_new <- gsub("-", "#_#", j, fixed = TRUE) + x[[i]] <- gsub(j, j_new, x[[i]], fixed = TRUE) + } + } + } + # separate columns, so we have one column for each level of the focal terms + out <- datawizard::data_separate( + x, + focal_terms, + guess_columns = "mode", + separator = "-", + append = FALSE + ) + # check if we need to replace special characters back to hyphens + if (length(needs_preparation)) { + for (i in needs_preparation) { + # if yes, we need to find the new columnsm which are no longer named + # "a" or "b", but "a_1", "a_2" etc. + split_columns <- grep(paste0(i, "_", "\\d"), colnames(out), value = TRUE) + for (j in split_columns) { + # add back hypen + out[[j]] <- gsub("#_#", "-", out[[j]], fixed = TRUE) + } + } + } + # unite split columns again. we need to do this for each split-part separately + split_parts <- unique(gsub("(.*)_(\\d)", "\\2", grep("_\\d$", colnames(out), value = TRUE))) + for (i in split_parts) { + # find columns that belong to the same focal term + unite_columns <- grep( + paste0("(", paste(focal_terms, collapse = "|"), ")_", i), + colnames(out), + value = TRUE + ) + out <- datawizard::data_relocate( + datawizard::data_unite( + out, + select = unite_columns, + new_column = paste("Pair", i), + append = FALSE, + separator = "-" + ), + select = "^Pair", + regex = TRUE + ) + } + # finished... + out +} + + .collapse_ci <- function(x, collapse_ci, ci_brackets) { # collapse CI? ci_column <- grep("\\d{2}% CI", colnames(x)) @@ -223,6 +337,33 @@ format.ggeffects <- function(x, } +.collapse_p <- function(x, collapse_p) { + # collapse p? + p_column <- which(colnames(x) == "p") + if (collapse_p && length(p_column)) { + # find CI column - we may insert p-values before that column. If we don't + # have CI columns, e.g. because user also used "collapse_ci = TRUE", we + # simply put it before estimated values + ci_column <- grep("\\d{2}% CI", colnames(x)) + if (length(ci_column)) { + insert_column <- ci_column - 1 + } else { + insert_column <- p_column - 1 + } + # make sure "< .001" is correctly handled + x$p[x$p == "< .001"] <- "0.0001" + # format p-values, we only want significance stars + p_values <- format(insight::format_p(as.numeric(x$p), stars = TRUE, stars_only = TRUE)) + # paste po-values to predicted values + x[, insert_column] <- paste0(x[, insert_column], p_values) + # remove p column + x[p_column] <- NULL + } + x +} + + + .nrows_to_print <- function(x, n) { # if we have groups, show n rows per group .n <- 1 diff --git a/man/print.Rd b/man/print.Rd index 567eab13..0567a87c 100644 --- a/man/print.Rd +++ b/man/print.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/format.R, R/print.R \name{format.ggeffects} \alias{format.ggeffects} +\alias{format.ggcomparisons} \alias{print} \alias{print.ggeffects} \alias{print_md.ggeffects} @@ -21,6 +22,8 @@ ... ) +\method{format}{ggcomparisons}(x, collapse_ci = FALSE, collapse_p = FALSE, combine_levels = FALSE, ...) + \method{print}{ggeffects}(x, group_name = TRUE, digits = 2, verbose = TRUE, ...) \method{print_md}{ggeffects}(x, group_name = TRUE, digits = 2, ...) From 60773fde9eae314ebda229f950ecbcf080d559b5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 17:57:41 +0100 Subject: [PATCH 44/51] update --- NAMESPACE | 3 + R/print.R | 348 +++++++++++++++ man/print.Rd | 16 + .../_snaps/test_predictions_ggeffects.md | 409 +++++++++--------- 4 files changed, 578 insertions(+), 198 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index b591d6e3..51ce4897 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -93,9 +93,12 @@ S3method(get_predictions,zerotrunc) S3method(plot,ggalleffects) S3method(plot,ggeffects) S3method(plot,see_equivalence_test_ggeffects) +S3method(print,ggcomparisons) S3method(print,ggeffects) S3method(print,ggjohnson_neyman) +S3method(print_html,ggcomparisons) S3method(print_html,ggeffects) +S3method(print_md,ggcomparisons) S3method(print_md,ggeffects) S3method(residualize_over_grid,data.frame) S3method(residualize_over_grid,ggeffects) diff --git a/R/print.R b/R/print.R index dab90c03..02b5ca9b 100644 --- a/R/print.R +++ b/R/print.R @@ -354,3 +354,351 @@ print_html.ggeffects <- function(x, sample.rows } + + +#' @rdname print +#' @export +print.ggcomparisons <- function(x, collapse_tables = TRUE, ...) { + # check if default format is "html" or "markdown" + output_format <- getOption("ggeffects_output_format", "text") + if (identical(output_format, "html")) { + return(print(print_html(x, ...))) + } + if (identical(output_format, "markdown")) { + return(print(print_md(x, ...))) + } + + test_pairwise <- identical(attributes(x)$test, "pairwise") + test_consecutive <- identical(attributes(x)$test, "consecutive") + test_interaction <- identical(attributes(x)$test, "interaction") + test_custom <- identical(attributes(x)$test, "custom") + estimate_name <- attributes(x)$estimate_name + by_factor <- attributes(x)$by_factor + rope_range <- attributes(x)$rope_range + verbose <- isTRUE(attributes(x)$verbose) + scale_outcome <- attributes(x)$scale + scale_label <- attributes(x)$scale_label + is_linear <- isTRUE(attributes(x)$linear_model) + + # if we want to collapse table, we don't need "by" variable + if (isTRUE(collapse_tables)) { + by_factor <- NULL + } + + # get header and footer, then print table + x <- format(x, ...) + slopes <- vapply(x, function(i) all(i == "slope"), TRUE) + if (!is.null(rope_range)) { + caption <- c("# TOST-test for Practical Equivalence", "blue") + } else if (any(slopes)) { + x[slopes] <- NULL + caption <- c(paste0("# (Average) Linear trend for ", names(slopes)[slopes]), "blue") + } else if (test_pairwise) { + caption <- c("# Pairwise comparisons", "blue") + } else if (test_consecutive) { + caption <- c("# Consecutive contrasts", "blue") + } else if (test_interaction) { + caption <- c("# Interaction contrasts", "blue") + } else if (test_custom) { + caption <- c("# Custom contrasts", "blue") + } else { + caption <- NULL + } + footer <- attributes(x)$hypothesis_label + if (!is.null(footer)) { + footer <- insight::format_message(paste0("Tested hypothesis: ", footer)) + footer <- paste0("\n", footer, "\n") + } + + # split tables by response levels? + if ("Response_Level" %in% colnames(x)) { + x$Response_Level <- factor(x$Response_Level, levels = unique(x$Response_Level)) + out <- split(x, x$Response_Level) + for (response_table in seq_along(out)) { + insight::print_color(paste0("\n# Response Level: ", names(out)[response_table], "\n\n"), "red") + tab <- out[[response_table]] + tab$Response_Level <- NULL + if (response_table == 1) { + cat(insight::export_table(tab, title = caption, footer = NULL, ...)) + } else if (response_table == length(out)) { + cat(insight::export_table(tab, title = NULL, footer = footer, ...)) + } else { + cat(insight::export_table(tab, title = NULL, footer = NULL, ...)) + } + } + # check if we have at least three rows by column, else splitting by "by" + # is not useful + } else if (!is.null(by_factor) && all(by_factor %in% colnames(x)) && (prod(lengths(lapply(x[by_factor], unique))) * 3) <= nrow(x)) { # nolint + # split tables by "by" variable? Need a different handling for captions here + out <- split(x, x[by_factor]) + if (!is.null(caption)) { + insight::print_color(caption[1], caption[2]) + cat("\n") + } + for (by_table in seq_along(out)) { + insight::print_color(paste0("\n", paste0(by_factor, collapse = "/"), " = ", names(out)[by_table], "\n\n"), "red") + tab <- out[[by_table]] + tab[by_factor] <- NULL + if (by_table == length(out)) { + cat(insight::export_table(tab, title = NULL, footer = footer, ...)) + } else { + cat(insight::export_table(tab, title = NULL, footer = NULL, ...)) + } + } + } else { + cat(insight::export_table(x, title = caption, footer = footer, ...)) + } + + # what type of estimates do we have? + type <- switch(estimate_name, + Predicted = "Predictions", + Contrast = "Contrasts", + Slope = "Slopes", + "Estimates" + ) + + # tell user about scale of estimate type + if (verbose && !(is_linear && identical(scale_outcome, "response"))) { + if (is.null(scale_label)) { + scale_label <- switch(scale_outcome, + response = "response", + probs = , + probability = if (type == "Contrasts") { + "probability (in %-points)" + } else { + "probability" + }, + exp = "exponentiated", + log = "log", + link = "link", + oddsratios = "odds ratio", + irr = "incident rate ratio", + count = , + conditional = "conditional means", + "unknown" + ) + msg <- paste0("\n", type, " are presented on the ", scale_label, " scale.") + } else { + # for proportions and probabilities, contrasts are differences in %-points + if (type == "Contrasts" && scale_label %in% c("probabilities", "proportions")) { + scale_label <- paste(scale_label, "(in %-points)") + } + msg <- paste0("\n", type, " are presented as ", scale_label, ".") + } + insight::format_alert(msg) + } +} + + +#' @rdname print +#' @export +print_html.ggcomparisons <- function(x, + collapse_ci = FALSE, + collapse_p = FALSE, + theme = NULL, + engine = c("tt", "gt"), + ...) { + engine <- getOption("ggeffects_html_engine", engine) + engine <- match.arg(engine) + .print_html_ggcomparisons( + x, + collapse_ci = collapse_ci, + collapse_p = collapse_p, + theme = theme, + engine = engine, + ... + ) +} + + +#' @rdname print +#' @export +print_md.ggcomparisons <- function(x, collapse_ci = FALSE, collapse_p = FALSE, theme = NULL, ...) { + .print_html_ggcomparisons( + x, + collapse_ci = collapse_ci, + collapse_p = collapse_p, + theme = theme, + engine = "tt", + output = "markdown", + ... + ) +} + + +.print_html_ggcomparisons <- function(x, + collapse_ci = FALSE, + collapse_p = FALSE, + theme = NULL, + engine = c("tt", "gt"), + output = "html", + ...) { + test_pairwise <- identical(attributes(x)$test, "pairwise") + test_interaction <- identical(attributes(x)$test, "interaction") + test_consecutive <- identical(attributes(x)$test, "consecutive") + test_custom <- identical(attributes(x)$test, "custom") + estimate_name <- attributes(x)$estimate_name + rope_range <- attributes(x)$rope_range + verbose <- isTRUE(attributes(x)$verbose) + by_factor <- attributes(x)$by_factor + scale_outcome <- attributes(x)$scale + scale_label <- attributes(x)$scale_label + is_linear <- isTRUE(attributes(x)$linear_model) + + # get header and footer, then print table + x <- format(x, collapse_ci = collapse_ci, collapse_p = collapse_p, ...) + slopes <- vapply(x, function(i) all(i == "slope"), TRUE) + if (!is.null(rope_range)) { + caption <- "TOST-test for Practical Equivalence" + } else if (any(slopes)) { + x[slopes] <- NULL + caption <- paste0("(Average) Linear trend for ", names(slopes)[slopes]) + } else if (test_pairwise) { + caption <- "Pairwise comparisons" + } else if (test_interaction) { + caption <- "Interaction contrasts" + } else if (test_consecutive) { + caption <- "Consecutive contrasts" + } else if (test_custom) { + caption <- "Custom contrasts" + } else { + caption <- NULL + } + + footer <- attributes(x)$hypothesis_label + if (!is.null(footer)) { + footer <- paste0("Tested hypothesis: ", footer) + } + + if (verbose) { + # what type of estimates do we have? + type <- switch(estimate_name, + Predicted = "Predictions", + Contrast = "Contrasts", + Slope = "Slopes", + "Estimates" + ) + + # line separator + line_sep <- ifelse(identical(output, "html"), "
", ", ") + + # tell user about scale of estimate type + if (!(is_linear && identical(scale_outcome, "response"))) { + if (is.null(scale_label)) { + scale_label <- switch(scale_outcome, + response = "response", + probs = , + probability = "probability", + exp = "exponentiated", + log = "log", + link = "link", + oddsratios = "odds ratio", + irr = "incident rate ratio", + "unknown" + ) + footer <- paste0( + footer, + ifelse(is.null(footer), "", line_sep), + type, + " are presented on the ", + scale_label, + " scale." + ) + } else { + footer <- paste0( + footer, + ifelse(is.null(footer), "", line_sep), + type, + " are presented as ", + scale_label, + "." + ) + } + } + } + + # format footer, make it a bit smaller + if (identical(output, "html")) { + footer <- .format_html_footer(footer) + } + + # split by "by"? But only, if we have enough rows for each group + # else, inserting table headings for each row is not useful + split_by <- !is.null(by_factor) && + all(by_factor %in% colnames(x)) && + (prod(lengths(lapply(x[by_factor], unique))) * 3) <= nrow(x) + + # start here for using tinytables + if (engine == "tt") { + insight::check_if_installed("tinytable", minimum_version = "0.1.0") + # used for subgroup headers, if available + row_header_pos <- row_header_labels <- NULL + + # do we have groups? + if (split_by) { # nolint + # if we have more than one group variable, we unite them into one + if (length(by_factor) > 1) { + group_by <- datawizard::data_unite(x, "group_by", by_factor, separator = ", ")$group_by + } else { + group_by <- x[[by_factor]] + } + x[by_factor] <- NULL + } else if ("Response_Level" %in% colnames(x)) { + group_by <- x$Response_Level + x$Response_Level <- NULL + } else { + group_by <- NULL + } + + # split tables by response levels? + if (!is.null(group_by)) { + # make sure group_by is ordered + if (is.unsorted(group_by)) { + new_row_order <- order(group_by) + # re-order group_by and data frame + group_by <- group_by[new_row_order] + x <- x[new_row_order, ] + } + # find start row of each subgroup + row_header_pos <- which(!duplicated(group_by)) + # create named list, required for tinytables + row_header_labels <- as.list(stats::setNames(row_header_pos, as.vector(group_by[row_header_pos]))) + # make sure that the row header positions are correct - each header + # must be shifted by the number of rows above + for (i in 2:length(row_header_pos)) { + row_header_pos[i] <- row_header_pos[i] + (i - 1) + } + } + + # base table + out <- tinytable::tt(x, caption = caption, notes = footer) + # add subheaders, if any + if (!is.null(row_header_labels)) { + out <- tinytable::group_tt(out, i = row_header_labels, indent = 2) + out <- tinytable::style_tt(out, i = row_header_pos, italic = TRUE) + } + # apply theme, if any + if (identical(output, "html")) { + out <- insight::apply_table_theme(out, x, theme = theme, sub_header_positions = row_header_pos) + } + # workaround, to make sure HTML is default output + out@output <- output + out + } else { + # here we go with gt + if ("Response_Level" %in% colnames(x)) { + group_by <- c("Response_Level", "groups") + } else if (split_by) { + groups <- c(by_factor, "groups") + } else { + group_by <- "groups" + } + insight::export_table( + x, + format = "html", + by = "groups", + footer = footer, + caption = caption + ) + } +} diff --git a/man/print.Rd b/man/print.Rd index 0567a87c..fc277543 100644 --- a/man/print.Rd +++ b/man/print.Rd @@ -7,6 +7,9 @@ \alias{print.ggeffects} \alias{print_md.ggeffects} \alias{print_html.ggeffects} +\alias{print.ggcomparisons} +\alias{print_html.ggcomparisons} +\alias{print_md.ggcomparisons} \title{Print and format ggeffects-objects} \usage{ \method{format}{ggeffects}( @@ -36,6 +39,19 @@ engine = c("tt", "gt"), ... ) + +\method{print}{ggcomparisons}(x, collapse_tables = FALSE, ...) + +\method{print_html}{ggcomparisons}( + x, + collapse_ci = FALSE, + collapse_p = FALSE, + theme = NULL, + engine = c("tt", "gt"), + ... +) + +\method{print_md}{ggcomparisons}(x, collapse_ci = FALSE, collapse_p = FALSE, theme = NULL, ...) } \arguments{ \item{x}{An object of class \code{ggeffects}, as returned by the functions diff --git a/tests/testthat/_snaps/test_predictions_ggeffects.md b/tests/testthat/_snaps/test_predictions_ggeffects.md index 7b13bbf1..755959b1 100644 --- a/tests/testthat/_snaps/test_predictions_ggeffects.md +++ b/tests/testthat/_snaps/test_predictions_ggeffects.md @@ -3,238 +3,251 @@ Code print(out1) Output - x1 x2 Contrast conf.low conf.high - 1 1. Generation-1. Generation 1-2 0.80811389 0.256116187 1.3601116 - 2 1. Generation-2nd Gen 1-1 0.36751601 -0.153281898 0.8883139 - 3 1. Generation-2nd Gen 1-2 0.83966736 0.287669664 1.3916651 - 4 1. Generation-2nd Gen 2-2 0.03155348 -0.602206670 0.6653136 - 5 1. Generation-Gen. 3. 1-1 0.19281288 -0.347695989 0.7333217 - 6 1. Generation-Gen. 3. 1-2 0.38906731 -0.341834083 1.1199687 - 7 1. Generation-Gen. 3. 2-2 -0.41904658 -1.213506965 0.3754138 - 8 2nd Gen-1. Generation 1-2 0.44059787 -0.166181273 1.0473770 - 9 2nd Gen-2nd Gen 1-2 0.47215135 -0.134627796 1.0789305 - 10 2nd Gen-Gen. 3. 1-1 -0.17470314 -0.771049769 0.4216435 - 11 2nd Gen-Gen. 3. 1-2 0.02155129 -0.751556922 0.7946595 - 12 2nd Gen-Gen. 3. 2-2 -0.45060005 -1.245060442 0.3438603 - 13 Gen. 3.-1. Generation 1-2 0.61530101 -0.008478042 1.2390801 - 14 Gen. 3.-2nd Gen 1-2 0.64685448 0.023075435 1.2706335 - 15 Gen. 3.-Gen. 3. 1-2 0.19625443 -0.590266826 0.9827757 - p.value - 1 0.004554708 - 2 0.164464586 - 3 0.003252247 - 4 0.921464142 - 5 0.480520805 - 6 0.293258076 - 7 0.297653386 - 8 0.152699267 - 9 0.125708853 - 10 0.562181073 - 11 0.955978069 - 12 0.262971361 - 13 0.053131084 - 14 0.042263004 - 15 0.621451470 + # Pairwise comparisons + + x1 | x2 | Contrast | conf.low | conf.high | p.value + ---------------------------------------------------------------------------------------- + 1. Generation-1. Generation | 1-2 | 0.80811389 | 0.256116187 | 1.3601116 | 0.004554708 + 1. Generation-2nd Gen | 1-1 | 0.36751601 | -0.153281898 | 0.8883139 | 0.164464586 + 1. Generation-2nd Gen | 1-2 | 0.83966736 | 0.287669664 | 1.3916651 | 0.003252247 + 1. Generation-2nd Gen | 2-2 | 0.03155348 | -0.602206670 | 0.6653136 | 0.921464142 + 1. Generation-Gen. 3. | 1-1 | 0.19281288 | -0.347695989 | 0.7333217 | 0.480520805 + 1. Generation-Gen. 3. | 1-2 | 0.38906731 | -0.341834083 | 1.1199687 | 0.293258076 + 1. Generation-Gen. 3. | 2-2 | -0.41904658 | -1.213506965 | 0.3754138 | 0.297653386 + 2nd Gen-1. Generation | 1-2 | 0.44059787 | -0.166181273 | 1.0473770 | 0.152699267 + 2nd Gen-2nd Gen | 1-2 | 0.47215135 | -0.134627796 | 1.0789305 | 0.125708853 + 2nd Gen-Gen. 3. | 1-1 | -0.17470314 | -0.771049769 | 0.4216435 | 0.562181073 + 2nd Gen-Gen. 3. | 1-2 | 0.02155129 | -0.751556922 | 0.7946595 | 0.955978069 + 2nd Gen-Gen. 3. | 2-2 | -0.45060005 | -1.245060442 | 0.3438603 | 0.262971361 + Gen. 3.-1. Generation | 1-2 | 0.61530101 | -0.008478042 | 1.2390801 | 0.053131084 + Gen. 3.-2nd Gen | 1-2 | 0.64685448 | 0.023075435 | 1.2706335 | 0.042263004 + Gen. 3.-Gen. 3. | 1-2 | 0.19625443 | -0.590266826 | 0.9827757 | 0.621451470 --- Code print(out1) Output - x1 x2 Contrast conf.low conf.high p.value - 1 1. Generation-2nd Gen 1 0.36751601 -0.1532819 0.8883139 0.1644646 - 2 1. Generation-Gen. 3. 1 0.19281288 -0.3476960 0.7333217 0.4805208 - 3 2nd Gen-Gen. 3. 1 -0.17470314 -0.7710498 0.4216435 0.5621811 - 10 1. Generation-2nd Gen 2 0.03155348 -0.6022067 0.6653136 0.9214641 - 14 1. Generation-Gen. 3. 2 -0.41904658 -1.2135070 0.3754138 0.2976534 - 15 2nd Gen-Gen. 3. 2 -0.45060005 -1.2450604 0.3438603 0.2629714 + # Pairwise comparisons + + x1 | x2 | Contrast | conf.low | conf.high | p.value + ----------------------------------------------------------------------------- + 1. Generation-2nd Gen | 1 | 0.36751601 | -0.1532819 | 0.8883139 | 0.1644646 + 1. Generation-Gen. 3. | 1 | 0.19281288 | -0.3476960 | 0.7333217 | 0.4805208 + 2nd Gen-Gen. 3. | 1 | -0.17470314 | -0.7710498 | 0.4216435 | 0.5621811 + 1. Generation-2nd Gen | 2 | 0.03155348 | -0.6022067 | 0.6653136 | 0.9214641 + 1. Generation-Gen. 3. | 2 | -0.41904658 | -1.2135070 | 0.3754138 | 0.2976534 + 2nd Gen-Gen. 3. | 2 | -0.45060005 | -1.2450604 | 0.3438603 | 0.2629714 --- Code print(out1) Output - x1 x2 x3 Contrast conf.low conf.high - 1 1. Generation-1. Generation 1-1 a-b 0.042750027 -0.65246681 0.73796686 - 2 1. Generation-1. Generation 1-2 a-a 0.781675151 -0.27109146 1.83444177 - 3 1. Generation-1. Generation 1-2 a-b 0.855921569 0.07840189 1.63344124 - 4 1. Generation-1. Generation 1-2 b-b 0.813171542 0.13897648 1.48736660 - 5 1. Generation-1. Generation 2-1 a-b -0.738925124 -1.71786316 0.24001291 - 6 1. Generation-1. Generation 2-2 a-b 0.074246418 -0.96475795 1.11325079 - 7 1. Generation-2nd Gen 1-1 a-a 0.365652460 -0.80575809 1.53706301 - 8 1. Generation-2nd Gen 1-1 a-b 0.401499092 -0.32497889 1.12797708 - 9 1. Generation-2nd Gen 1-1 b-b 0.358749064 -0.25588286 0.97338098 - 10 1. Generation-2nd Gen 1-2 a-a 0.898716868 -0.02021317 1.81764691 - 11 1. Generation-2nd Gen 1-2 a-b 0.846982091 0.02935810 1.66460609 - 12 1. Generation-2nd Gen 1-2 b-b 0.804232064 0.08415489 1.52430924 - 13 1. Generation-2nd Gen 2-1 a-b -0.380176060 -1.38155685 0.62120473 - 14 1. Generation-2nd Gen 2-2 a-a 0.117041717 -1.03162083 1.26570427 - 15 1. Generation-2nd Gen 2-2 a-b 0.065306939 -1.00403970 1.13465358 - 16 1. Generation-2nd Gen 2-2 b-b -0.008939479 -0.80876541 0.79088646 - 17 1. Generation-Gen. 3. 1-1 a-a 0.630869208 -0.34380329 1.60554170 - 18 1. Generation-Gen. 3. 1-1 a-b 0.034436204 -0.74308347 0.81195588 - 19 1. Generation-Gen. 3. 1-1 b-b -0.008313823 -0.68250888 0.66588124 - 20 1. Generation-Gen. 3. 1-2 a-a 0.360531654 -1.50582408 2.22688739 - 21 1. Generation-Gen. 3. 1-2 a-b 0.426499997 -0.49243004 1.34543004 - 22 1. Generation-Gen. 3. 1-2 b-b 0.383749970 -0.44957743 1.21707737 - 23 1. Generation-Gen. 3. 2-1 a-b -0.747238947 -1.78624332 0.29176542 - 24 1. Generation-Gen. 3. 2-2 a-a -0.421143497 -2.41068539 1.56839840 - 25 1. Generation-Gen. 3. 2-2 a-b -0.355175155 -1.50383770 0.79348739 - 26 1. Generation-Gen. 3. 2-2 b-b -0.429421572 -1.33255221 0.47370907 - 27 2nd Gen-1. Generation 1-1 a-b -0.322902433 -1.42843616 0.78263129 - 28 2nd Gen-1. Generation 1-2 a-a 0.416022691 -0.94309317 1.77513855 - 29 2nd Gen-1. Generation 1-2 a-b 0.490269109 -0.66878879 1.64932701 - 30 2nd Gen-1. Generation 1-2 b-b 0.454422478 -0.25196466 1.16080962 - 31 2nd Gen-1. Generation 2-1 a-b -0.855966841 -1.68929424 -0.02263944 - 32 2nd Gen-1. Generation 2-2 a-b -0.042795299 -0.94592594 0.86033534 - 33 2nd Gen-2nd Gen 1-1 a-b 0.035846631 -1.08960822 1.16130148 - 34 2nd Gen-2nd Gen 1-2 a-a 0.533064408 -0.72523237 1.79136119 - 35 2nd Gen-2nd Gen 1-2 a-b 0.481329630 -0.70500395 1.66766321 - 36 2nd Gen-2nd Gen 1-2 b-b 0.445482999 -0.30482024 1.19578623 - 37 2nd Gen-2nd Gen 2-1 a-b -0.497217776 -1.35679812 0.36236257 - 38 2nd Gen-2nd Gen 2-2 a-b -0.051734777 -0.98961382 0.88614427 - 39 2nd Gen-Gen. 3. 1-1 a-a 0.265216747 -1.03434658 1.56478007 - 40 2nd Gen-Gen. 3. 1-1 a-b -0.331216256 -1.49027415 0.82784164 - 41 2nd Gen-Gen. 3. 1-1 b-b -0.367062887 -1.07345003 0.33932425 - 42 2nd Gen-Gen. 3. 1-2 a-a -0.005120806 -2.05991084 2.04966923 - 43 2nd Gen-Gen. 3. 1-2 a-b 0.060847536 -1.19744924 1.31914431 - 44 2nd Gen-Gen. 3. 1-2 b-b 0.025000905 -0.83457944 0.88458125 - 45 2nd Gen-Gen. 3. 2-1 a-b -0.864280664 -1.76741130 0.03884997 - 46 2nd Gen-Gen. 3. 2-2 a-a -0.538185214 -2.46026529 1.38389486 - 47 2nd Gen-Gen. 3. 2-2 a-b -0.472216871 -1.49961189 0.55517815 - 48 2nd Gen-Gen. 3. 2-2 b-b -0.420482094 -1.35836114 0.51739695 - 49 Gen. 3.-1. Generation 1-1 a-b -0.588119181 -1.48254000 0.30630164 - 50 Gen. 3.-1. Generation 1-2 a-a 0.150805944 -1.04291919 1.34453108 - 51 Gen. 3.-1. Generation 1-2 a-b 0.225052361 -0.73473876 1.18484348 - 52 Gen. 3.-1. Generation 1-2 b-b 0.821485365 0.06270386 1.58026687 - 53 Gen. 3.-1. Generation 2-1 a-b -0.317781627 -2.14351048 1.50794723 - 54 Gen. 3.-1. Generation 2-2 a-b 0.495389915 -1.36323760 2.35401743 - 55 Gen. 3.-2nd Gen 1-1 a-b -0.229370116 -1.14830016 0.68955992 - 56 Gen. 3.-2nd Gen 1-2 a-a 0.267847660 -0.80969332 1.34538864 - 57 Gen. 3.-2nd Gen 1-2 a-b 0.216112883 -0.77644500 1.20867077 - 58 Gen. 3.-2nd Gen 1-2 b-b 0.812545886 0.01271995 1.61237182 - 59 Gen. 3.-2nd Gen 2-1 a-b 0.040967437 -1.79689264 1.87882752 - 60 Gen. 3.-2nd Gen 2-2 a-b 0.486450436 -1.38930765 2.36220852 - 61 Gen. 3.-Gen. 3. 1-1 a-b -0.596433003 -1.55622413 0.36335812 - 62 Gen. 3.-Gen. 3. 1-2 a-a -0.270337553 -2.21968254 1.67900743 - 63 Gen. 3.-Gen. 3. 1-2 a-b -0.204369211 -1.28191020 0.87317177 - 64 Gen. 3.-Gen. 3. 1-2 b-b 0.392063792 -0.51106685 1.29519443 - 65 Gen. 3.-Gen. 3. 2-1 a-b -0.326095450 -2.18472297 1.53253207 - 66 Gen. 3.-Gen. 3. 2-2 a-b 0.065968342 -1.85611174 1.98804842 - p.value - 1 0.90301790 - 2 0.14363255 - 3 0.03134353 - 4 0.01864823 - 5 0.13718013 - 6 0.88739662 - 7 0.53664579 - 8 0.27506689 - 9 0.24920918 - 10 0.05514222 - 11 0.04248493 - 12 0.02902072 - 13 0.45257642 - 14 0.83999896 - 15 0.90367675 - 16 0.98232953 - 17 0.20171278 - 18 0.93006339 - 19 0.98050430 - 20 0.70198375 - 21 0.35886572 - 22 0.36261199 - 23 0.15647733 - 24 0.67502395 - 25 0.54048037 - 26 0.34728757 - 27 0.56309849 - 28 0.54455177 - 29 0.40284895 - 30 0.20445806 - 31 0.04421838 - 32 0.92518921 - 33 0.94967375 - 34 0.40212900 - 35 0.42224318 - 36 0.24120868 - 37 0.25345095 - 38 0.91295891 - 39 0.68604372 - 40 0.57155268 - 41 0.30459102 - 42 0.99605963 - 43 0.92366006 - 44 0.95403870 - 45 0.06046852 - 46 0.57931961 - 47 0.36352329 - 48 0.37537612 - 49 0.19471031 - 50 0.80235400 - 51 0.64238056 - 52 0.03417506 - 53 0.73024157 - 54 0.59766558 - 55 0.62110374 - 56 0.62254635 - 57 0.66629196 - 58 0.04654196 - 59 0.96476695 - 60 0.60758359 - 61 0.22013970 - 62 0.78350159 - 63 0.70714448 - 64 0.39063921 - 65 0.72817048 - 66 0.94577605 + # Pairwise comparisons + + x1 | x2 | x3 | Contrast | conf.low + -------------------------------------------------------------------- + 1. Generation-1. Generation | 1-1 | a-b | 0.042750027 | -0.65246681 + 1. Generation-1. Generation | 1-2 | a-a | 0.781675151 | -0.27109146 + 1. Generation-1. Generation | 1-2 | a-b | 0.855921569 | 0.07840189 + 1. Generation-1. Generation | 1-2 | b-b | 0.813171542 | 0.13897648 + 1. Generation-1. Generation | 2-1 | a-b | -0.738925124 | -1.71786316 + 1. Generation-1. Generation | 2-2 | a-b | 0.074246418 | -0.96475795 + 1. Generation-2nd Gen | 1-1 | a-a | 0.365652460 | -0.80575809 + 1. Generation-2nd Gen | 1-1 | a-b | 0.401499092 | -0.32497889 + 1. Generation-2nd Gen | 1-1 | b-b | 0.358749064 | -0.25588286 + 1. Generation-2nd Gen | 1-2 | a-a | 0.898716868 | -0.02021317 + 1. Generation-2nd Gen | 1-2 | a-b | 0.846982091 | 0.02935810 + 1. Generation-2nd Gen | 1-2 | b-b | 0.804232064 | 0.08415489 + 1. Generation-2nd Gen | 2-1 | a-b | -0.380176060 | -1.38155685 + 1. Generation-2nd Gen | 2-2 | a-a | 0.117041717 | -1.03162083 + 1. Generation-2nd Gen | 2-2 | a-b | 0.065306939 | -1.00403970 + 1. Generation-2nd Gen | 2-2 | b-b | -0.008939479 | -0.80876541 + 1. Generation-Gen. 3. | 1-1 | a-a | 0.630869208 | -0.34380329 + 1. Generation-Gen. 3. | 1-1 | a-b | 0.034436204 | -0.74308347 + 1. Generation-Gen. 3. | 1-1 | b-b | -0.008313823 | -0.68250888 + 1. Generation-Gen. 3. | 1-2 | a-a | 0.360531654 | -1.50582408 + 1. Generation-Gen. 3. | 1-2 | a-b | 0.426499997 | -0.49243004 + 1. Generation-Gen. 3. | 1-2 | b-b | 0.383749970 | -0.44957743 + 1. Generation-Gen. 3. | 2-1 | a-b | -0.747238947 | -1.78624332 + 1. Generation-Gen. 3. | 2-2 | a-a | -0.421143497 | -2.41068539 + 1. Generation-Gen. 3. | 2-2 | a-b | -0.355175155 | -1.50383770 + 1. Generation-Gen. 3. | 2-2 | b-b | -0.429421572 | -1.33255221 + 2nd Gen-1. Generation | 1-1 | a-b | -0.322902433 | -1.42843616 + 2nd Gen-1. Generation | 1-2 | a-a | 0.416022691 | -0.94309317 + 2nd Gen-1. Generation | 1-2 | a-b | 0.490269109 | -0.66878879 + 2nd Gen-1. Generation | 1-2 | b-b | 0.454422478 | -0.25196466 + 2nd Gen-1. Generation | 2-1 | a-b | -0.855966841 | -1.68929424 + 2nd Gen-1. Generation | 2-2 | a-b | -0.042795299 | -0.94592594 + 2nd Gen-2nd Gen | 1-1 | a-b | 0.035846631 | -1.08960822 + 2nd Gen-2nd Gen | 1-2 | a-a | 0.533064408 | -0.72523237 + 2nd Gen-2nd Gen | 1-2 | a-b | 0.481329630 | -0.70500395 + 2nd Gen-2nd Gen | 1-2 | b-b | 0.445482999 | -0.30482024 + 2nd Gen-2nd Gen | 2-1 | a-b | -0.497217776 | -1.35679812 + 2nd Gen-2nd Gen | 2-2 | a-b | -0.051734777 | -0.98961382 + 2nd Gen-Gen. 3. | 1-1 | a-a | 0.265216747 | -1.03434658 + 2nd Gen-Gen. 3. | 1-1 | a-b | -0.331216256 | -1.49027415 + 2nd Gen-Gen. 3. | 1-1 | b-b | -0.367062887 | -1.07345003 + 2nd Gen-Gen. 3. | 1-2 | a-a | -0.005120806 | -2.05991084 + 2nd Gen-Gen. 3. | 1-2 | a-b | 0.060847536 | -1.19744924 + 2nd Gen-Gen. 3. | 1-2 | b-b | 0.025000905 | -0.83457944 + 2nd Gen-Gen. 3. | 2-1 | a-b | -0.864280664 | -1.76741130 + 2nd Gen-Gen. 3. | 2-2 | a-a | -0.538185214 | -2.46026529 + 2nd Gen-Gen. 3. | 2-2 | a-b | -0.472216871 | -1.49961189 + 2nd Gen-Gen. 3. | 2-2 | b-b | -0.420482094 | -1.35836114 + Gen. 3.-1. Generation | 1-1 | a-b | -0.588119181 | -1.48254000 + Gen. 3.-1. Generation | 1-2 | a-a | 0.150805944 | -1.04291919 + Gen. 3.-1. Generation | 1-2 | a-b | 0.225052361 | -0.73473876 + Gen. 3.-1. Generation | 1-2 | b-b | 0.821485365 | 0.06270386 + Gen. 3.-1. Generation | 2-1 | a-b | -0.317781627 | -2.14351048 + Gen. 3.-1. Generation | 2-2 | a-b | 0.495389915 | -1.36323760 + Gen. 3.-2nd Gen | 1-1 | a-b | -0.229370116 | -1.14830016 + Gen. 3.-2nd Gen | 1-2 | a-a | 0.267847660 | -0.80969332 + Gen. 3.-2nd Gen | 1-2 | a-b | 0.216112883 | -0.77644500 + Gen. 3.-2nd Gen | 1-2 | b-b | 0.812545886 | 0.01271995 + Gen. 3.-2nd Gen | 2-1 | a-b | 0.040967437 | -1.79689264 + Gen. 3.-2nd Gen | 2-2 | a-b | 0.486450436 | -1.38930765 + Gen. 3.-Gen. 3. | 1-1 | a-b | -0.596433003 | -1.55622413 + Gen. 3.-Gen. 3. | 1-2 | a-a | -0.270337553 | -2.21968254 + Gen. 3.-Gen. 3. | 1-2 | a-b | -0.204369211 | -1.28191020 + Gen. 3.-Gen. 3. | 1-2 | b-b | 0.392063792 | -0.51106685 + Gen. 3.-Gen. 3. | 2-1 | a-b | -0.326095450 | -2.18472297 + Gen. 3.-Gen. 3. | 2-2 | a-b | 0.065968342 | -1.85611174 + + x1 | conf.high | p.value + ------------------------------------------------------ + 1. Generation-1. Generation | 0.73796686 | 0.90301790 + 1. Generation-1. Generation | 1.83444177 | 0.14363255 + 1. Generation-1. Generation | 1.63344124 | 0.03134353 + 1. Generation-1. Generation | 1.48736660 | 0.01864823 + 1. Generation-1. Generation | 0.24001291 | 0.13718013 + 1. Generation-1. Generation | 1.11325079 | 0.88739662 + 1. Generation-2nd Gen | 1.53706301 | 0.53664579 + 1. Generation-2nd Gen | 1.12797708 | 0.27506689 + 1. Generation-2nd Gen | 0.97338098 | 0.24920918 + 1. Generation-2nd Gen | 1.81764691 | 0.05514222 + 1. Generation-2nd Gen | 1.66460609 | 0.04248493 + 1. Generation-2nd Gen | 1.52430924 | 0.02902072 + 1. Generation-2nd Gen | 0.62120473 | 0.45257642 + 1. Generation-2nd Gen | 1.26570427 | 0.83999896 + 1. Generation-2nd Gen | 1.13465358 | 0.90367675 + 1. Generation-2nd Gen | 0.79088646 | 0.98232953 + 1. Generation-Gen. 3. | 1.60554170 | 0.20171278 + 1. Generation-Gen. 3. | 0.81195588 | 0.93006339 + 1. Generation-Gen. 3. | 0.66588124 | 0.98050430 + 1. Generation-Gen. 3. | 2.22688739 | 0.70198375 + 1. Generation-Gen. 3. | 1.34543004 | 0.35886572 + 1. Generation-Gen. 3. | 1.21707737 | 0.36261199 + 1. Generation-Gen. 3. | 0.29176542 | 0.15647733 + 1. Generation-Gen. 3. | 1.56839840 | 0.67502395 + 1. Generation-Gen. 3. | 0.79348739 | 0.54048037 + 1. Generation-Gen. 3. | 0.47370907 | 0.34728757 + 2nd Gen-1. Generation | 0.78263129 | 0.56309849 + 2nd Gen-1. Generation | 1.77513855 | 0.54455177 + 2nd Gen-1. Generation | 1.64932701 | 0.40284895 + 2nd Gen-1. Generation | 1.16080962 | 0.20445806 + 2nd Gen-1. Generation | -0.02263944 | 0.04421838 + 2nd Gen-1. Generation | 0.86033534 | 0.92518921 + 2nd Gen-2nd Gen | 1.16130148 | 0.94967375 + 2nd Gen-2nd Gen | 1.79136119 | 0.40212900 + 2nd Gen-2nd Gen | 1.66766321 | 0.42224318 + 2nd Gen-2nd Gen | 1.19578623 | 0.24120868 + 2nd Gen-2nd Gen | 0.36236257 | 0.25345095 + 2nd Gen-2nd Gen | 0.88614427 | 0.91295891 + 2nd Gen-Gen. 3. | 1.56478007 | 0.68604372 + 2nd Gen-Gen. 3. | 0.82784164 | 0.57155268 + 2nd Gen-Gen. 3. | 0.33932425 | 0.30459102 + 2nd Gen-Gen. 3. | 2.04966923 | 0.99605963 + 2nd Gen-Gen. 3. | 1.31914431 | 0.92366006 + 2nd Gen-Gen. 3. | 0.88458125 | 0.95403870 + 2nd Gen-Gen. 3. | 0.03884997 | 0.06046852 + 2nd Gen-Gen. 3. | 1.38389486 | 0.57931961 + 2nd Gen-Gen. 3. | 0.55517815 | 0.36352329 + 2nd Gen-Gen. 3. | 0.51739695 | 0.37537612 + Gen. 3.-1. Generation | 0.30630164 | 0.19471031 + Gen. 3.-1. Generation | 1.34453108 | 0.80235400 + Gen. 3.-1. Generation | 1.18484348 | 0.64238056 + Gen. 3.-1. Generation | 1.58026687 | 0.03417506 + Gen. 3.-1. Generation | 1.50794723 | 0.73024157 + Gen. 3.-1. Generation | 2.35401743 | 0.59766558 + Gen. 3.-2nd Gen | 0.68955992 | 0.62110374 + Gen. 3.-2nd Gen | 1.34538864 | 0.62254635 + Gen. 3.-2nd Gen | 1.20867077 | 0.66629196 + Gen. 3.-2nd Gen | 1.61237182 | 0.04654196 + Gen. 3.-2nd Gen | 1.87882752 | 0.96476695 + Gen. 3.-2nd Gen | 2.36220852 | 0.60758359 + Gen. 3.-Gen. 3. | 0.36335812 | 0.22013970 + Gen. 3.-Gen. 3. | 1.67900743 | 0.78350159 + Gen. 3.-Gen. 3. | 0.87317177 | 0.70714448 + Gen. 3.-Gen. 3. | 1.29519443 | 0.39063921 + Gen. 3.-Gen. 3. | 1.53253207 | 0.72817048 + Gen. 3.-Gen. 3. | 1.98804842 | 0.94577605 --- Code print(out1) Output - x1 x2 x3 Contrast conf.low conf.high p.value - 1 1. Generation-2nd Gen 1 a 0.365652460 -0.8057581 1.5370630 0.5366458 - 2 1. Generation-Gen. 3. 1 a 0.630869208 -0.3438033 1.6055417 0.2017128 - 3 2nd Gen-Gen. 3. 1 a 0.265216747 -1.0343466 1.5647801 0.6860437 - 28 1. Generation-2nd Gen 1 b 0.358749064 -0.2558829 0.9733810 0.2492092 - 35 1. Generation-Gen. 3. 1 b -0.008313823 -0.6825089 0.6658812 0.9805043 - 36 2nd Gen-Gen. 3. 1 b -0.367062887 -1.0734500 0.3393243 0.3045910 - 10 1. Generation-2nd Gen 2 a 0.117041717 -1.0316208 1.2657043 0.8399990 - 14 1. Generation-Gen. 3. 2 a -0.421143497 -2.4106854 1.5683984 0.6750239 - 15 2nd Gen-Gen. 3. 2 a -0.538185214 -2.4602653 1.3838949 0.5793196 - 55 1. Generation-2nd Gen 2 b -0.008939479 -0.8087654 0.7908865 0.9823295 - 65 1. Generation-Gen. 3. 2 b -0.429421572 -1.3325522 0.4737091 0.3472876 - 66 2nd Gen-Gen. 3. 2 b -0.420482094 -1.3583611 0.5173970 0.3753761 + # Pairwise comparisons + + x1 | x2 | x3 | Contrast | conf.low | conf.high | p.value + ----------------------------------------------------------------------------------- + 1. Generation-2nd Gen | 1 | a | 0.365652460 | -0.8057581 | 1.5370630 | 0.5366458 + 1. Generation-Gen. 3. | 1 | a | 0.630869208 | -0.3438033 | 1.6055417 | 0.2017128 + 2nd Gen-Gen. 3. | 1 | a | 0.265216747 | -1.0343466 | 1.5647801 | 0.6860437 + 1. Generation-2nd Gen | 1 | b | 0.358749064 | -0.2558829 | 0.9733810 | 0.2492092 + 1. Generation-Gen. 3. | 1 | b | -0.008313823 | -0.6825089 | 0.6658812 | 0.9805043 + 2nd Gen-Gen. 3. | 1 | b | -0.367062887 | -1.0734500 | 0.3393243 | 0.3045910 + 1. Generation-2nd Gen | 2 | a | 0.117041717 | -1.0316208 | 1.2657043 | 0.8399990 + 1. Generation-Gen. 3. | 2 | a | -0.421143497 | -2.4106854 | 1.5683984 | 0.6750239 + 2nd Gen-Gen. 3. | 2 | a | -0.538185214 | -2.4602653 | 1.3838949 | 0.5793196 + 1. Generation-2nd Gen | 2 | b | -0.008939479 | -0.8087654 | 0.7908865 | 0.9823295 + 1. Generation-Gen. 3. | 2 | b | -0.429421572 | -1.3325522 | 0.4737091 | 0.3472876 + 2nd Gen-Gen. 3. | 2 | b | -0.420482094 | -1.3583611 | 0.5173970 | 0.3753761 --- Code print(out) Output - x2 x1 Contrast conf.low conf.high p.value - 4 1-2 1. Generation 0.8077922 -1.643086 3.258670 0.5144427 - 8 1-2 2nd Gen 0.4646082 -1.988355 2.917572 0.7077109 - 13 1-2 Gen. 3. 0.1963394 -2.272963 2.665642 0.8748954 + # Pairwise comparisons + + x2 | x1 | Contrast | conf.low | conf.high | p.value + ------------------------------------------------------------------- + 1-2 | 1. Generation | 0.8077922 | -1.643086 | 3.258670 | 0.5144427 + 1-2 | 2nd Gen | 0.4646082 | -1.988355 | 2.917572 | 0.7077109 + 1-2 | Gen. 3. | 0.1963394 | -2.272963 | 2.665642 | 0.8748954 # test_predictions, engine ggeffects, by-arg and column order Code print(out1) Output - treatment time Contrast conf.low conf.high p.value - 4 coffee-control morning 0.25 -0.03988248 0.539882476 0.09096883 - 8 coffee-control noon -0.30 -0.59562336 -0.004376639 0.04670332 - 13 coffee-control afternoon 0.25 -0.03988248 0.539882476 0.09096883 + # Pairwise comparisons + + treatment | time | Contrast | conf.low | conf.high | p.value + ------------------------------------------------------------------------------- + coffee-control | morning | 0.25 | -0.03988248 | 0.539882476 | 0.09096883 + coffee-control | noon | -0.30 | -0.59562336 | -0.004376639 | 0.04670332 + coffee-control | afternoon | 0.25 | -0.03988248 | 0.539882476 | 0.09096883 + Message + + Contrasts are presented as probabilities (in %-points). --- Code print(out2) Output - treatment time Contrast conf.low conf.high p.value - 1 coffee-control morning 0.25 -0.03988248 0.539882476 0.09096883 - 2 coffee-control noon -0.30 -0.59562336 -0.004376639 0.04670332 - 3 coffee-control afternoon 0.25 -0.03988248 0.539882476 0.09096883 + # Pairwise comparisons + + treatment | time | Contrast | conf.low | conf.high | p.value + ------------------------------------------------------------------------------- + coffee-control | morning | 0.25 | -0.03988248 | 0.539882476 | 0.09096883 + coffee-control | noon | -0.30 | -0.59562336 | -0.004376639 | 0.04670332 + coffee-control | afternoon | 0.25 | -0.03988248 | 0.539882476 | 0.09096883 + Message + + Contrasts are presented as probabilities (in %-points). From a3f2f8a5580ee7510bf6e08e9f51585249546446 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 18:00:27 +0100 Subject: [PATCH 45/51] update tests --- man/print.Rd | 2 +- .../_snaps/test_predictions_ggeffects.md | 313 +++++++----------- 2 files changed, 123 insertions(+), 192 deletions(-) diff --git a/man/print.Rd b/man/print.Rd index fc277543..21b8774c 100644 --- a/man/print.Rd +++ b/man/print.Rd @@ -40,7 +40,7 @@ ... ) -\method{print}{ggcomparisons}(x, collapse_tables = FALSE, ...) +\method{print}{ggcomparisons}(x, collapse_tables = TRUE, ...) \method{print_html}{ggcomparisons}( x, diff --git a/tests/testthat/_snaps/test_predictions_ggeffects.md b/tests/testthat/_snaps/test_predictions_ggeffects.md index 755959b1..1da2857c 100644 --- a/tests/testthat/_snaps/test_predictions_ggeffects.md +++ b/tests/testthat/_snaps/test_predictions_ggeffects.md @@ -5,23 +5,23 @@ Output # Pairwise comparisons - x1 | x2 | Contrast | conf.low | conf.high | p.value - ---------------------------------------------------------------------------------------- - 1. Generation-1. Generation | 1-2 | 0.80811389 | 0.256116187 | 1.3601116 | 0.004554708 - 1. Generation-2nd Gen | 1-1 | 0.36751601 | -0.153281898 | 0.8883139 | 0.164464586 - 1. Generation-2nd Gen | 1-2 | 0.83966736 | 0.287669664 | 1.3916651 | 0.003252247 - 1. Generation-2nd Gen | 2-2 | 0.03155348 | -0.602206670 | 0.6653136 | 0.921464142 - 1. Generation-Gen. 3. | 1-1 | 0.19281288 | -0.347695989 | 0.7333217 | 0.480520805 - 1. Generation-Gen. 3. | 1-2 | 0.38906731 | -0.341834083 | 1.1199687 | 0.293258076 - 1. Generation-Gen. 3. | 2-2 | -0.41904658 | -1.213506965 | 0.3754138 | 0.297653386 - 2nd Gen-1. Generation | 1-2 | 0.44059787 | -0.166181273 | 1.0473770 | 0.152699267 - 2nd Gen-2nd Gen | 1-2 | 0.47215135 | -0.134627796 | 1.0789305 | 0.125708853 - 2nd Gen-Gen. 3. | 1-1 | -0.17470314 | -0.771049769 | 0.4216435 | 0.562181073 - 2nd Gen-Gen. 3. | 1-2 | 0.02155129 | -0.751556922 | 0.7946595 | 0.955978069 - 2nd Gen-Gen. 3. | 2-2 | -0.45060005 | -1.245060442 | 0.3438603 | 0.262971361 - Gen. 3.-1. Generation | 1-2 | 0.61530101 | -0.008478042 | 1.2390801 | 0.053131084 - Gen. 3.-2nd Gen | 1-2 | 0.64685448 | 0.023075435 | 1.2706335 | 0.042263004 - Gen. 3.-Gen. 3. | 1-2 | 0.19625443 | -0.590266826 | 0.9827757 | 0.621451470 + x1 | x2 | Contrast | 95% CI | p + ------------------------------------------------------------------ + 1. Generation-1. Generation | 1-2 | 0.81 | 0.26, 1.36 | 0.005 + 1. Generation-2nd Gen | 1-1 | 0.37 | -0.15, 0.89 | 0.164 + 1. Generation-2nd Gen | 1-2 | 0.84 | 0.29, 1.39 | 0.003 + 1. Generation-2nd Gen | 2-2 | 0.03 | -0.60, 0.67 | 0.921 + 1. Generation-Gen. 3. | 1-1 | 0.19 | -0.35, 0.73 | 0.481 + 1. Generation-Gen. 3. | 1-2 | 0.39 | -0.34, 1.12 | 0.293 + 1. Generation-Gen. 3. | 2-2 | -0.42 | -1.21, 0.38 | 0.298 + 2nd Gen-1. Generation | 1-2 | 0.44 | -0.17, 1.05 | 0.153 + 2nd Gen-2nd Gen | 1-2 | 0.47 | -0.13, 1.08 | 0.126 + 2nd Gen-Gen. 3. | 1-1 | -0.17 | -0.77, 0.42 | 0.562 + 2nd Gen-Gen. 3. | 1-2 | 0.02 | -0.75, 0.79 | 0.956 + 2nd Gen-Gen. 3. | 2-2 | -0.45 | -1.25, 0.34 | 0.263 + Gen. 3.-1. Generation | 1-2 | 0.62 | -0.01, 1.24 | 0.053 + Gen. 3.-2nd Gen | 1-2 | 0.65 | 0.02, 1.27 | 0.042 + Gen. 3.-Gen. 3. | 1-2 | 0.20 | -0.59, 0.98 | 0.621 --- @@ -30,14 +30,14 @@ Output # Pairwise comparisons - x1 | x2 | Contrast | conf.low | conf.high | p.value - ----------------------------------------------------------------------------- - 1. Generation-2nd Gen | 1 | 0.36751601 | -0.1532819 | 0.8883139 | 0.1644646 - 1. Generation-Gen. 3. | 1 | 0.19281288 | -0.3476960 | 0.7333217 | 0.4805208 - 2nd Gen-Gen. 3. | 1 | -0.17470314 | -0.7710498 | 0.4216435 | 0.5621811 - 1. Generation-2nd Gen | 2 | 0.03155348 | -0.6022067 | 0.6653136 | 0.9214641 - 1. Generation-Gen. 3. | 2 | -0.41904658 | -1.2135070 | 0.3754138 | 0.2976534 - 2nd Gen-Gen. 3. | 2 | -0.45060005 | -1.2450604 | 0.3438603 | 0.2629714 + x1 | x2 | Contrast | 95% CI | p + ----------------------------------------------------------- + 1. Generation-2nd Gen | 1 | 0.37 | -0.15, 0.89 | 0.164 + 1. Generation-Gen. 3. | 1 | 0.19 | -0.35, 0.73 | 0.481 + 2nd Gen-Gen. 3. | 1 | -0.17 | -0.77, 0.42 | 0.562 + 1. Generation-2nd Gen | 2 | 0.03 | -0.60, 0.67 | 0.921 + 1. Generation-Gen. 3. | 2 | -0.42 | -1.21, 0.38 | 0.298 + 2nd Gen-Gen. 3. | 2 | -0.45 | -1.25, 0.34 | 0.263 --- @@ -46,143 +46,74 @@ Output # Pairwise comparisons - x1 | x2 | x3 | Contrast | conf.low - -------------------------------------------------------------------- - 1. Generation-1. Generation | 1-1 | a-b | 0.042750027 | -0.65246681 - 1. Generation-1. Generation | 1-2 | a-a | 0.781675151 | -0.27109146 - 1. Generation-1. Generation | 1-2 | a-b | 0.855921569 | 0.07840189 - 1. Generation-1. Generation | 1-2 | b-b | 0.813171542 | 0.13897648 - 1. Generation-1. Generation | 2-1 | a-b | -0.738925124 | -1.71786316 - 1. Generation-1. Generation | 2-2 | a-b | 0.074246418 | -0.96475795 - 1. Generation-2nd Gen | 1-1 | a-a | 0.365652460 | -0.80575809 - 1. Generation-2nd Gen | 1-1 | a-b | 0.401499092 | -0.32497889 - 1. Generation-2nd Gen | 1-1 | b-b | 0.358749064 | -0.25588286 - 1. Generation-2nd Gen | 1-2 | a-a | 0.898716868 | -0.02021317 - 1. Generation-2nd Gen | 1-2 | a-b | 0.846982091 | 0.02935810 - 1. Generation-2nd Gen | 1-2 | b-b | 0.804232064 | 0.08415489 - 1. Generation-2nd Gen | 2-1 | a-b | -0.380176060 | -1.38155685 - 1. Generation-2nd Gen | 2-2 | a-a | 0.117041717 | -1.03162083 - 1. Generation-2nd Gen | 2-2 | a-b | 0.065306939 | -1.00403970 - 1. Generation-2nd Gen | 2-2 | b-b | -0.008939479 | -0.80876541 - 1. Generation-Gen. 3. | 1-1 | a-a | 0.630869208 | -0.34380329 - 1. Generation-Gen. 3. | 1-1 | a-b | 0.034436204 | -0.74308347 - 1. Generation-Gen. 3. | 1-1 | b-b | -0.008313823 | -0.68250888 - 1. Generation-Gen. 3. | 1-2 | a-a | 0.360531654 | -1.50582408 - 1. Generation-Gen. 3. | 1-2 | a-b | 0.426499997 | -0.49243004 - 1. Generation-Gen. 3. | 1-2 | b-b | 0.383749970 | -0.44957743 - 1. Generation-Gen. 3. | 2-1 | a-b | -0.747238947 | -1.78624332 - 1. Generation-Gen. 3. | 2-2 | a-a | -0.421143497 | -2.41068539 - 1. Generation-Gen. 3. | 2-2 | a-b | -0.355175155 | -1.50383770 - 1. Generation-Gen. 3. | 2-2 | b-b | -0.429421572 | -1.33255221 - 2nd Gen-1. Generation | 1-1 | a-b | -0.322902433 | -1.42843616 - 2nd Gen-1. Generation | 1-2 | a-a | 0.416022691 | -0.94309317 - 2nd Gen-1. Generation | 1-2 | a-b | 0.490269109 | -0.66878879 - 2nd Gen-1. Generation | 1-2 | b-b | 0.454422478 | -0.25196466 - 2nd Gen-1. Generation | 2-1 | a-b | -0.855966841 | -1.68929424 - 2nd Gen-1. Generation | 2-2 | a-b | -0.042795299 | -0.94592594 - 2nd Gen-2nd Gen | 1-1 | a-b | 0.035846631 | -1.08960822 - 2nd Gen-2nd Gen | 1-2 | a-a | 0.533064408 | -0.72523237 - 2nd Gen-2nd Gen | 1-2 | a-b | 0.481329630 | -0.70500395 - 2nd Gen-2nd Gen | 1-2 | b-b | 0.445482999 | -0.30482024 - 2nd Gen-2nd Gen | 2-1 | a-b | -0.497217776 | -1.35679812 - 2nd Gen-2nd Gen | 2-2 | a-b | -0.051734777 | -0.98961382 - 2nd Gen-Gen. 3. | 1-1 | a-a | 0.265216747 | -1.03434658 - 2nd Gen-Gen. 3. | 1-1 | a-b | -0.331216256 | -1.49027415 - 2nd Gen-Gen. 3. | 1-1 | b-b | -0.367062887 | -1.07345003 - 2nd Gen-Gen. 3. | 1-2 | a-a | -0.005120806 | -2.05991084 - 2nd Gen-Gen. 3. | 1-2 | a-b | 0.060847536 | -1.19744924 - 2nd Gen-Gen. 3. | 1-2 | b-b | 0.025000905 | -0.83457944 - 2nd Gen-Gen. 3. | 2-1 | a-b | -0.864280664 | -1.76741130 - 2nd Gen-Gen. 3. | 2-2 | a-a | -0.538185214 | -2.46026529 - 2nd Gen-Gen. 3. | 2-2 | a-b | -0.472216871 | -1.49961189 - 2nd Gen-Gen. 3. | 2-2 | b-b | -0.420482094 | -1.35836114 - Gen. 3.-1. Generation | 1-1 | a-b | -0.588119181 | -1.48254000 - Gen. 3.-1. Generation | 1-2 | a-a | 0.150805944 | -1.04291919 - Gen. 3.-1. Generation | 1-2 | a-b | 0.225052361 | -0.73473876 - Gen. 3.-1. Generation | 1-2 | b-b | 0.821485365 | 0.06270386 - Gen. 3.-1. Generation | 2-1 | a-b | -0.317781627 | -2.14351048 - Gen. 3.-1. Generation | 2-2 | a-b | 0.495389915 | -1.36323760 - Gen. 3.-2nd Gen | 1-1 | a-b | -0.229370116 | -1.14830016 - Gen. 3.-2nd Gen | 1-2 | a-a | 0.267847660 | -0.80969332 - Gen. 3.-2nd Gen | 1-2 | a-b | 0.216112883 | -0.77644500 - Gen. 3.-2nd Gen | 1-2 | b-b | 0.812545886 | 0.01271995 - Gen. 3.-2nd Gen | 2-1 | a-b | 0.040967437 | -1.79689264 - Gen. 3.-2nd Gen | 2-2 | a-b | 0.486450436 | -1.38930765 - Gen. 3.-Gen. 3. | 1-1 | a-b | -0.596433003 | -1.55622413 - Gen. 3.-Gen. 3. | 1-2 | a-a | -0.270337553 | -2.21968254 - Gen. 3.-Gen. 3. | 1-2 | a-b | -0.204369211 | -1.28191020 - Gen. 3.-Gen. 3. | 1-2 | b-b | 0.392063792 | -0.51106685 - Gen. 3.-Gen. 3. | 2-1 | a-b | -0.326095450 | -2.18472297 - Gen. 3.-Gen. 3. | 2-2 | a-b | 0.065968342 | -1.85611174 - - x1 | conf.high | p.value - ------------------------------------------------------ - 1. Generation-1. Generation | 0.73796686 | 0.90301790 - 1. Generation-1. Generation | 1.83444177 | 0.14363255 - 1. Generation-1. Generation | 1.63344124 | 0.03134353 - 1. Generation-1. Generation | 1.48736660 | 0.01864823 - 1. Generation-1. Generation | 0.24001291 | 0.13718013 - 1. Generation-1. Generation | 1.11325079 | 0.88739662 - 1. Generation-2nd Gen | 1.53706301 | 0.53664579 - 1. Generation-2nd Gen | 1.12797708 | 0.27506689 - 1. Generation-2nd Gen | 0.97338098 | 0.24920918 - 1. Generation-2nd Gen | 1.81764691 | 0.05514222 - 1. Generation-2nd Gen | 1.66460609 | 0.04248493 - 1. Generation-2nd Gen | 1.52430924 | 0.02902072 - 1. Generation-2nd Gen | 0.62120473 | 0.45257642 - 1. Generation-2nd Gen | 1.26570427 | 0.83999896 - 1. Generation-2nd Gen | 1.13465358 | 0.90367675 - 1. Generation-2nd Gen | 0.79088646 | 0.98232953 - 1. Generation-Gen. 3. | 1.60554170 | 0.20171278 - 1. Generation-Gen. 3. | 0.81195588 | 0.93006339 - 1. Generation-Gen. 3. | 0.66588124 | 0.98050430 - 1. Generation-Gen. 3. | 2.22688739 | 0.70198375 - 1. Generation-Gen. 3. | 1.34543004 | 0.35886572 - 1. Generation-Gen. 3. | 1.21707737 | 0.36261199 - 1. Generation-Gen. 3. | 0.29176542 | 0.15647733 - 1. Generation-Gen. 3. | 1.56839840 | 0.67502395 - 1. Generation-Gen. 3. | 0.79348739 | 0.54048037 - 1. Generation-Gen. 3. | 0.47370907 | 0.34728757 - 2nd Gen-1. Generation | 0.78263129 | 0.56309849 - 2nd Gen-1. Generation | 1.77513855 | 0.54455177 - 2nd Gen-1. Generation | 1.64932701 | 0.40284895 - 2nd Gen-1. Generation | 1.16080962 | 0.20445806 - 2nd Gen-1. Generation | -0.02263944 | 0.04421838 - 2nd Gen-1. Generation | 0.86033534 | 0.92518921 - 2nd Gen-2nd Gen | 1.16130148 | 0.94967375 - 2nd Gen-2nd Gen | 1.79136119 | 0.40212900 - 2nd Gen-2nd Gen | 1.66766321 | 0.42224318 - 2nd Gen-2nd Gen | 1.19578623 | 0.24120868 - 2nd Gen-2nd Gen | 0.36236257 | 0.25345095 - 2nd Gen-2nd Gen | 0.88614427 | 0.91295891 - 2nd Gen-Gen. 3. | 1.56478007 | 0.68604372 - 2nd Gen-Gen. 3. | 0.82784164 | 0.57155268 - 2nd Gen-Gen. 3. | 0.33932425 | 0.30459102 - 2nd Gen-Gen. 3. | 2.04966923 | 0.99605963 - 2nd Gen-Gen. 3. | 1.31914431 | 0.92366006 - 2nd Gen-Gen. 3. | 0.88458125 | 0.95403870 - 2nd Gen-Gen. 3. | 0.03884997 | 0.06046852 - 2nd Gen-Gen. 3. | 1.38389486 | 0.57931961 - 2nd Gen-Gen. 3. | 0.55517815 | 0.36352329 - 2nd Gen-Gen. 3. | 0.51739695 | 0.37537612 - Gen. 3.-1. Generation | 0.30630164 | 0.19471031 - Gen. 3.-1. Generation | 1.34453108 | 0.80235400 - Gen. 3.-1. Generation | 1.18484348 | 0.64238056 - Gen. 3.-1. Generation | 1.58026687 | 0.03417506 - Gen. 3.-1. Generation | 1.50794723 | 0.73024157 - Gen. 3.-1. Generation | 2.35401743 | 0.59766558 - Gen. 3.-2nd Gen | 0.68955992 | 0.62110374 - Gen. 3.-2nd Gen | 1.34538864 | 0.62254635 - Gen. 3.-2nd Gen | 1.20867077 | 0.66629196 - Gen. 3.-2nd Gen | 1.61237182 | 0.04654196 - Gen. 3.-2nd Gen | 1.87882752 | 0.96476695 - Gen. 3.-2nd Gen | 2.36220852 | 0.60758359 - Gen. 3.-Gen. 3. | 0.36335812 | 0.22013970 - Gen. 3.-Gen. 3. | 1.67900743 | 0.78350159 - Gen. 3.-Gen. 3. | 0.87317177 | 0.70714448 - Gen. 3.-Gen. 3. | 1.29519443 | 0.39063921 - Gen. 3.-Gen. 3. | 1.53253207 | 0.72817048 - Gen. 3.-Gen. 3. | 1.98804842 | 0.94577605 + x1 | x2 | x3 | Contrast | 95% CI | p + ------------------------------------------------------------------------- + 1. Generation-1. Generation | 1-1 | a-b | 0.04 | -0.65, 0.74 | 0.903 + 1. Generation-1. Generation | 1-2 | a-a | 0.78 | -0.27, 1.83 | 0.144 + 1. Generation-1. Generation | 1-2 | a-b | 0.86 | 0.08, 1.63 | 0.031 + 1. Generation-1. Generation | 1-2 | b-b | 0.81 | 0.14, 1.49 | 0.019 + 1. Generation-1. Generation | 2-1 | a-b | -0.74 | -1.72, 0.24 | 0.137 + 1. Generation-1. Generation | 2-2 | a-b | 0.07 | -0.96, 1.11 | 0.887 + 1. Generation-2nd Gen | 1-1 | a-a | 0.37 | -0.81, 1.54 | 0.537 + 1. Generation-2nd Gen | 1-1 | a-b | 0.40 | -0.32, 1.13 | 0.275 + 1. Generation-2nd Gen | 1-1 | b-b | 0.36 | -0.26, 0.97 | 0.249 + 1. Generation-2nd Gen | 1-2 | a-a | 0.90 | -0.02, 1.82 | 0.055 + 1. Generation-2nd Gen | 1-2 | a-b | 0.85 | 0.03, 1.66 | 0.042 + 1. Generation-2nd Gen | 1-2 | b-b | 0.80 | 0.08, 1.52 | 0.029 + 1. Generation-2nd Gen | 2-1 | a-b | -0.38 | -1.38, 0.62 | 0.453 + 1. Generation-2nd Gen | 2-2 | a-a | 0.12 | -1.03, 1.27 | 0.840 + 1. Generation-2nd Gen | 2-2 | a-b | 0.07 | -1.00, 1.13 | 0.904 + 1. Generation-2nd Gen | 2-2 | b-b | -0.01 | -0.81, 0.79 | 0.982 + 1. Generation-Gen. 3. | 1-1 | a-a | 0.63 | -0.34, 1.61 | 0.202 + 1. Generation-Gen. 3. | 1-1 | a-b | 0.03 | -0.74, 0.81 | 0.930 + 1. Generation-Gen. 3. | 1-1 | b-b | -0.01 | -0.68, 0.67 | 0.981 + 1. Generation-Gen. 3. | 1-2 | a-a | 0.36 | -1.51, 2.23 | 0.702 + 1. Generation-Gen. 3. | 1-2 | a-b | 0.43 | -0.49, 1.35 | 0.359 + 1. Generation-Gen. 3. | 1-2 | b-b | 0.38 | -0.45, 1.22 | 0.363 + 1. Generation-Gen. 3. | 2-1 | a-b | -0.75 | -1.79, 0.29 | 0.156 + 1. Generation-Gen. 3. | 2-2 | a-a | -0.42 | -2.41, 1.57 | 0.675 + 1. Generation-Gen. 3. | 2-2 | a-b | -0.36 | -1.50, 0.79 | 0.540 + 1. Generation-Gen. 3. | 2-2 | b-b | -0.43 | -1.33, 0.47 | 0.347 + 2nd Gen-1. Generation | 1-1 | a-b | -0.32 | -1.43, 0.78 | 0.563 + 2nd Gen-1. Generation | 1-2 | a-a | 0.42 | -0.94, 1.78 | 0.545 + 2nd Gen-1. Generation | 1-2 | a-b | 0.49 | -0.67, 1.65 | 0.403 + 2nd Gen-1. Generation | 1-2 | b-b | 0.45 | -0.25, 1.16 | 0.204 + 2nd Gen-1. Generation | 2-1 | a-b | -0.86 | -1.69, -0.02 | 0.044 + 2nd Gen-1. Generation | 2-2 | a-b | -0.04 | -0.95, 0.86 | 0.925 + 2nd Gen-2nd Gen | 1-1 | a-b | 0.04 | -1.09, 1.16 | 0.950 + 2nd Gen-2nd Gen | 1-2 | a-a | 0.53 | -0.73, 1.79 | 0.402 + 2nd Gen-2nd Gen | 1-2 | a-b | 0.48 | -0.71, 1.67 | 0.422 + 2nd Gen-2nd Gen | 1-2 | b-b | 0.45 | -0.30, 1.20 | 0.241 + 2nd Gen-2nd Gen | 2-1 | a-b | -0.50 | -1.36, 0.36 | 0.253 + 2nd Gen-2nd Gen | 2-2 | a-b | -0.05 | -0.99, 0.89 | 0.913 + 2nd Gen-Gen. 3. | 1-1 | a-a | 0.27 | -1.03, 1.56 | 0.686 + 2nd Gen-Gen. 3. | 1-1 | a-b | -0.33 | -1.49, 0.83 | 0.572 + 2nd Gen-Gen. 3. | 1-1 | b-b | -0.37 | -1.07, 0.34 | 0.305 + 2nd Gen-Gen. 3. | 1-2 | a-a | -0.01 | -2.06, 2.05 | 0.996 + 2nd Gen-Gen. 3. | 1-2 | a-b | 0.06 | -1.20, 1.32 | 0.924 + 2nd Gen-Gen. 3. | 1-2 | b-b | 0.03 | -0.83, 0.88 | 0.954 + 2nd Gen-Gen. 3. | 2-1 | a-b | -0.86 | -1.77, 0.04 | 0.060 + 2nd Gen-Gen. 3. | 2-2 | a-a | -0.54 | -2.46, 1.38 | 0.579 + 2nd Gen-Gen. 3. | 2-2 | a-b | -0.47 | -1.50, 0.56 | 0.364 + 2nd Gen-Gen. 3. | 2-2 | b-b | -0.42 | -1.36, 0.52 | 0.375 + Gen. 3.-1. Generation | 1-1 | a-b | -0.59 | -1.48, 0.31 | 0.195 + Gen. 3.-1. Generation | 1-2 | a-a | 0.15 | -1.04, 1.34 | 0.802 + Gen. 3.-1. Generation | 1-2 | a-b | 0.23 | -0.73, 1.18 | 0.642 + Gen. 3.-1. Generation | 1-2 | b-b | 0.82 | 0.06, 1.58 | 0.034 + Gen. 3.-1. Generation | 2-1 | a-b | -0.32 | -2.14, 1.51 | 0.730 + Gen. 3.-1. Generation | 2-2 | a-b | 0.50 | -1.36, 2.35 | 0.598 + Gen. 3.-2nd Gen | 1-1 | a-b | -0.23 | -1.15, 0.69 | 0.621 + Gen. 3.-2nd Gen | 1-2 | a-a | 0.27 | -0.81, 1.35 | 0.623 + Gen. 3.-2nd Gen | 1-2 | a-b | 0.22 | -0.78, 1.21 | 0.666 + Gen. 3.-2nd Gen | 1-2 | b-b | 0.81 | 0.01, 1.61 | 0.047 + Gen. 3.-2nd Gen | 2-1 | a-b | 0.04 | -1.80, 1.88 | 0.965 + Gen. 3.-2nd Gen | 2-2 | a-b | 0.49 | -1.39, 2.36 | 0.608 + Gen. 3.-Gen. 3. | 1-1 | a-b | -0.60 | -1.56, 0.36 | 0.220 + Gen. 3.-Gen. 3. | 1-2 | a-a | -0.27 | -2.22, 1.68 | 0.784 + Gen. 3.-Gen. 3. | 1-2 | a-b | -0.20 | -1.28, 0.87 | 0.707 + Gen. 3.-Gen. 3. | 1-2 | b-b | 0.39 | -0.51, 1.30 | 0.391 + Gen. 3.-Gen. 3. | 2-1 | a-b | -0.33 | -2.18, 1.53 | 0.728 + Gen. 3.-Gen. 3. | 2-2 | a-b | 0.07 | -1.86, 1.99 | 0.946 --- @@ -191,20 +122,20 @@ Output # Pairwise comparisons - x1 | x2 | x3 | Contrast | conf.low | conf.high | p.value - ----------------------------------------------------------------------------------- - 1. Generation-2nd Gen | 1 | a | 0.365652460 | -0.8057581 | 1.5370630 | 0.5366458 - 1. Generation-Gen. 3. | 1 | a | 0.630869208 | -0.3438033 | 1.6055417 | 0.2017128 - 2nd Gen-Gen. 3. | 1 | a | 0.265216747 | -1.0343466 | 1.5647801 | 0.6860437 - 1. Generation-2nd Gen | 1 | b | 0.358749064 | -0.2558829 | 0.9733810 | 0.2492092 - 1. Generation-Gen. 3. | 1 | b | -0.008313823 | -0.6825089 | 0.6658812 | 0.9805043 - 2nd Gen-Gen. 3. | 1 | b | -0.367062887 | -1.0734500 | 0.3393243 | 0.3045910 - 1. Generation-2nd Gen | 2 | a | 0.117041717 | -1.0316208 | 1.2657043 | 0.8399990 - 1. Generation-Gen. 3. | 2 | a | -0.421143497 | -2.4106854 | 1.5683984 | 0.6750239 - 2nd Gen-Gen. 3. | 2 | a | -0.538185214 | -2.4602653 | 1.3838949 | 0.5793196 - 1. Generation-2nd Gen | 2 | b | -0.008939479 | -0.8087654 | 0.7908865 | 0.9823295 - 1. Generation-Gen. 3. | 2 | b | -0.429421572 | -1.3325522 | 0.4737091 | 0.3472876 - 2nd Gen-Gen. 3. | 2 | b | -0.420482094 | -1.3583611 | 0.5173970 | 0.3753761 + x1 | x2 | x3 | Contrast | 95% CI | p + ---------------------------------------------------------------- + 1. Generation-2nd Gen | 1 | a | 0.37 | -0.81, 1.54 | 0.537 + 1. Generation-Gen. 3. | 1 | a | 0.63 | -0.34, 1.61 | 0.202 + 2nd Gen-Gen. 3. | 1 | a | 0.27 | -1.03, 1.56 | 0.686 + 1. Generation-2nd Gen | 1 | b | 0.36 | -0.26, 0.97 | 0.249 + 1. Generation-Gen. 3. | 1 | b | -0.01 | -0.68, 0.67 | 0.981 + 2nd Gen-Gen. 3. | 1 | b | -0.37 | -1.07, 0.34 | 0.305 + 1. Generation-2nd Gen | 2 | a | 0.12 | -1.03, 1.27 | 0.840 + 1. Generation-Gen. 3. | 2 | a | -0.42 | -2.41, 1.57 | 0.675 + 2nd Gen-Gen. 3. | 2 | a | -0.54 | -2.46, 1.38 | 0.579 + 1. Generation-2nd Gen | 2 | b | -0.01 | -0.81, 0.79 | 0.982 + 1. Generation-Gen. 3. | 2 | b | -0.43 | -1.33, 0.47 | 0.347 + 2nd Gen-Gen. 3. | 2 | b | -0.42 | -1.36, 0.52 | 0.375 --- @@ -213,11 +144,11 @@ Output # Pairwise comparisons - x2 | x1 | Contrast | conf.low | conf.high | p.value - ------------------------------------------------------------------- - 1-2 | 1. Generation | 0.8077922 | -1.643086 | 3.258670 | 0.5144427 - 1-2 | 2nd Gen | 0.4646082 | -1.988355 | 2.917572 | 0.7077109 - 1-2 | Gen. 3. | 0.1963394 | -2.272963 | 2.665642 | 0.8748954 + x2 | x1 | Contrast | 95% CI | p + ---------------------------------------------------- + 1-2 | 1. Generation | 0.81 | -1.64, 3.26 | 0.514 + 1-2 | 2nd Gen | 0.46 | -1.99, 2.92 | 0.708 + 1-2 | Gen. 3. | 0.20 | -2.27, 2.67 | 0.875 # test_predictions, engine ggeffects, by-arg and column order @@ -226,11 +157,11 @@ Output # Pairwise comparisons - treatment | time | Contrast | conf.low | conf.high | p.value - ------------------------------------------------------------------------------- - coffee-control | morning | 0.25 | -0.03988248 | 0.539882476 | 0.09096883 - coffee-control | noon | -0.30 | -0.59562336 | -0.004376639 | 0.04670332 - coffee-control | afternoon | 0.25 | -0.03988248 | 0.539882476 | 0.09096883 + treatment | time | Contrast | 95% CI | p + ------------------------------------------------------------ + coffee-control | morning | 0.25 | -0.04, 0.54 | 0.091 + coffee-control | noon | -0.30 | -0.60, 0.00 | 0.047 + coffee-control | afternoon | 0.25 | -0.04, 0.54 | 0.091 Message Contrasts are presented as probabilities (in %-points). @@ -242,11 +173,11 @@ Output # Pairwise comparisons - treatment | time | Contrast | conf.low | conf.high | p.value - ------------------------------------------------------------------------------- - coffee-control | morning | 0.25 | -0.03988248 | 0.539882476 | 0.09096883 - coffee-control | noon | -0.30 | -0.59562336 | -0.004376639 | 0.04670332 - coffee-control | afternoon | 0.25 | -0.03988248 | 0.539882476 | 0.09096883 + treatment | time | Contrast | 95% CI | p + ------------------------------------------------------------ + coffee-control | morning | 0.25 | -0.04, 0.54 | 0.091 + coffee-control | noon | -0.30 | -0.60, 0.00 | 0.047 + coffee-control | afternoon | 0.25 | -0.04, 0.54 | 0.091 Message Contrasts are presented as probabilities (in %-points). From 81a8564a8ebeae3f9642fd1df361bb70cb159eed Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 18:01:20 +0100 Subject: [PATCH 46/51] snaps --- .../_snaps/test_predictions_emmeans.md | 745 +++++++++--------- 1 file changed, 355 insertions(+), 390 deletions(-) diff --git a/tests/testthat/_snaps/test_predictions_emmeans.md b/tests/testthat/_snaps/test_predictions_emmeans.md index 1299d9a2..1a296418 100644 --- a/tests/testthat/_snaps/test_predictions_emmeans.md +++ b/tests/testthat/_snaps/test_predictions_emmeans.md @@ -3,283 +3,286 @@ Code print(test_predictions(m, terms = c("x1", "x2", "x3"), engine = "emmeans")) Output - x1 x2 x3 Contrast conf.low conf.high p.value - 1 0-0 1-1 a-c 0.13163495 -0.690201472 0.95347138 0.750594354 - 2 0-0 1-1 a-d -0.76930639 -1.724194022 0.18558125 0.112731097 - 3 0-0 1-1 b-a 0.16896698 -0.702722181 1.04065614 0.700528679 - 4 0-0 1-1 b-c 0.30060193 -0.521234490 1.12243836 0.468551731 - 5 0-0 1-1 b-d -0.60033940 -1.555227040 0.35454823 0.214348514 - 6 0-0 1-1 d-c 0.90094134 -0.008664899 1.81054758 0.052166952 - 7 0-0 1-2 a-a 0.43925735 -0.432431814 1.31094651 0.318739903 - 8 0-0 1-2 a-c 0.30631049 -0.648577150 1.26119812 0.524813950 - 9 0-0 1-2 a-d -0.21490846 -1.036744880 0.60692797 0.604007652 - 10 0-0 1-2 b-a 0.60822433 -0.263464832 1.47991349 0.168678551 - 11 0-0 1-2 b-b 0.14767403 -0.874472118 1.16982018 0.774324482 - 12 0-0 1-2 b-c 0.47527747 -0.479610168 1.43016510 0.324676141 - 13 0-0 1-2 b-d -0.04594147 -0.867777898 0.77589495 0.911643044 - 14 0-0 1-2 c-c 0.17467553 -0.734930704 1.08428177 0.703180800 - 15 0-0 1-2 d-c 1.07561687 0.044220346 2.10701340 0.041174879 - 16 0-0 1-2 d-d 0.55439793 -0.355208306 1.46400417 0.228541319 - 17 0-0 1-3 a-a -0.32583114 -1.169840547 0.51817826 0.444342507 - 18 0-0 1-3 a-c 0.15483144 -0.752451406 1.06211429 0.734879276 - 19 0-0 1-3 a-d -0.73315910 -1.755305243 0.28898705 0.157223342 - 20 0-0 1-3 b-a -0.15686416 -1.000873565 0.68714524 0.712289755 - 21 0-0 1-3 b-b 0.02579972 -0.818209680 0.86980913 0.951613361 - 22 0-0 1-3 b-c 0.32379842 -0.583484424 1.23108127 0.479381322 - 23 0-0 1-3 b-d -0.56419211 -1.586338262 0.45795403 0.275090117 - 24 0-0 1-3 c-c 0.02319649 -0.836300617 0.88269359 0.957273685 - 25 0-0 1-3 d-c 0.92413783 -0.063349166 1.91162482 0.066197517 - 26 0-0 1-3 d-d 0.03614729 -1.057813927 1.13010851 0.947701918 - 27 0-0 2-1 a-c -0.30762240 -1.129458822 0.51421403 0.458266039 - 28 0-0 2-1 a-d -1.20856374 -2.163451371 -0.25367610 0.013805181 - 29 0-0 2-1 b-a 0.02129295 -1.000853194 1.04343910 0.967014268 - 30 0-0 2-1 b-c 0.15292790 -0.827049573 1.13290538 0.756799379 - 31 0-0 2-1 b-d -0.74801343 -1.841974652 0.34594778 0.177272250 - 32 0-0 2-1 d-c 0.34654341 -0.422214175 1.11530099 0.372120406 - 33 0-0 2-2 a-c -0.13294686 -1.087834499 0.82194077 0.782305611 - 34 0-0 2-2 a-d -0.65416580 -1.476002229 0.16767062 0.117043194 - 35 0-0 2-2 b-a 0.46055030 -0.561595845 1.48269645 0.372343992 - 36 0-0 2-2 b-c 0.32760344 -0.766357779 1.42156466 0.552655889 - 37 0-0 2-2 b-d -0.19361550 -1.173592981 0.78636198 0.695053822 - 38 0-0 2-2 d-c 0.52121894 -0.388387297 1.43082518 0.257344944 - 39 0-0 2-3 a-a -0.76508849 -1.609097896 0.07892091 0.074966487 - 40 0-0 2-3 a-c -0.28442591 -1.191708755 0.62285694 0.534252260 - 41 0-0 2-3 a-d -1.17241645 -2.194562593 -0.15027030 0.025135305 - 42 0-0 2-3 b-a -0.30453819 -1.303183584 0.69410720 0.545420420 - 43 0-0 2-3 b-b -0.12187431 -1.120519700 0.87677109 0.808611441 - 44 0-0 2-3 b-c 0.17612439 -0.876540279 1.22878907 0.739876326 - 45 0-0 2-3 b-d -0.71186614 -1.865002517 0.44127023 0.222669750 - 46 0-0 2-3 c-c -0.15147905 -1.138966039 0.83600795 0.760805663 - 47 0-0 2-3 d-c 0.36973990 -0.489757210 1.22923700 0.394259449 - 48 0-0 2-3 d-d -0.51825064 -1.498228119 0.46172684 0.295552269 - 49 0-0 3-1 a-c 0.45746610 -0.334951082 1.24988327 0.253830870 - 50 0-0 3-1 a-d -0.44347524 -1.373163509 0.48621302 0.345094438 - 51 0-0 3-1 b-a 0.14316726 -0.700842143 0.98717666 0.736413237 - 52 0-0 3-1 b-c 0.27480221 -0.517614966 1.06721939 0.491863393 - 53 0-0 3-1 b-d -0.62613913 -1.555827393 0.30354914 0.183792208 - 54 0-0 3-1 d-c 0.86479405 -0.115183429 1.84477153 0.082846141 - 55 0-0 3-2 a-c 0.63214163 -0.297546636 1.56182990 0.179673403 - 56 0-0 3-2 a-d 0.11092269 -0.681494489 0.90333987 0.781159612 - 57 0-0 3-2 b-a 0.58242461 -0.261584794 1.42643401 0.173359595 - 58 0-0 3-2 b-c 0.44947775 -0.480210521 1.37916601 0.338643081 - 59 0-0 3-2 b-d -0.07174120 -0.864158374 0.72067598 0.857384957 - 60 0-0 3-2 d-c 1.03946958 -0.054491635 2.13343080 0.062237266 - 61 0-0 3-3 a-c 0.48066258 -0.400059868 1.36138504 0.280483655 - 62 0-0 3-3 a-d -0.40732795 -1.405973346 0.59131744 0.419119941 - 63 0-0 3-3 b-a -0.18266388 -0.998054433 0.63272666 0.656739665 - 64 0-0 3-3 b-c 0.29799870 -0.582723752 1.17872115 0.502421571 - 65 0-0 3-3 b-d -0.58999184 -1.588637230 0.40865356 0.243001711 - 66 0-0 3-3 d-c 0.88799054 -0.164674135 1.94065521 0.097043346 - 67 0-1 1-1 a-a 0.88567883 -0.136467318 1.90782498 0.088453807 - 68 0-1 1-1 a-c 1.00283178 -0.740546546 2.74621011 0.255532047 - 69 0-1 1-1 a-d -1.04667707 -2.172022940 0.07866880 0.067845130 - 70 0-1 1-1 b-a 1.05464581 0.032499664 2.07679196 0.043315720 - 71 0-1 1-1 b-b 1.60147629 -0.141902031 3.34485462 0.071237521 - 72 0-1 1-1 b-c 1.17179876 -0.571579564 2.91517709 0.184663062 - 73 0-1 1-1 b-d -0.87771009 -2.003055958 0.24763578 0.124482469 - 74 0-1 1-1 c-c 0.87119683 -0.847797383 2.59019104 0.315989641 - 75 0-1 1-1 d-c 1.77213817 -0.014293021 3.55856935 0.051814728 - 76 0-1 1-1 d-d -0.27737068 -1.468324808 0.91358344 0.644076546 - 77 0-1 1-2 a-a 1.26621451 -0.477163811 3.00959284 0.152134712 - 78 0-1 1-2 a-c -0.05231632 -1.795694647 1.69106201 0.952497867 - 79 0-1 1-2 a-d -0.39404188 -1.701575624 0.91349187 0.550148012 - 80 0-1 1-2 b-a 1.43518150 -0.308196829 3.17855982 0.105225266 - 81 0-1 1-2 b-b -0.18978174 -1.497315480 1.11775201 0.773306525 - 82 0-1 1-2 b-c 0.11665066 -1.626727665 1.86002899 0.894336671 - 83 0-1 1-2 b-d -0.22507490 -1.532608642 1.08245885 0.732664925 - 84 0-1 1-2 c-c -0.18395127 -1.902945485 1.53504294 0.831795575 - 85 0-1 1-2 d-c 0.71699007 -1.069441122 2.50342125 0.426570437 - 86 0-1 1-2 d-d 0.37526451 -0.989144849 1.73967386 0.585444281 - 87 0-1 1-3 a-a 0.95639292 -0.786985406 2.69977125 0.278019195 - 88 0-1 1-3 a-c -0.55502645 -2.298404781 1.18835187 0.527936397 - 89 0-1 1-3 a-d 0.47734234 -1.266035982 2.22072067 0.587126185 - 90 0-1 1-3 b-a 1.12535990 -0.618018424 2.86873823 0.202474036 - 91 0-1 1-3 b-b 0.80203433 -0.323311545 1.92738020 0.159852023 - 92 0-1 1-3 b-c -0.38605947 -2.129437799 1.35731885 0.660434301 - 93 0-1 1-3 b-d 0.64630933 -1.097069000 2.38968765 0.462571196 - 94 0-1 1-3 c-c -0.68666141 -2.405655618 1.03233280 0.428751592 - 95 0-1 1-3 d-c 0.21427993 -1.572151255 2.00071112 0.811827436 - 96 0-1 1-3 d-d 1.24664873 -0.539782457 3.03307992 0.168624647 - 97 0-1 2-1 a-c 0.56357443 -1.179803895 2.30695276 0.521617806 - 98 0-1 2-1 a-d -1.48593442 -2.611280289 -0.36058855 0.010334962 - 99 0-1 2-1 b-a 0.90697178 -0.246164592 2.06010815 0.121385603 - 100 0-1 2-1 b-c 1.02412473 -0.799143963 2.84739343 0.266784530 - 101 0-1 2-1 b-d -1.02538412 -2.270913754 0.22014552 0.105211614 - 102 0-1 2-1 d-c 1.21774024 -0.501253976 2.93673445 0.162352605 - 103 0-1 2-2 a-a 0.82695717 -0.916421161 2.57033549 0.347788791 - 104 0-1 2-2 a-c -0.49157367 -2.234951996 1.25180466 0.576051658 - 105 0-1 2-2 a-d -0.83329923 -2.140832973 0.47423452 0.208205576 - 106 0-1 2-2 b-a 1.28750747 -0.535761228 3.11077616 0.163673346 - 107 0-1 2-2 b-b -0.33745577 -1.749753624 1.07484209 0.635516392 - 108 0-1 2-2 b-c -0.03102337 -1.854292064 1.79224533 0.973054670 - 109 0-1 2-2 b-d -0.37274893 -1.785046785 1.03954893 0.600652277 - 110 0-1 2-2 c-c -0.35862681 -2.145057994 1.42780438 0.690403914 - 111 0-1 2-2 d-c 0.16259213 -1.556402077 1.88158635 0.851078079 - 112 0-1 2-2 d-d -0.17913342 -1.453973651 1.09570680 0.780346196 - 113 0-1 2-3 a-a 0.51713557 -1.226242755 2.26051390 0.556416220 - 114 0-1 2-3 a-c -0.99428380 -2.737662130 0.74909452 0.259571469 - 115 0-1 2-3 a-d 0.03808499 -1.705293332 1.78146332 0.965409814 - 116 0-1 2-3 b-a 0.97768587 -0.845582823 2.80095457 0.288906302 - 117 0-1 2-3 b-b 0.65436030 -0.591169341 1.89988993 0.298711706 - 118 0-1 2-3 b-c -0.53373350 -2.357002198 1.28953519 0.561598414 - 119 0-1 2-3 b-d 0.49863530 -1.324633399 2.32190399 0.587560735 - 120 0-1 2-3 c-c -0.86133694 -2.647768128 0.92509425 0.339951935 - 121 0-1 2-3 d-c -0.34011800 -2.059112211 1.37887621 0.694633048 - 122 0-1 2-3 d-d 0.69225080 -1.026743413 2.41124501 0.425018945 - 123 0-1 3-1 a-c 1.32866292 -0.401041635 3.05836748 0.130195270 - 124 0-1 3-1 a-d -0.72084593 -1.824889948 0.38319810 0.197396556 - 125 0-1 3-1 b-a 1.02884609 0.030200695 2.02749148 0.043623526 - 126 0-1 3-1 b-c 1.14599904 -0.583705520 2.87570360 0.190942201 - 127 0-1 3-1 b-d -0.90350981 -2.007553832 0.20053421 0.107257877 - 128 0-1 3-1 d-c 1.73599088 -0.087277819 3.55925957 0.061716539 - 129 0-1 3-2 a-c 0.27351482 -1.456189737 2.00321938 0.753670790 - 130 0-1 3-2 a-d -0.06821074 -1.357456394 1.22103492 0.916356372 - 131 0-1 3-2 b-a 1.40938177 -0.320322785 3.13908633 0.108765597 - 132 0-1 3-2 b-c 0.09085094 -1.638853621 1.82055550 0.916960440 - 133 0-1 3-2 b-d -0.25087462 -1.540120278 1.03837104 0.699424932 - 134 0-1 3-2 d-c 0.68084278 -1.142425920 2.50411147 0.459334235 - 135 0-1 3-3 a-a 1.28222406 -0.447480496 3.01192862 0.143962768 - 136 0-1 3-3 a-c -0.22919531 -1.958899870 1.50050925 0.792565473 - 137 0-1 3-3 a-d 0.80317349 -0.926531072 2.53287805 0.357988778 - 138 0-1 3-3 b-a 1.09956018 -0.630144380 2.82926474 0.209347551 - 139 0-1 3-3 b-b 0.77623460 -0.327809420 1.88027863 0.165489536 - 140 0-1 3-3 b-c -0.41185920 -2.141563755 1.31784536 0.636691140 - 141 0-1 3-3 b-d 0.62050960 -1.109194956 2.35021416 0.477114758 - 142 0-1 3-3 c-c -0.70985790 -2.471302801 1.05158701 0.424686271 - 143 0-1 3-3 d-c 0.17813264 -1.645136054 2.00140134 0.846236565 - 144 0-1 3-3 d-d 1.21050144 -0.612767255 3.03377014 0.190031394 - 145 1-0 1-1 a-c -0.75404388 -1.734021355 0.22593360 0.129553197 - 146 1-0 1-1 a-d -1.65498522 -2.748946433 -0.56102400 0.003512010 - 147 1-0 1-1 b-a -1.43250931 -3.175887639 0.31086901 0.105863625 - 148 1-0 1-1 b-c -1.30087436 -3.019868572 0.41811985 0.135897932 - 149 1-0 1-1 b-d -2.20181570 -3.988246887 -0.41538451 0.016383967 - 150 1-0 1-1 d-c 1.17831202 0.091124623 2.26549942 0.034037375 - 151 1-0 1-2 a-a -0.44642148 -1.468567627 0.57572467 0.387115253 - 152 1-0 1-2 a-c -0.57936834 -1.673329560 0.51459287 0.294857827 - 153 1-0 1-2 a-d -1.10058728 -2.080564762 -0.12060981 0.028231848 - 154 1-0 1-2 b-a -0.99325196 -2.736630289 0.75012636 0.260062108 - 155 1-0 1-2 b-b -1.45380227 -3.277070961 0.36946643 0.116419962 - 156 1-0 1-2 b-c -1.12619883 -2.912630014 0.66023236 0.213112445 - 157 1-0 1-2 b-d -1.64741777 -3.366411979 0.07157644 0.060071071 - 158 1-0 1-2 c-c -0.69652129 -2.482952482 1.08990989 0.439838023 - 159 1-0 1-2 d-c 1.35298756 0.162033430 2.54394168 0.026513775 - 160 1-0 1-2 d-d 0.83176861 -0.255418784 1.91895601 0.131719637 - 161 1-0 1-3 a-a -1.21150997 -2.210155366 -0.21286458 0.018083724 - 162 1-0 1-3 a-c -0.73084739 -1.783512060 0.32181728 0.170780414 - 163 1-0 1-3 a-d -1.61883793 -2.771974298 -0.46570155 0.006548296 - 164 1-0 1-3 b-a -1.75834046 -3.488045016 -0.02863590 0.046416974 - 165 1-0 1-3 b-b -1.57567657 -3.305381132 0.15402799 0.073575404 - 166 1-0 1-3 b-c -1.27767787 -3.039122777 0.48376703 0.152659506 - 167 1-0 1-3 b-d -2.16566841 -3.988937105 -0.34239971 0.020546496 - 168 1-0 1-3 c-c -0.84800034 -2.609445245 0.91344457 0.340681177 - 169 1-0 1-3 d-c 1.20150851 0.048372137 2.35464488 0.041350235 - 170 1-0 1-3 d-d 0.31351797 -0.932011664 1.55904761 0.617585842 - 171 1-0 2-1 a-c -1.13457956 -2.853573774 0.58441465 0.192613082 - 172 1-0 2-1 a-d -2.03552090 -3.821952089 -0.24908971 0.026081663 - 173 1-0 2-1 b-a 0.35874872 -0.948785027 1.66628246 0.586353105 - 174 1-0 2-1 b-c 0.49038367 -0.784456557 1.76522390 0.445976476 - 175 1-0 2-1 b-d -0.41055767 -1.774967025 0.95385169 0.550752371 - 176 1-0 2-1 d-c 0.52567683 -0.749163396 1.80051706 0.414066601 - 177 1-0 2-2 a-c -0.95990403 -2.746335216 0.82652716 0.287922425 - 178 1-0 2-2 a-d -1.48112297 -3.200117181 0.23787124 0.090223368 - 179 1-0 2-2 b-a 0.79800607 -0.509527677 2.10553981 0.227920551 - 180 1-0 2-2 b-c 0.66505920 -0.699350153 2.02946856 0.334723249 - 181 1-0 2-2 b-d 0.14384026 -1.130999964 1.41868049 0.822799825 - 182 1-0 2-2 d-c 0.70035236 -0.664056992 2.06476172 0.309869339 - 183 1-0 2-3 a-a -1.59204566 -3.321750218 0.13765890 0.070693932 - 184 1-0 2-3 a-c -1.11138307 -2.872827979 0.65006183 0.212730864 - 185 1-0 2-3 a-d -1.99937361 -3.822642307 -0.17610492 0.032043775 - 186 1-0 2-3 b-a 0.03291757 -1.256328085 1.32216323 0.959576679 - 187 1-0 2-3 b-b 0.21558146 -1.073664200 1.50482712 0.740022654 - 188 1-0 2-3 b-c 0.51358016 -0.817947032 1.84510735 0.444746883 - 189 1-0 2-3 b-d -0.37441038 -1.786708237 1.03788748 0.599032935 - 190 1-0 2-3 c-c 0.20714776 -1.554297143 1.96859267 0.815441859 - 191 1-0 2-3 d-c 0.54887332 -0.782653871 1.88040051 0.414217491 - 192 1-0 2-3 d-d -0.33911722 -1.751415076 1.07318064 0.633855677 - 193 1-0 3-1 a-c -0.82475797 -2.543752180 0.89423624 0.342310886 - 194 1-0 3-1 a-d -1.72569931 -3.512130494 0.06073188 0.058103480 - 195 1-0 3-1 b-a -0.63306734 -1.758413214 0.49227853 0.266061870 - 196 1-0 3-1 b-c -0.50143239 -1.588619790 0.58575501 0.361211622 - 197 1-0 3-1 b-d -1.40237373 -2.593327855 -0.21141960 0.021626269 - 198 1-0 3-1 d-c -0.34570739 -2.064701603 1.37328682 0.689878310 - 199 1-0 3-2 a-c -0.65008243 -2.436513622 1.13634875 0.470818794 - 200 1-0 3-2 a-d -1.17130138 -2.890295587 0.54769284 0.178765955 - 201 1-0 3-2 b-a -0.19380999 -1.319155864 0.93153588 0.732537131 - 202 1-0 3-2 b-c -0.32675686 -1.517710982 0.86419727 0.586359794 - 203 1-0 3-2 b-d -0.84797580 -1.935163197 0.23921160 0.124470533 - 204 1-0 3-2 d-c -0.17103186 -1.957463045 1.61539933 0.849283541 - 205 1-0 3-3 a-c -0.80156148 -2.563006385 0.95988343 0.367626467 - 206 1-0 3-3 a-d -1.68955202 -3.512820712 0.13371668 0.068844252 - 207 1-0 3-3 b-a -0.95889849 -2.062942510 0.14514554 0.087719495 - 208 1-0 3-3 b-c -0.47823590 -1.631372275 0.67490047 0.411390248 - 209 1-0 3-3 b-d -1.36622644 -2.611756077 -0.12069680 0.031995687 - 210 1-0 3-3 d-c -0.32251090 -2.083955808 1.43893400 0.716374730 - 211 1-1 1-1 a-c 0.11715295 -1.706115744 1.94042165 0.898507864 - 212 1-1 1-1 a-d -1.93235590 -3.177885536 -0.68682626 0.002796701 - 213 1-1 1-1 b-a -0.54683048 -2.370099179 1.27643821 0.552057472 - 214 1-1 1-1 b-c -0.42967753 -2.735950278 1.87659521 0.711621521 - 215 1-1 1-1 b-d -2.47918638 -4.362250194 -0.59612257 0.010550461 - 216 1-1 1-1 d-c 2.04950885 0.166445038 3.93257266 0.033311287 - 217 1-1 1-2 a-a 0.38053569 -1.442733010 2.20380438 0.678813071 - 218 1-1 1-2 a-c -0.93799515 -2.761263846 0.88527355 0.308787245 - 219 1-1 1-2 a-d -1.27972071 -2.692018567 0.13257715 0.075081719 - 220 1-1 1-2 b-a -0.16629480 -2.472567544 2.13997795 0.886188218 - 221 1-1 1-2 b-b -1.79125803 -3.788548817 0.20603276 0.078052173 - 222 1-1 1-2 b-c -1.48482563 -3.791098380 0.82144711 0.203642097 - 223 1-1 1-2 b-d -1.82655119 -3.823841978 0.17073959 0.072479198 - 224 1-1 1-2 c-c -1.05514810 -3.361420847 1.25112464 0.365063459 - 225 1-1 1-2 d-c 0.99436075 -0.888703063 2.87742456 0.296264194 - 226 1-1 1-2 d-d 0.65263519 -0.836057466 2.14132785 0.385337760 - 227 1-1 1-3 a-a 0.07071409 -1.752554604 1.89398279 0.938631240 - 228 1-1 1-3 a-c -1.44070528 -3.263973979 0.38256341 0.119693665 - 229 1-1 1-3 a-d -0.40833649 -2.231605181 1.41493221 0.656827939 - 230 1-1 1-3 b-a -0.47611639 -2.782389138 1.83015635 0.682105706 - 231 1-1 1-3 b-b -0.79944197 -2.682505781 1.08362184 0.400457480 - 232 1-1 1-3 b-c -1.98753577 -4.293808513 0.31873698 0.090159696 - 233 1-1 1-3 b-d -0.95516697 -3.261439715 1.35110578 0.412025790 - 234 1-1 1-3 c-c -1.55785823 -3.864130981 0.74841451 0.182512757 - 235 1-1 1-3 d-c 0.49165061 -1.391413197 2.37471443 0.604569874 - 236 1-1 1-3 d-d 1.52401941 -0.359044398 3.40708323 0.111124801 - 237 1-1 2-1 a-c -0.26338273 -2.569655480 2.04289001 0.820681097 - 238 1-1 2-1 a-d -2.31289158 -4.195955396 -0.42982777 0.016745220 - 239 1-1 2-1 b-a 1.24442755 -0.167870312 2.65672541 0.083300328 - 240 1-1 2-1 b-c 1.36158050 -0.635710288 3.35887128 0.178560596 - 241 1-1 2-1 b-d -0.68792835 -2.176621008 0.80076430 0.360298621 - 242 1-1 2-1 d-c 1.39687366 -0.600417127 3.39416445 0.167697904 - 243 1-1 2-2 a-c -1.31853084 -3.624803582 0.98774191 0.258417727 - 244 1-1 2-2 a-d -1.66025639 -3.657547180 0.33703439 0.101929440 - 245 1-1 2-2 b-a 1.62496323 -0.372327553 3.62225402 0.109290192 - 246 1-1 2-2 b-c 0.30643240 -1.690858389 2.30372318 0.760767129 - 247 1-1 2-2 b-d -0.03529316 -1.666074259 1.59548794 0.965732051 - 248 1-1 2-2 d-c 0.34172556 -1.655565228 2.33901634 0.734221218 - 249 1-1 2-3 a-a -0.30982159 -2.616094341 1.99645115 0.789763850 - 250 1-1 2-3 a-c -1.82124097 -4.127513715 0.48503178 0.119918233 - 251 1-1 2-3 a-d -0.78887217 -3.095144917 1.51740058 0.497776604 - 252 1-1 2-3 b-a 1.31514164 -0.682149148 3.31243242 0.193656592 - 253 1-1 2-3 b-b 0.99181606 -0.496876595 2.48050872 0.188508813 - 254 1-1 2-3 b-c -0.19627774 -2.193568523 1.80101305 0.845347292 - 255 1-1 2-3 b-d 0.83609106 -1.161199724 2.83338185 0.407040734 - 256 1-1 2-3 c-c -0.50271013 -2.808982880 1.80356261 0.665420329 - 257 1-1 2-3 d-c -0.16098458 -2.158275361 1.83630621 0.872888153 - 258 1-1 2-3 d-d 0.87138422 -1.125906563 2.86867501 0.387619573 - 259 1-1 3-1 a-c 0.04643886 -2.259833886 2.35271161 0.968115295 - 260 1-1 3-1 a-d -2.00306999 -3.886133801 -0.12000618 0.037392050 - 261 1-1 3-1 b-a 0.25261149 -0.992918152 1.49814112 0.687391163 - 262 1-1 3-1 b-c 0.36976444 -1.513299375 2.25282825 0.696824084 - 263 1-1 3-1 b-d -1.67974441 -3.011271603 -0.34821722 0.014106286 - 264 1-1 3-1 d-c 0.52548944 -1.780783310 2.83176218 0.651260938 - 265 1-1 3-2 a-c -1.00870924 -3.314981987 1.29756350 0.386437196 - 266 1-1 3-2 a-d -1.35043480 -3.347725585 0.64685599 0.182099738 - 267 1-1 3-2 b-a 0.63314717 -1.249916640 2.51621098 0.505100890 - 268 1-1 3-2 b-c -0.68538366 -2.568447476 1.19768015 0.470730657 - 269 1-1 3-2 b-d -1.02710922 -2.515801879 0.46158343 0.173438672 - 270 1-1 3-2 d-c -0.52965866 -2.835931411 1.77661408 0.648683024 - 271 1-1 3-3 a-c -1.51141937 -3.817692121 0.79485337 0.195747077 - 272 1-1 3-3 a-d -0.47905058 -2.785323322 1.82722217 0.680256760 - 273 1-1 3-3 b-a 0.32332558 -1.559738235 2.20638939 0.733314375 - 274 1-1 3-3 b-c -1.18809380 -3.071157610 0.69497001 0.212740270 - 275 1-1 3-3 b-d -0.15572500 -2.038788811 1.72733881 0.869612139 - 276 1-1 3-3 d-c -1.03236880 -3.338641544 1.27390395 0.375452053 + # Pairwise comparisons + + x1 | x2 | x3 | Contrast | 95% CI | p + ------------------------------------------------- + 0-0 | 1-1 | a-c | 0.13 | -0.69, 0.95 | 0.751 + 0-0 | 1-1 | a-d | -0.77 | -1.72, 0.19 | 0.113 + 0-0 | 1-1 | b-a | 0.17 | -0.70, 1.04 | 0.701 + 0-0 | 1-1 | b-c | 0.30 | -0.52, 1.12 | 0.469 + 0-0 | 1-1 | b-d | -0.60 | -1.56, 0.35 | 0.214 + 0-0 | 1-1 | d-c | 0.90 | -0.01, 1.81 | 0.052 + 0-0 | 1-2 | a-a | 0.44 | -0.43, 1.31 | 0.319 + 0-0 | 1-2 | a-c | 0.31 | -0.65, 1.26 | 0.525 + 0-0 | 1-2 | a-d | -0.21 | -1.04, 0.61 | 0.604 + 0-0 | 1-2 | b-a | 0.61 | -0.26, 1.48 | 0.169 + 0-0 | 1-2 | b-b | 0.15 | -0.87, 1.17 | 0.774 + 0-0 | 1-2 | b-c | 0.48 | -0.48, 1.43 | 0.325 + 0-0 | 1-2 | b-d | -0.05 | -0.87, 0.78 | 0.912 + 0-0 | 1-2 | c-c | 0.17 | -0.73, 1.08 | 0.703 + 0-0 | 1-2 | d-c | 1.08 | 0.04, 2.11 | 0.041 + 0-0 | 1-2 | d-d | 0.55 | -0.36, 1.46 | 0.229 + 0-0 | 1-3 | a-a | -0.33 | -1.17, 0.52 | 0.444 + 0-0 | 1-3 | a-c | 0.15 | -0.75, 1.06 | 0.735 + 0-0 | 1-3 | a-d | -0.73 | -1.76, 0.29 | 0.157 + 0-0 | 1-3 | b-a | -0.16 | -1.00, 0.69 | 0.712 + 0-0 | 1-3 | b-b | 0.03 | -0.82, 0.87 | 0.952 + 0-0 | 1-3 | b-c | 0.32 | -0.58, 1.23 | 0.479 + 0-0 | 1-3 | b-d | -0.56 | -1.59, 0.46 | 0.275 + 0-0 | 1-3 | c-c | 0.02 | -0.84, 0.88 | 0.957 + 0-0 | 1-3 | d-c | 0.92 | -0.06, 1.91 | 0.066 + 0-0 | 1-3 | d-d | 0.04 | -1.06, 1.13 | 0.948 + 0-0 | 2-1 | a-c | -0.31 | -1.13, 0.51 | 0.458 + 0-0 | 2-1 | a-d | -1.21 | -2.16, -0.25 | 0.014 + 0-0 | 2-1 | b-a | 0.02 | -1.00, 1.04 | 0.967 + 0-0 | 2-1 | b-c | 0.15 | -0.83, 1.13 | 0.757 + 0-0 | 2-1 | b-d | -0.75 | -1.84, 0.35 | 0.177 + 0-0 | 2-1 | d-c | 0.35 | -0.42, 1.12 | 0.372 + 0-0 | 2-2 | a-c | -0.13 | -1.09, 0.82 | 0.782 + 0-0 | 2-2 | a-d | -0.65 | -1.48, 0.17 | 0.117 + 0-0 | 2-2 | b-a | 0.46 | -0.56, 1.48 | 0.372 + 0-0 | 2-2 | b-c | 0.33 | -0.77, 1.42 | 0.553 + 0-0 | 2-2 | b-d | -0.19 | -1.17, 0.79 | 0.695 + 0-0 | 2-2 | d-c | 0.52 | -0.39, 1.43 | 0.257 + 0-0 | 2-3 | a-a | -0.77 | -1.61, 0.08 | 0.075 + 0-0 | 2-3 | a-c | -0.28 | -1.19, 0.62 | 0.534 + 0-0 | 2-3 | a-d | -1.17 | -2.19, -0.15 | 0.025 + 0-0 | 2-3 | b-a | -0.30 | -1.30, 0.69 | 0.545 + 0-0 | 2-3 | b-b | -0.12 | -1.12, 0.88 | 0.809 + 0-0 | 2-3 | b-c | 0.18 | -0.88, 1.23 | 0.740 + 0-0 | 2-3 | b-d | -0.71 | -1.87, 0.44 | 0.223 + 0-0 | 2-3 | c-c | -0.15 | -1.14, 0.84 | 0.761 + 0-0 | 2-3 | d-c | 0.37 | -0.49, 1.23 | 0.394 + 0-0 | 2-3 | d-d | -0.52 | -1.50, 0.46 | 0.296 + 0-0 | 3-1 | a-c | 0.46 | -0.33, 1.25 | 0.254 + 0-0 | 3-1 | a-d | -0.44 | -1.37, 0.49 | 0.345 + 0-0 | 3-1 | b-a | 0.14 | -0.70, 0.99 | 0.736 + 0-0 | 3-1 | b-c | 0.27 | -0.52, 1.07 | 0.492 + 0-0 | 3-1 | b-d | -0.63 | -1.56, 0.30 | 0.184 + 0-0 | 3-1 | d-c | 0.86 | -0.12, 1.84 | 0.083 + 0-0 | 3-2 | a-c | 0.63 | -0.30, 1.56 | 0.180 + 0-0 | 3-2 | a-d | 0.11 | -0.68, 0.90 | 0.781 + 0-0 | 3-2 | b-a | 0.58 | -0.26, 1.43 | 0.173 + 0-0 | 3-2 | b-c | 0.45 | -0.48, 1.38 | 0.339 + 0-0 | 3-2 | b-d | -0.07 | -0.86, 0.72 | 0.857 + 0-0 | 3-2 | d-c | 1.04 | -0.05, 2.13 | 0.062 + 0-0 | 3-3 | a-c | 0.48 | -0.40, 1.36 | 0.280 + 0-0 | 3-3 | a-d | -0.41 | -1.41, 0.59 | 0.419 + 0-0 | 3-3 | b-a | -0.18 | -1.00, 0.63 | 0.657 + 0-0 | 3-3 | b-c | 0.30 | -0.58, 1.18 | 0.502 + 0-0 | 3-3 | b-d | -0.59 | -1.59, 0.41 | 0.243 + 0-0 | 3-3 | d-c | 0.89 | -0.16, 1.94 | 0.097 + 0-1 | 1-1 | a-a | 0.89 | -0.14, 1.91 | 0.088 + 0-1 | 1-1 | a-c | 1.00 | -0.74, 2.75 | 0.256 + 0-1 | 1-1 | a-d | -1.05 | -2.17, 0.08 | 0.068 + 0-1 | 1-1 | b-a | 1.05 | 0.03, 2.08 | 0.043 + 0-1 | 1-1 | b-b | 1.60 | -0.14, 3.34 | 0.071 + 0-1 | 1-1 | b-c | 1.17 | -0.57, 2.92 | 0.185 + 0-1 | 1-1 | b-d | -0.88 | -2.00, 0.25 | 0.124 + 0-1 | 1-1 | c-c | 0.87 | -0.85, 2.59 | 0.316 + 0-1 | 1-1 | d-c | 1.77 | -0.01, 3.56 | 0.052 + 0-1 | 1-1 | d-d | -0.28 | -1.47, 0.91 | 0.644 + 0-1 | 1-2 | a-a | 1.27 | -0.48, 3.01 | 0.152 + 0-1 | 1-2 | a-c | -0.05 | -1.80, 1.69 | 0.952 + 0-1 | 1-2 | a-d | -0.39 | -1.70, 0.91 | 0.550 + 0-1 | 1-2 | b-a | 1.44 | -0.31, 3.18 | 0.105 + 0-1 | 1-2 | b-b | -0.19 | -1.50, 1.12 | 0.773 + 0-1 | 1-2 | b-c | 0.12 | -1.63, 1.86 | 0.894 + 0-1 | 1-2 | b-d | -0.23 | -1.53, 1.08 | 0.733 + 0-1 | 1-2 | c-c | -0.18 | -1.90, 1.54 | 0.832 + 0-1 | 1-2 | d-c | 0.72 | -1.07, 2.50 | 0.427 + 0-1 | 1-2 | d-d | 0.38 | -0.99, 1.74 | 0.585 + 0-1 | 1-3 | a-a | 0.96 | -0.79, 2.70 | 0.278 + 0-1 | 1-3 | a-c | -0.56 | -2.30, 1.19 | 0.528 + 0-1 | 1-3 | a-d | 0.48 | -1.27, 2.22 | 0.587 + 0-1 | 1-3 | b-a | 1.13 | -0.62, 2.87 | 0.202 + 0-1 | 1-3 | b-b | 0.80 | -0.32, 1.93 | 0.160 + 0-1 | 1-3 | b-c | -0.39 | -2.13, 1.36 | 0.660 + 0-1 | 1-3 | b-d | 0.65 | -1.10, 2.39 | 0.463 + 0-1 | 1-3 | c-c | -0.69 | -2.41, 1.03 | 0.429 + 0-1 | 1-3 | d-c | 0.21 | -1.57, 2.00 | 0.812 + 0-1 | 1-3 | d-d | 1.25 | -0.54, 3.03 | 0.169 + 0-1 | 2-1 | a-c | 0.56 | -1.18, 2.31 | 0.522 + 0-1 | 2-1 | a-d | -1.49 | -2.61, -0.36 | 0.010 + 0-1 | 2-1 | b-a | 0.91 | -0.25, 2.06 | 0.121 + 0-1 | 2-1 | b-c | 1.02 | -0.80, 2.85 | 0.267 + 0-1 | 2-1 | b-d | -1.03 | -2.27, 0.22 | 0.105 + 0-1 | 2-1 | d-c | 1.22 | -0.50, 2.94 | 0.162 + 0-1 | 2-2 | a-a | 0.83 | -0.92, 2.57 | 0.348 + 0-1 | 2-2 | a-c | -0.49 | -2.23, 1.25 | 0.576 + 0-1 | 2-2 | a-d | -0.83 | -2.14, 0.47 | 0.208 + 0-1 | 2-2 | b-a | 1.29 | -0.54, 3.11 | 0.164 + 0-1 | 2-2 | b-b | -0.34 | -1.75, 1.07 | 0.636 + 0-1 | 2-2 | b-c | -0.03 | -1.85, 1.79 | 0.973 + 0-1 | 2-2 | b-d | -0.37 | -1.79, 1.04 | 0.601 + 0-1 | 2-2 | c-c | -0.36 | -2.15, 1.43 | 0.690 + 0-1 | 2-2 | d-c | 0.16 | -1.56, 1.88 | 0.851 + 0-1 | 2-2 | d-d | -0.18 | -1.45, 1.10 | 0.780 + 0-1 | 2-3 | a-a | 0.52 | -1.23, 2.26 | 0.556 + 0-1 | 2-3 | a-c | -0.99 | -2.74, 0.75 | 0.260 + 0-1 | 2-3 | a-d | 0.04 | -1.71, 1.78 | 0.965 + 0-1 | 2-3 | b-a | 0.98 | -0.85, 2.80 | 0.289 + 0-1 | 2-3 | b-b | 0.65 | -0.59, 1.90 | 0.299 + 0-1 | 2-3 | b-c | -0.53 | -2.36, 1.29 | 0.562 + 0-1 | 2-3 | b-d | 0.50 | -1.32, 2.32 | 0.588 + 0-1 | 2-3 | c-c | -0.86 | -2.65, 0.93 | 0.340 + 0-1 | 2-3 | d-c | -0.34 | -2.06, 1.38 | 0.695 + 0-1 | 2-3 | d-d | 0.69 | -1.03, 2.41 | 0.425 + 0-1 | 3-1 | a-c | 1.33 | -0.40, 3.06 | 0.130 + 0-1 | 3-1 | a-d | -0.72 | -1.82, 0.38 | 0.197 + 0-1 | 3-1 | b-a | 1.03 | 0.03, 2.03 | 0.044 + 0-1 | 3-1 | b-c | 1.15 | -0.58, 2.88 | 0.191 + 0-1 | 3-1 | b-d | -0.90 | -2.01, 0.20 | 0.107 + 0-1 | 3-1 | d-c | 1.74 | -0.09, 3.56 | 0.062 + 0-1 | 3-2 | a-c | 0.27 | -1.46, 2.00 | 0.754 + 0-1 | 3-2 | a-d | -0.07 | -1.36, 1.22 | 0.916 + 0-1 | 3-2 | b-a | 1.41 | -0.32, 3.14 | 0.109 + 0-1 | 3-2 | b-c | 0.09 | -1.64, 1.82 | 0.917 + 0-1 | 3-2 | b-d | -0.25 | -1.54, 1.04 | 0.699 + 0-1 | 3-2 | d-c | 0.68 | -1.14, 2.50 | 0.459 + 0-1 | 3-3 | a-a | 1.28 | -0.45, 3.01 | 0.144 + 0-1 | 3-3 | a-c | -0.23 | -1.96, 1.50 | 0.793 + 0-1 | 3-3 | a-d | 0.80 | -0.93, 2.53 | 0.358 + 0-1 | 3-3 | b-a | 1.10 | -0.63, 2.83 | 0.209 + 0-1 | 3-3 | b-b | 0.78 | -0.33, 1.88 | 0.165 + 0-1 | 3-3 | b-c | -0.41 | -2.14, 1.32 | 0.637 + 0-1 | 3-3 | b-d | 0.62 | -1.11, 2.35 | 0.477 + 0-1 | 3-3 | c-c | -0.71 | -2.47, 1.05 | 0.425 + 0-1 | 3-3 | d-c | 0.18 | -1.65, 2.00 | 0.846 + 0-1 | 3-3 | d-d | 1.21 | -0.61, 3.03 | 0.190 + 1-0 | 1-1 | a-c | -0.75 | -1.73, 0.23 | 0.130 + 1-0 | 1-1 | a-d | -1.65 | -2.75, -0.56 | 0.004 + 1-0 | 1-1 | b-a | -1.43 | -3.18, 0.31 | 0.106 + 1-0 | 1-1 | b-c | -1.30 | -3.02, 0.42 | 0.136 + 1-0 | 1-1 | b-d | -2.20 | -3.99, -0.42 | 0.016 + 1-0 | 1-1 | d-c | 1.18 | 0.09, 2.27 | 0.034 + 1-0 | 1-2 | a-a | -0.45 | -1.47, 0.58 | 0.387 + 1-0 | 1-2 | a-c | -0.58 | -1.67, 0.51 | 0.295 + 1-0 | 1-2 | a-d | -1.10 | -2.08, -0.12 | 0.028 + 1-0 | 1-2 | b-a | -0.99 | -2.74, 0.75 | 0.260 + 1-0 | 1-2 | b-b | -1.45 | -3.28, 0.37 | 0.116 + 1-0 | 1-2 | b-c | -1.13 | -2.91, 0.66 | 0.213 + 1-0 | 1-2 | b-d | -1.65 | -3.37, 0.07 | 0.060 + 1-0 | 1-2 | c-c | -0.70 | -2.48, 1.09 | 0.440 + 1-0 | 1-2 | d-c | 1.35 | 0.16, 2.54 | 0.027 + 1-0 | 1-2 | d-d | 0.83 | -0.26, 1.92 | 0.132 + 1-0 | 1-3 | a-a | -1.21 | -2.21, -0.21 | 0.018 + 1-0 | 1-3 | a-c | -0.73 | -1.78, 0.32 | 0.171 + 1-0 | 1-3 | a-d | -1.62 | -2.77, -0.47 | 0.007 + 1-0 | 1-3 | b-a | -1.76 | -3.49, -0.03 | 0.046 + 1-0 | 1-3 | b-b | -1.58 | -3.31, 0.15 | 0.074 + 1-0 | 1-3 | b-c | -1.28 | -3.04, 0.48 | 0.153 + 1-0 | 1-3 | b-d | -2.17 | -3.99, -0.34 | 0.021 + 1-0 | 1-3 | c-c | -0.85 | -2.61, 0.91 | 0.341 + 1-0 | 1-3 | d-c | 1.20 | 0.05, 2.35 | 0.041 + 1-0 | 1-3 | d-d | 0.31 | -0.93, 1.56 | 0.618 + 1-0 | 2-1 | a-c | -1.13 | -2.85, 0.58 | 0.193 + 1-0 | 2-1 | a-d | -2.04 | -3.82, -0.25 | 0.026 + 1-0 | 2-1 | b-a | 0.36 | -0.95, 1.67 | 0.586 + 1-0 | 2-1 | b-c | 0.49 | -0.78, 1.77 | 0.446 + 1-0 | 2-1 | b-d | -0.41 | -1.77, 0.95 | 0.551 + 1-0 | 2-1 | d-c | 0.53 | -0.75, 1.80 | 0.414 + 1-0 | 2-2 | a-c | -0.96 | -2.75, 0.83 | 0.288 + 1-0 | 2-2 | a-d | -1.48 | -3.20, 0.24 | 0.090 + 1-0 | 2-2 | b-a | 0.80 | -0.51, 2.11 | 0.228 + 1-0 | 2-2 | b-c | 0.67 | -0.70, 2.03 | 0.335 + 1-0 | 2-2 | b-d | 0.14 | -1.13, 1.42 | 0.823 + 1-0 | 2-2 | d-c | 0.70 | -0.66, 2.06 | 0.310 + 1-0 | 2-3 | a-a | -1.59 | -3.32, 0.14 | 0.071 + 1-0 | 2-3 | a-c | -1.11 | -2.87, 0.65 | 0.213 + 1-0 | 2-3 | a-d | -2.00 | -3.82, -0.18 | 0.032 + 1-0 | 2-3 | b-a | 0.03 | -1.26, 1.32 | 0.960 + 1-0 | 2-3 | b-b | 0.22 | -1.07, 1.50 | 0.740 + 1-0 | 2-3 | b-c | 0.51 | -0.82, 1.85 | 0.445 + 1-0 | 2-3 | b-d | -0.37 | -1.79, 1.04 | 0.599 + 1-0 | 2-3 | c-c | 0.21 | -1.55, 1.97 | 0.815 + 1-0 | 2-3 | d-c | 0.55 | -0.78, 1.88 | 0.414 + 1-0 | 2-3 | d-d | -0.34 | -1.75, 1.07 | 0.634 + 1-0 | 3-1 | a-c | -0.82 | -2.54, 0.89 | 0.342 + 1-0 | 3-1 | a-d | -1.73 | -3.51, 0.06 | 0.058 + 1-0 | 3-1 | b-a | -0.63 | -1.76, 0.49 | 0.266 + 1-0 | 3-1 | b-c | -0.50 | -1.59, 0.59 | 0.361 + 1-0 | 3-1 | b-d | -1.40 | -2.59, -0.21 | 0.022 + 1-0 | 3-1 | d-c | -0.35 | -2.06, 1.37 | 0.690 + 1-0 | 3-2 | a-c | -0.65 | -2.44, 1.14 | 0.471 + 1-0 | 3-2 | a-d | -1.17 | -2.89, 0.55 | 0.179 + 1-0 | 3-2 | b-a | -0.19 | -1.32, 0.93 | 0.733 + 1-0 | 3-2 | b-c | -0.33 | -1.52, 0.86 | 0.586 + 1-0 | 3-2 | b-d | -0.85 | -1.94, 0.24 | 0.124 + 1-0 | 3-2 | d-c | -0.17 | -1.96, 1.62 | 0.849 + 1-0 | 3-3 | a-c | -0.80 | -2.56, 0.96 | 0.368 + 1-0 | 3-3 | a-d | -1.69 | -3.51, 0.13 | 0.069 + 1-0 | 3-3 | b-a | -0.96 | -2.06, 0.15 | 0.088 + 1-0 | 3-3 | b-c | -0.48 | -1.63, 0.67 | 0.411 + 1-0 | 3-3 | b-d | -1.37 | -2.61, -0.12 | 0.032 + 1-0 | 3-3 | d-c | -0.32 | -2.08, 1.44 | 0.716 + 1-1 | 1-1 | a-c | 0.12 | -1.71, 1.94 | 0.899 + 1-1 | 1-1 | a-d | -1.93 | -3.18, -0.69 | 0.003 + 1-1 | 1-1 | b-a | -0.55 | -2.37, 1.28 | 0.552 + 1-1 | 1-1 | b-c | -0.43 | -2.74, 1.88 | 0.712 + 1-1 | 1-1 | b-d | -2.48 | -4.36, -0.60 | 0.011 + 1-1 | 1-1 | d-c | 2.05 | 0.17, 3.93 | 0.033 + 1-1 | 1-2 | a-a | 0.38 | -1.44, 2.20 | 0.679 + 1-1 | 1-2 | a-c | -0.94 | -2.76, 0.89 | 0.309 + 1-1 | 1-2 | a-d | -1.28 | -2.69, 0.13 | 0.075 + 1-1 | 1-2 | b-a | -0.17 | -2.47, 2.14 | 0.886 + 1-1 | 1-2 | b-b | -1.79 | -3.79, 0.21 | 0.078 + 1-1 | 1-2 | b-c | -1.48 | -3.79, 0.82 | 0.204 + 1-1 | 1-2 | b-d | -1.83 | -3.82, 0.17 | 0.072 + 1-1 | 1-2 | c-c | -1.06 | -3.36, 1.25 | 0.365 + 1-1 | 1-2 | d-c | 0.99 | -0.89, 2.88 | 0.296 + 1-1 | 1-2 | d-d | 0.65 | -0.84, 2.14 | 0.385 + 1-1 | 1-3 | a-a | 0.07 | -1.75, 1.89 | 0.939 + 1-1 | 1-3 | a-c | -1.44 | -3.26, 0.38 | 0.120 + 1-1 | 1-3 | a-d | -0.41 | -2.23, 1.41 | 0.657 + 1-1 | 1-3 | b-a | -0.48 | -2.78, 1.83 | 0.682 + 1-1 | 1-3 | b-b | -0.80 | -2.68, 1.08 | 0.400 + 1-1 | 1-3 | b-c | -1.99 | -4.29, 0.32 | 0.090 + 1-1 | 1-3 | b-d | -0.96 | -3.26, 1.35 | 0.412 + 1-1 | 1-3 | c-c | -1.56 | -3.86, 0.75 | 0.183 + 1-1 | 1-3 | d-c | 0.49 | -1.39, 2.37 | 0.605 + 1-1 | 1-3 | d-d | 1.52 | -0.36, 3.41 | 0.111 + 1-1 | 2-1 | a-c | -0.26 | -2.57, 2.04 | 0.821 + 1-1 | 2-1 | a-d | -2.31 | -4.20, -0.43 | 0.017 + 1-1 | 2-1 | b-a | 1.24 | -0.17, 2.66 | 0.083 + 1-1 | 2-1 | b-c | 1.36 | -0.64, 3.36 | 0.179 + 1-1 | 2-1 | b-d | -0.69 | -2.18, 0.80 | 0.360 + 1-1 | 2-1 | d-c | 1.40 | -0.60, 3.39 | 0.168 + 1-1 | 2-2 | a-c | -1.32 | -3.62, 0.99 | 0.258 + 1-1 | 2-2 | a-d | -1.66 | -3.66, 0.34 | 0.102 + 1-1 | 2-2 | b-a | 1.62 | -0.37, 3.62 | 0.109 + 1-1 | 2-2 | b-c | 0.31 | -1.69, 2.30 | 0.761 + 1-1 | 2-2 | b-d | -0.04 | -1.67, 1.60 | 0.966 + 1-1 | 2-2 | d-c | 0.34 | -1.66, 2.34 | 0.734 + 1-1 | 2-3 | a-a | -0.31 | -2.62, 2.00 | 0.790 + 1-1 | 2-3 | a-c | -1.82 | -4.13, 0.49 | 0.120 + 1-1 | 2-3 | a-d | -0.79 | -3.10, 1.52 | 0.498 + 1-1 | 2-3 | b-a | 1.32 | -0.68, 3.31 | 0.194 + 1-1 | 2-3 | b-b | 0.99 | -0.50, 2.48 | 0.189 + 1-1 | 2-3 | b-c | -0.20 | -2.19, 1.80 | 0.845 + 1-1 | 2-3 | b-d | 0.84 | -1.16, 2.83 | 0.407 + 1-1 | 2-3 | c-c | -0.50 | -2.81, 1.80 | 0.665 + 1-1 | 2-3 | d-c | -0.16 | -2.16, 1.84 | 0.873 + 1-1 | 2-3 | d-d | 0.87 | -1.13, 2.87 | 0.388 + 1-1 | 3-1 | a-c | 0.05 | -2.26, 2.35 | 0.968 + 1-1 | 3-1 | a-d | -2.00 | -3.89, -0.12 | 0.037 + 1-1 | 3-1 | b-a | 0.25 | -0.99, 1.50 | 0.687 + 1-1 | 3-1 | b-c | 0.37 | -1.51, 2.25 | 0.697 + 1-1 | 3-1 | b-d | -1.68 | -3.01, -0.35 | 0.014 + 1-1 | 3-1 | d-c | 0.53 | -1.78, 2.83 | 0.651 + 1-1 | 3-2 | a-c | -1.01 | -3.31, 1.30 | 0.386 + 1-1 | 3-2 | a-d | -1.35 | -3.35, 0.65 | 0.182 + 1-1 | 3-2 | b-a | 0.63 | -1.25, 2.52 | 0.505 + 1-1 | 3-2 | b-c | -0.69 | -2.57, 1.20 | 0.471 + 1-1 | 3-2 | b-d | -1.03 | -2.52, 0.46 | 0.173 + 1-1 | 3-2 | d-c | -0.53 | -2.84, 1.78 | 0.649 + 1-1 | 3-3 | a-c | -1.51 | -3.82, 0.79 | 0.196 + 1-1 | 3-3 | a-d | -0.48 | -2.79, 1.83 | 0.680 + 1-1 | 3-3 | b-a | 0.32 | -1.56, 2.21 | 0.733 + 1-1 | 3-3 | b-c | -1.19 | -3.07, 0.69 | 0.213 + 1-1 | 3-3 | b-d | -0.16 | -2.04, 1.73 | 0.870 + 1-1 | 3-3 | d-c | -1.03 | -3.34, 1.27 | 0.375 --- @@ -287,129 +290,91 @@ print(test_predictions(m, terms = c("x1", "x2", "x3"), engine = "emmeans", test = "interaction")) Output - x1 x2 x3 Contrast conf.low conf.high p.value - 1 0-1 1 and 2 a and c -1.1711020 -4.3696060 2.0274021 0.4681012 - 2 0-1 1 and 2 a and d 0.1569589 -2.5128239 2.8267417 0.9070959 - 3 0-1 1 and 2 b and a 1.8802104 -1.1394094 4.8998302 0.2187374 - 4 0-1 1 and 2 b and c 0.7091084 -2.6345768 4.0527936 0.6739389 - 5 0-1 1 and 2 b and d 2.0371693 -0.8049325 4.8792711 0.1575042 - 6 0-1 1 and 2 d and c -1.3280609 -4.3595402 1.7034184 0.3856666 - 7 0-1 1 and 3 a and c -1.9776000 -5.1547512 1.1995513 0.2188987 - 8 0-1 1 and 3 a and d 1.0913269 -1.8716684 4.0543222 0.4654675 - 9 0-1 1 and 3 b and a 1.2217869 -1.6583071 4.1018810 0.4008171 - 10 0-1 1 and 3 b and c -0.7558130 -3.9676521 2.4560261 0.6406383 - 11 0-1 1 and 3 b and d 2.3131138 -0.6870465 5.3132741 0.1287960 - 12 0-1 1 and 3 d and c -3.0689268 -6.3553093 0.2174556 0.0667711 - 13 0-1 2 and 3 a and c -0.8064980 -4.3172344 2.7042385 0.6485929 - 14 0-1 2 and 3 a and d 0.9343680 -2.3793569 4.2480928 0.5760477 - 15 0-1 2 and 3 b and a -0.6584235 -3.6989406 2.3820936 0.6674738 - 16 0-1 2 and 3 b and c -1.4649215 -4.5483486 1.6185057 0.3470280 - 17 0-1 2 and 3 b and d 0.2759445 -2.5811563 3.1330453 0.8479735 - 18 0-1 2 and 3 d and c -1.7408660 -5.0940064 1.6122745 0.3044031 + # Interaction contrasts + + x1 | x2 | x3 | Contrast | 95% CI | p + -------------------------------------------------------- + 0-1 | 1 and 2 | a and c | -1.17 | -4.37, 2.03 | 0.468 + 0-1 | 1 and 2 | a and d | 0.16 | -2.51, 2.83 | 0.907 + 0-1 | 1 and 2 | b and a | 1.88 | -1.14, 4.90 | 0.219 + 0-1 | 1 and 2 | b and c | 0.71 | -2.63, 4.05 | 0.674 + 0-1 | 1 and 2 | b and d | 2.04 | -0.80, 4.88 | 0.158 + 0-1 | 1 and 2 | d and c | -1.33 | -4.36, 1.70 | 0.386 + 0-1 | 1 and 3 | a and c | -1.98 | -5.15, 1.20 | 0.219 + 0-1 | 1 and 3 | a and d | 1.09 | -1.87, 4.05 | 0.465 + 0-1 | 1 and 3 | b and a | 1.22 | -1.66, 4.10 | 0.401 + 0-1 | 1 and 3 | b and c | -0.76 | -3.97, 2.46 | 0.641 + 0-1 | 1 and 3 | b and d | 2.31 | -0.69, 5.31 | 0.129 + 0-1 | 1 and 3 | d and c | -3.07 | -6.36, 0.22 | 0.067 + 0-1 | 2 and 3 | a and c | -0.81 | -4.32, 2.70 | 0.649 + 0-1 | 2 and 3 | a and d | 0.93 | -2.38, 4.25 | 0.576 + 0-1 | 2 and 3 | b and a | -0.66 | -3.70, 2.38 | 0.667 + 0-1 | 2 and 3 | b and c | -1.46 | -4.55, 1.62 | 0.347 + 0-1 | 2 and 3 | b and d | 0.28 | -2.58, 3.13 | 0.848 + 0-1 | 2 and 3 | d and c | -1.74 | -5.09, 1.61 | 0.304 # test_predictions, engine emmeans, by and variable name = level value Code print(test_predictions(m, c("time", "coffee"), engine = "emmeans")) Output - time coffee Contrast conf.low conf.high - 1 afternoon-afternoon coffee-control 1.927659e+00 -2.0220794 5.8773984 - 2 afternoon-morning coffee-control 7.710638e+00 3.7608991 11.6603769 - 3 afternoon-noon coffee-control 1.927659e+00 -2.0220794 5.8773984 - 4 morning-afternoon coffee-coffee -1.927659e+00 -5.8773984 2.0220794 - 5 morning-afternoon coffee-control -3.552714e-15 -3.9497389 3.9497389 - 6 morning-afternoon control-control -5.782978e+00 -9.7327174 -1.8332396 - 7 morning-morning coffee-control 5.782978e+00 1.8332396 9.7327174 - 8 morning-noon coffee-coffee 1.927659e+00 -2.0220794 5.8773984 - 9 morning-noon coffee-control -6.217249e-15 -3.9497389 3.9497389 - 10 morning-noon control-control -5.782978e+00 -9.7327174 -1.8332396 - 11 noon-afternoon coffee-coffee -3.855319e+00 -7.8050579 0.0944199 - 12 noon-afternoon coffee-control -1.927659e+00 -5.8773984 2.0220794 - 13 noon-afternoon control-control 2.664535e-15 -3.9497389 3.9497389 - 14 noon-morning coffee-control 3.855319e+00 -0.0944199 7.8050579 - 15 noon-noon coffee-control -1.927659e+00 -5.8773984 2.0220794 - p.value - 1 0.3356540173 - 2 0.0001841091 - 3 0.3356540173 - 4 0.3356540173 - 5 1.0000000000 - 6 0.0044754582 - 7 0.0044754582 - 8 0.3356540173 - 9 1.0000000000 - 10 0.0044754582 - 11 0.0556363585 - 12 0.3356540173 - 13 1.0000000000 - 14 0.0556363585 - 15 0.3356540173 + # Pairwise comparisons + + time | coffee | Contrast | 95% CI | p + ------------------------------------------------------------------------ + afternoon-afternoon | coffee-control | 1.93 | -2.02, 5.88 | 0.336 + afternoon-morning | coffee-control | 7.71 | 3.76, 11.66 | < .001 + afternoon-noon | coffee-control | 1.93 | -2.02, 5.88 | 0.336 + morning-afternoon | coffee-coffee | -1.93 | -5.88, 2.02 | 0.336 + morning-afternoon | coffee-control | 0.00 | -3.95, 3.95 | > .999 + morning-afternoon | control-control | -5.78 | -9.73, -1.83 | 0.004 + morning-morning | coffee-control | 5.78 | 1.83, 9.73 | 0.004 + morning-noon | coffee-coffee | 1.93 | -2.02, 5.88 | 0.336 + morning-noon | coffee-control | 0.00 | -3.95, 3.95 | > .999 + morning-noon | control-control | -5.78 | -9.73, -1.83 | 0.004 + noon-afternoon | coffee-coffee | -3.86 | -7.81, 0.09 | 0.056 + noon-afternoon | coffee-control | -1.93 | -5.88, 2.02 | 0.336 + noon-afternoon | control-control | 0.00 | -3.95, 3.95 | > .999 + noon-morning | coffee-control | 3.86 | -0.09, 7.81 | 0.056 + noon-noon | coffee-control | -1.93 | -5.88, 2.02 | 0.336 --- Code print(test_predictions(m, c("time", "coffee"), by = "sex", engine = "emmeans")) Output - time coffee sex Contrast conf.low - 1 afternoon-afternoon coffee-control female 1.927659e+00 -2.0220794 - 2 afternoon-morning coffee-control female 7.710638e+00 3.7608991 - 3 afternoon-noon coffee-control female 1.927659e+00 -2.0220794 - 4 morning-afternoon coffee-coffee female -1.927659e+00 -5.8773984 - 5 morning-afternoon coffee-control female -3.552714e-15 -3.9497389 - 6 morning-afternoon control-control female -5.782978e+00 -9.7327174 - 7 morning-morning coffee-control female 5.782978e+00 1.8332396 - 8 morning-noon coffee-coffee female 1.927659e+00 -2.0220794 - 9 morning-noon coffee-control female -7.105427e-15 -3.9497389 - 10 morning-noon control-control female -5.782978e+00 -9.7327174 - 11 noon-afternoon coffee-coffee female -3.855319e+00 -7.8050579 - 12 noon-afternoon coffee-control female -1.927659e+00 -5.8773984 - 13 noon-afternoon control-control female 3.552714e-15 -3.9497389 - 14 noon-morning coffee-control female 3.855319e+00 -0.0944199 - 15 noon-noon coffee-control female -1.927659e+00 -5.8773984 - 16 afternoon-afternoon coffee-control male 1.927659e+00 -2.0220794 - 17 afternoon-morning coffee-control male 7.710638e+00 3.7608991 - 18 afternoon-noon coffee-control male 1.927659e+00 -2.0220794 - 19 morning-afternoon coffee-coffee male -1.927659e+00 -5.8773984 - 20 morning-afternoon coffee-control male -3.552714e-15 -3.9497389 - 21 morning-afternoon control-control male -5.782978e+00 -9.7327174 - 22 morning-morning coffee-control male 5.782978e+00 1.8332396 - 23 morning-noon coffee-coffee male 1.927659e+00 -2.0220794 - 24 morning-noon coffee-control male -5.329071e-15 -3.9497389 - 25 morning-noon control-control male -5.782978e+00 -9.7327174 - 26 noon-afternoon coffee-coffee male -3.855319e+00 -7.8050579 - 27 noon-afternoon coffee-control male -1.927659e+00 -5.8773984 - 28 noon-afternoon control-control male 1.776357e-15 -3.9497389 - 29 noon-morning coffee-control male 3.855319e+00 -0.0944199 - 30 noon-noon coffee-control male -1.927659e+00 -5.8773984 - conf.high p.value - 1 5.8773984 0.3356540173 - 2 11.6603769 0.0001841091 - 3 5.8773984 0.3356540173 - 4 2.0220794 0.3356540173 - 5 3.9497389 1.0000000000 - 6 -1.8332396 0.0044754582 - 7 9.7327174 0.0044754582 - 8 5.8773984 0.3356540173 - 9 3.9497389 1.0000000000 - 10 -1.8332396 0.0044754582 - 11 0.0944199 0.0556363585 - 12 2.0220794 0.3356540173 - 13 3.9497389 1.0000000000 - 14 7.8050579 0.0556363585 - 15 2.0220794 0.3356540173 - 16 5.8773984 0.3356540173 - 17 11.6603769 0.0001841091 - 18 5.8773984 0.3356540173 - 19 2.0220794 0.3356540173 - 20 3.9497389 1.0000000000 - 21 -1.8332396 0.0044754582 - 22 9.7327174 0.0044754582 - 23 5.8773984 0.3356540173 - 24 3.9497389 1.0000000000 - 25 -1.8332396 0.0044754582 - 26 0.0944199 0.0556363585 - 27 2.0220794 0.3356540173 - 28 3.9497389 1.0000000000 - 29 7.8050579 0.0556363585 - 30 2.0220794 0.3356540173 + # Pairwise comparisons + + time | coffee | sex | Contrast | 95% CI | p + --------------------------------------------------------------------------------- + afternoon-afternoon | coffee-control | female | 1.93 | -2.02, 5.88 | 0.336 + afternoon-morning | coffee-control | female | 7.71 | 3.76, 11.66 | < .001 + afternoon-noon | coffee-control | female | 1.93 | -2.02, 5.88 | 0.336 + morning-afternoon | coffee-coffee | female | -1.93 | -5.88, 2.02 | 0.336 + morning-afternoon | coffee-control | female | 0.00 | -3.95, 3.95 | > .999 + morning-afternoon | control-control | female | -5.78 | -9.73, -1.83 | 0.004 + morning-morning | coffee-control | female | 5.78 | 1.83, 9.73 | 0.004 + morning-noon | coffee-coffee | female | 1.93 | -2.02, 5.88 | 0.336 + morning-noon | coffee-control | female | 0.00 | -3.95, 3.95 | > .999 + morning-noon | control-control | female | -5.78 | -9.73, -1.83 | 0.004 + noon-afternoon | coffee-coffee | female | -3.86 | -7.81, 0.09 | 0.056 + noon-afternoon | coffee-control | female | -1.93 | -5.88, 2.02 | 0.336 + noon-afternoon | control-control | female | 0.00 | -3.95, 3.95 | > .999 + noon-morning | coffee-control | female | 3.86 | -0.09, 7.81 | 0.056 + noon-noon | coffee-control | female | -1.93 | -5.88, 2.02 | 0.336 + afternoon-afternoon | coffee-control | male | 1.93 | -2.02, 5.88 | 0.336 + afternoon-morning | coffee-control | male | 7.71 | 3.76, 11.66 | < .001 + afternoon-noon | coffee-control | male | 1.93 | -2.02, 5.88 | 0.336 + morning-afternoon | coffee-coffee | male | -1.93 | -5.88, 2.02 | 0.336 + morning-afternoon | coffee-control | male | 0.00 | -3.95, 3.95 | > .999 + morning-afternoon | control-control | male | -5.78 | -9.73, -1.83 | 0.004 + morning-morning | coffee-control | male | 5.78 | 1.83, 9.73 | 0.004 + morning-noon | coffee-coffee | male | 1.93 | -2.02, 5.88 | 0.336 + morning-noon | coffee-control | male | 0.00 | -3.95, 3.95 | > .999 + morning-noon | control-control | male | -5.78 | -9.73, -1.83 | 0.004 + noon-afternoon | coffee-coffee | male | -3.86 | -7.81, 0.09 | 0.056 + noon-afternoon | coffee-control | male | -1.93 | -5.88, 2.02 | 0.336 + noon-afternoon | control-control | male | 0.00 | -3.95, 3.95 | > .999 + noon-morning | coffee-control | male | 3.86 | -0.09, 7.81 | 0.056 + noon-noon | coffee-control | male | -1.93 | -5.88, 2.02 | 0.336 From 6652a00ce2dc22bf2713cfdc6b538d6d38c86478 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 18:04:28 +0100 Subject: [PATCH 47/51] (re)move vignettes --- {vignettes => WIP}/introduction_comparisons_1.Rmd | 4 ++-- {vignettes => WIP}/introduction_comparisons_2.Rmd | 0 {vignettes => WIP}/introduction_comparisons_3.Rmd | 0 {vignettes => WIP}/introduction_comparisons_4.Rmd | 0 {vignettes => WIP}/introduction_comparisons_5.Rmd | 0 vignettes/content.Rmd | 9 --------- 6 files changed, 2 insertions(+), 11 deletions(-) rename {vignettes => WIP}/introduction_comparisons_1.Rmd (97%) rename {vignettes => WIP}/introduction_comparisons_2.Rmd (100%) rename {vignettes => WIP}/introduction_comparisons_3.Rmd (100%) rename {vignettes => WIP}/introduction_comparisons_4.Rmd (100%) rename {vignettes => WIP}/introduction_comparisons_5.Rmd (100%) diff --git a/vignettes/introduction_comparisons_1.Rmd b/WIP/introduction_comparisons_1.Rmd similarity index 97% rename from vignettes/introduction_comparisons_1.Rmd rename to WIP/introduction_comparisons_1.Rmd index 6a38f11c..2bf0ea61 100644 --- a/vignettes/introduction_comparisons_1.Rmd +++ b/WIP/introduction_comparisons_1.Rmd @@ -147,7 +147,7 @@ By default, when all focal terms are categorical, a pairwise comparison is perfo test_predictions(model1, "episode") # same as test_predictions(my_predictions) ``` -For our quantity of interest, the contrast between episode `r ht1$episode[1]`, we see the value `r round(ht1$Contrast[1], 2)`, which is exactly the difference between the predicted outcome for `episode = 1` (`r round(my_predictions$predicted[1], 2)`) and `episode = 2` (`r round(my_predictions$predicted[2], 2)`). The related p-value is `r round(ht1$p.value[1], 3)`, indicating that the difference between the predicted values of our outcome at these two levels of the factor _episode_ is indeed statistically significant. +For our quantity of interest, the contrast between episode `r ht1$episode[1]`, we see the value `r round(ht1$Difference[1], 2)`, which is exactly the difference between the predicted outcome for `episode = 1` (`r round(my_predictions$predicted[1], 2)`) and `episode = 2` (`r round(my_predictions$predicted[2], 2)`). The related p-value is `r round(ht1$p.value[1], 3)`, indicating that the difference between the predicted values of our outcome at these two levels of the factor _episode_ is indeed statistically significant. Since the `terms` argument in `test_predictions()` works in the same way as for `predict_response()`, you can directly pass "representative values" via that argument (for details, see [this vignette](https://strengejacke.github.io/ggeffects/articles/introduction_effectsatvalues.html)). For example, we could also specify the levels of `episode` directly, to simplify the output: @@ -368,4 +368,4 @@ Thanks to the great *marginaleffects* package, it is now possible to have a powe While the current implementation in `test_predictions()` already covers many common use cases for testing contrasts and pairwise comparison, there still might be the need for more sophisticated comparisons. In this case, I recommend using the [*marginaleffects*](https://marginaleffects.com/) package directly. Some further related recommended readings are the vignettes about [Comparisons](https://marginaleffects.com/vignettes/comparisons.html) or [Hypothesis Tests](https://marginaleffects.com/vignettes/hypothesis.html). -[Go to next vignette: **Significance Testing of Differences Between Predictions II: Comparisons of Slopes, Floodlight and Spotlight Analysis (Johnson-Neyman Intervals)**](https://strengejacke.github.io/ggeffects/articles/introduction_comparisons_2.html) \ No newline at end of file +[Go to next vignette: **Significance Testing of Differences Between Predictions II: Comparisons of Slopes, Floodlight and Spotlight Analysis (Johnson-Neyman Intervals)**](https://strengejacke.github.io/ggeffects/articles/introduction_comparisons_2.html) diff --git a/vignettes/introduction_comparisons_2.Rmd b/WIP/introduction_comparisons_2.Rmd similarity index 100% rename from vignettes/introduction_comparisons_2.Rmd rename to WIP/introduction_comparisons_2.Rmd diff --git a/vignettes/introduction_comparisons_3.Rmd b/WIP/introduction_comparisons_3.Rmd similarity index 100% rename from vignettes/introduction_comparisons_3.Rmd rename to WIP/introduction_comparisons_3.Rmd diff --git a/vignettes/introduction_comparisons_4.Rmd b/WIP/introduction_comparisons_4.Rmd similarity index 100% rename from vignettes/introduction_comparisons_4.Rmd rename to WIP/introduction_comparisons_4.Rmd diff --git a/vignettes/introduction_comparisons_5.Rmd b/WIP/introduction_comparisons_5.Rmd similarity index 100% rename from vignettes/introduction_comparisons_5.Rmd rename to WIP/introduction_comparisons_5.Rmd diff --git a/vignettes/content.Rmd b/vignettes/content.Rmd index 53aecd7b..93741d76 100644 --- a/vignettes/content.Rmd +++ b/vignettes/content.Rmd @@ -27,15 +27,6 @@ The documentation of the *ggeffects* package, including many examples, is [avail - [Adjusted Predictions for Random Effects Models](https://strengejacke.github.io/ggeffects/articles/introduction_randomeffects.html) - [(Cluster) Robust Standard Errors](https://strengejacke.github.io/ggeffects/articles/practical_robustestimation.html) -## Interpretation and Significance Testing - -- [Contrasts and Pairwise Comparisons](https://strengejacke.github.io/ggeffects/articles/introduction_comparisons_1.html) -- [Floodlight and Spotlight Analysis (Johnson-Neyman Intervals)](https://strengejacke.github.io/ggeffects/articles/introduction_comparisons_2.html) -- [Contrasts and Pairwise Comparisons for GLM](https://strengejacke.github.io/ggeffects/articles/introduction_comparisons_3.html) -- [Contrasts and Pairwise Comparisons for Zero-Inflation Models](https://strengejacke.github.io/ggeffects/articles/introduction_comparisons_4.html) -- [Different Backends for Pairwise Comparisons](https://strengejacke.github.io/ggeffects/articles/introduction_comparisons_5.html) -- [Adding Partial Residuals to Effects Plots](https://strengejacke.github.io/ggeffects/articles/introduction_partial_residuals.html) - ## Creating and customizing plots and tables - [Plotting Adjusted Predictions](https://strengejacke.github.io/ggeffects/articles/introduction_plotmethod.html) From cc3dbf30b272a24ba388d06dcb0e35bc3ca24078 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 19:01:47 +0100 Subject: [PATCH 48/51] Update test-test_predictions-formula.R --- tests/testthat/test-test_predictions-formula.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-test_predictions-formula.R b/tests/testthat/test-test_predictions-formula.R index 9ac691ef..1c91727a 100644 --- a/tests/testthat/test-test_predictions-formula.R +++ b/tests/testthat/test-test_predictions-formula.R @@ -13,6 +13,6 @@ test_that("test_predictions, formula", { pr <- predict_response(m, terms = c("time", "treatment")) out1 <- test_predictions(pr, test = "consecutive", by = "treatment") out2 <- test_predictions(pr, test = difference ~ sequential | treatment) - expect_equal(out1$Contrast[1], out2$Contrast[2], tolerance = 1e-4) - expect_equal(out1$conf.low[1], out2$conf.low[2], tolerance = 1e-4) + expect_equal(out1$Contrast[1], out2$Difference[2], tolerance = 1e-4) + expect_equal(out1$conf.low[1], out2$CI_low[2], tolerance = 1e-4) }) From 1cecff033ee40abfa0a2128c6271d5bd2a40d556 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 19:04:19 +0100 Subject: [PATCH 49/51] Update test-johnson_neyman.R --- tests/testthat/test-johnson_neyman.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-johnson_neyman.R b/tests/testthat/test-johnson_neyman.R index f72739e7..f515fb67 100644 --- a/tests/testthat/test-johnson_neyman.R +++ b/tests/testthat/test-johnson_neyman.R @@ -1,5 +1,5 @@ skip_on_cran() -skip_on_os(c("mac", "solaris")) +skip_on_os(c("mac", "solaris", "linux")) skip_if_not_installed("marginaleffects") skip_if(getRversion() < "4.3.0") From 0a8e10632a29020c0fad63a424c936fc91d3c20f Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 19:04:58 +0100 Subject: [PATCH 50/51] Update test-parsnip.R --- tests/testthat/test-parsnip.R | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/testthat/test-parsnip.R b/tests/testthat/test-parsnip.R index bbe09c68..34020d6d 100644 --- a/tests/testthat/test-parsnip.R +++ b/tests/testthat/test-parsnip.R @@ -89,10 +89,3 @@ test_that("ggemmeans, parsnip", { expect_s3_class(ggemmeans(fit, "c12hour [meansd]"), "data.frame") expect_s3_class(ggemmeans(fit, "c12hour [minmax]"), "data.frame") }) - -test_that("test_predictions, parsnip", { - skip_on_os("linux") - out <- test_predictions(fit, "c172code") - expect_equal(out$Slope, 0.71836, tolerance = 0.1) - expect_equal(out$conf.low, -1.928975, tolerance = 0.1) -}) From cfbd777db469b58c8efddce875727133631a9f27 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 5 Feb 2025 19:06:42 +0100 Subject: [PATCH 51/51] docs --- R/format.R | 8 ++++++++ man/print.Rd | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/R/format.R b/R/format.R index 07e21a94..f3ab5123 100644 --- a/R/format.R +++ b/R/format.R @@ -11,6 +11,14 @@ #' @param collapse_tables Logical, if `TRUE`, all tables are combined into one. #' The tables are not split by further focal terms, but rather are added as #' columns. Only works when there is more than one focal term. +#' @param collapse_p Logical, if `TRUE`, the columns with predicted values and +#' p-values are collapsed into one column, where significant p-values are +#' indicated as asterisks. +#' @param combine_levels Logical, if `TRUE`, the levels of the first comparison +#' of each focal term against the second are combined into one column. This is +#' useful when comparing multiple focal terms, e.g. `education = low-high` and +#' `gender = male-female` are combined into `first = low-male` and +#' `second = high-female`. #' #' @rdname print #' @export diff --git a/man/print.Rd b/man/print.Rd index 21b8774c..c43d20ec 100644 --- a/man/print.Rd +++ b/man/print.Rd @@ -86,6 +86,16 @@ of rows is printed, depending on the number of subgroups.} them are also passed down further to \code{\link[insight:format_table]{insight::format_table()}} or \code{\link[insight:format_value]{insight::format_value()}}.} +\item{collapse_p}{Logical, if \code{TRUE}, the columns with predicted values and +p-values are collapsed into one column, where significant p-values are +indicated as asterisks.} + +\item{combine_levels}{Logical, if \code{TRUE}, the levels of the first comparison +of each focal term against the second are combined into one column. This is +useful when comparing multiple focal terms, e.g. \code{education = low-high} and +\code{gender = male-female} are combined into \code{first = low-male} and +\code{second = high-female}.} + \item{verbose}{Toggle messages.} \item{theme}{The theme to apply to the table. One of \code{"grid"}, \code{"striped"},