Skip to content

Commit

Permalink
move check of prior boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Aug 11, 2023
1 parent b7c2bec commit 3722c16
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions R/priors.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <- ""
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 3722c16

Please sign in to comment.