From 3722c16bfb526f150fc6454d4558aa62e989cd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul-Christian=20B=C3=BCrkner?= Date: Fri, 11 Aug 2023 11:18:23 +0200 Subject: [PATCH] move check of prior boundaries --- R/priors.R | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/R/priors.R b/R/priors.R index 80a126455..2e3162537 100644 --- a/R/priors.R +++ b/R/priors.R @@ -382,13 +382,6 @@ set_prior <- function(prior, class = "b", coef = "", group = "", check <- as_one_logical(check) lb <- as_one_character(lb, allow_na = TRUE) ub <- as_one_character(ub, allow_na = TRUE) - if (check && (!is.na(lb) || !is.na(ub))) { - # proper boundaries have been specified - if (nzchar(coef)) { - # TODO: enable bounds for coefficients as well? - stop2("Argument 'coef' may not be specified when using boundaries.") - } - } if (dpar == "mu") { # distributional parameter 'mu' is currently implicit #1368 dpar <- "" @@ -1257,6 +1250,12 @@ validate_prior <- function(prior, formula, data, family = gaussian(), # the remaining NAs are in coef priors which cannot have bounds yet prior$lb[is.na(prior$lb)] <- prior$ub[is.na(prior$ub)] <- "" + # boundaries on individual coefficients are not yet supported + # TODO: enable bounds for coefficients as well? + if (any((nzchar(prior$lb) | nzchar(prior$ub)) & nzchar(prior$coef))) { + stop2("Prior argument 'coef' may not be specified when using boundaries.") + } + # merge user-specified priors with default priors prior$new <- rep(TRUE, nrow(prior)) all_priors$new <- rep(FALSE, nrow(all_priors))