From ccfa2ef9295c7dbde17cbe9f22a218abcb681bd8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 17 Sep 2024 12:18:07 +0200 Subject: [PATCH] fix --- R/equivalence_test.R | 2 ++ R/p_significance.R | 2 +- R/rope.R | 3 +++ man/equivalence_test.Rd | 2 ++ man/p_significance.Rd | 2 +- man/rope.Rd | 3 +++ tests/testthat/test-rope.R | 2 +- 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/R/equivalence_test.R b/R/equivalence_test.R index daec8dc79..638af6102 100644 --- a/R/equivalence_test.R +++ b/R/equivalence_test.R @@ -87,6 +87,8 @@ #' equivalence_test(model) #' # multiple ROPE ranges - asymmetric, symmetric, default #' equivalence_test(model, range = list(c(10, 40), c(-5, -4), "default")) +#' # named ROPE ranges +#' equivalence_test(model, range = list(wt = c(-5, -4), `(Intercept)` = c(10, 40))) #' #' # plot result #' test <- equivalence_test(model) diff --git a/R/p_significance.R b/R/p_significance.R index 6edd70c8d..12a692c1b 100644 --- a/R/p_significance.R +++ b/R/p_significance.R @@ -59,7 +59,7 @@ #' p_significance(model) #' # multiple thresholds - asymmetric, symmetric, default #' p_significance(model, threshold = list(c(-10, 5), 0.2, "default")) -#' # names thresholds +#' # named thresholds #' p_significance(model, threshold = list(wt = 0.2, `(Intercept)` = c(-10, 5))) #' } #' @export diff --git a/R/rope.R b/R/rope.R index b678c24eb..24c3a9b4a 100644 --- a/R/rope.R +++ b/R/rope.R @@ -121,6 +121,9 @@ #' # multiple ROPE ranges #' rope(model, range = list(c(-10, 5), c(-0.2, 0.2), "default")) #' +#' # named ROPE ranges +#' rope(model, range = list(gear = c(-3, 2), wt = c(-0.2, 0.2))) +#' #' library(emmeans) #' rope(emtrends(model, ~1, "wt"), ci = c(0.90, 0.95)) #' diff --git a/man/equivalence_test.Rd b/man/equivalence_test.Rd index adc86a51e..27fc778f7 100644 --- a/man/equivalence_test.Rd +++ b/man/equivalence_test.Rd @@ -175,6 +175,8 @@ model <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars) equivalence_test(model) # multiple ROPE ranges - asymmetric, symmetric, default equivalence_test(model, range = list(c(10, 40), c(-5, -4), "default")) +# named ROPE ranges +equivalence_test(model, range = list(wt = c(-5, -4), `(Intercept)` = c(10, 40))) # plot result test <- equivalence_test(model) diff --git a/man/p_significance.Rd b/man/p_significance.Rd index 38abc8d2e..5d6d0fbaf 100644 --- a/man/p_significance.Rd +++ b/man/p_significance.Rd @@ -137,7 +137,7 @@ model <- rstanarm::stan_glm(mpg ~ wt + cyl, p_significance(model) # multiple thresholds - asymmetric, symmetric, default p_significance(model, threshold = list(c(-10, 5), 0.2, "default")) -# names thresholds +# named thresholds p_significance(model, threshold = list(wt = 0.2, `(Intercept)` = c(-10, 5))) } \dontshow{\}) # examplesIf} diff --git a/man/rope.Rd b/man/rope.Rd index 21f960185..242edb880 100644 --- a/man/rope.Rd +++ b/man/rope.Rd @@ -183,6 +183,9 @@ rope(model, ci = c(0.90, 0.95)) # multiple ROPE ranges rope(model, range = list(c(-10, 5), c(-0.2, 0.2), "default")) +# named ROPE ranges +rope(model, range = list(gear = c(-3, 2), wt = c(-0.2, 0.2))) + library(emmeans) rope(emtrends(model, ~1, "wt"), ci = c(0.90, 0.95)) diff --git a/tests/testthat/test-rope.R b/tests/testthat/test-rope.R index c7c8eead5..0c9059854 100644 --- a/tests/testthat/test-rope.R +++ b/tests/testthat/test-rope.R @@ -53,7 +53,7 @@ test_that("rope", { # list range expect_equal( rope(m, range = list(c(-1, 0.1), "default", "default", c(-1, 1), c(-1.5, -1)))$ROPE_Percentage, - c(0.15823, 1, 0, 0.3903, 0.38186) + c(0.15823, 1, 0, 0.3903, 0.38186), tolerance = 1e-3 )