|
16 | 16 | #' names. In this case, all parameters that have no matching name in `range` |
17 | 17 | #' will be set to `"default"`. |
18 | 18 | #' |
19 | | -#' In multivariate models, `range` should be a list with a numeric vectors for |
20 | | -#' each response variable. Vector names should correspond to the name of the |
21 | | -#' response variables. If `"default"` and input is a vector, the range is set to |
22 | | -#' `c(-0.1, 0.1)`. If `"default"` and input is a Bayesian model, |
23 | | -#' [`rope_range()`] is used. |
| 19 | +#' In multivariate models, `range` should be a list with another list (one for |
| 20 | +#' each response variable) of numeric vectors . Vector names should correspond to |
| 21 | +#' the name of the response variables. If `"default"` and input is a vector, the |
| 22 | +#' range is set to `c(-0.1, 0.1)`. If `"default"` and input is a Bayesian model, |
| 23 | +#' [`rope_range()`] is used. See 'Examples'. |
24 | 24 | #' @param ci The Credible Interval (CI) probability, corresponding to the |
25 | 25 | #' proportion of HDI, to use for the percentage in ROPE. |
26 | 26 | #' @param ci_method The type of interval to use to quantify the percentage in |
|
128 | 128 | #' rope(emtrends(model, ~1, "wt"), ci = c(0.90, 0.95)) |
129 | 129 | #' |
130 | 130 | #' library(brms) |
131 | | -#' model <- brm(mpg ~ wt + cyl, data = mtcars) |
| 131 | +#' model <- brm(mpg ~ wt + cyl, data = mtcars, refresh = 0) |
132 | 132 | #' rope(model) |
133 | 133 | #' rope(model, ci = c(0.90, 0.95)) |
134 | 134 | #' |
135 | 135 | #' library(brms) |
136 | 136 | #' model <- brm( |
137 | 137 | #' bf(mvbind(mpg, disp) ~ wt + cyl) + set_rescor(rescor = TRUE), |
138 | | -#' data = mtcars |
| 138 | +#' data = mtcars, |
| 139 | +#' refresh = 0 |
139 | 140 | #' ) |
140 | 141 | #' rope(model) |
141 | 142 | #' rope(model, ci = c(0.90, 0.95)) |
142 | 143 | #' |
| 144 | +#' # different ROPE ranges for model parameters. For each response, a named |
| 145 | +#' # list (with the name of the response variable) is required as list-element |
| 146 | +#' # for the `range` argument. |
| 147 | +#' rope( |
| 148 | +#' model, |
| 149 | +#' range = list( |
| 150 | +#' mpg = list(b_mpg_wt = c(-1, 1), b_mpg_cyl = c(-2, 2)), |
| 151 | +#' disp = list(b_disp_wt = c(-5, 5), b_disp_cyl = c(-4, 4)) |
| 152 | +#' ) |
| 153 | +#' ) |
| 154 | +#' |
143 | 155 | #' library(BayesFactor) |
144 | 156 | #' bf <- ttestBF(x = rnorm(100, 1, 1)) |
145 | 157 | #' rope(bf) |
@@ -453,7 +465,7 @@ rope.brmsfit <- function(x, |
453 | 465 | !all(names(range) %in% insight::find_response(x)) |
454 | 466 | ) { |
455 | 467 | insight::format_error( |
456 | | - "With a multivariate model, `range` should be 'default' or a list of named numeric vectors with length 2." |
| 468 | + "With a multivariate model, `range` should be 'default' or a list with multiple lists (one for each response) of named numeric vectors with length 2." |
457 | 469 | ) |
458 | 470 | } |
459 | 471 | } else if (!is.list(range) && (!all(is.numeric(range)) || length(range) != 2)) { |
|
0 commit comments