Skip to content

Commit

Permalink
fix issue #1703
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Nov 8, 2024
1 parent 7a2eb2d commit f7106d4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: brms
Encoding: UTF-8
Type: Package
Title: Bayesian Regression Models using 'Stan'
Version: 2.22.4
Version: 2.22.5
Date: 2024-11-08
Authors@R:
c(person("Paul-Christian", "Bürkner", email = "[email protected]",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* Fit extended-support Beta models via family `xbeta`
thanks to Ioannis Kosmidis. (#1698)

### Other Changes

* Improve sampling efficiency of `beta_binomial` models. (#1703)

# brms 2.22.0

### New Features
Expand Down
14 changes: 7 additions & 7 deletions R/stan-likelihood.R
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,15 @@ stan_log_lik_binomial <- function(bterms, ...) {
}

stan_log_lik_beta_binomial <- function(bterms, ...) {
p <- stan_log_lik_dpars(bterms, reqn = TRUE)
p <- stan_log_lik_dpars(bterms)
p$trials <- stan_log_lik_advars(bterms, "trials", ...)$trials
req_dot_multiply <- !stan_log_lik_adj(bterms) && is_pred_dpar(bterms, "phi")
multiply <- str_if(req_dot_multiply, " .* ", " * ")
sdist(
"beta_binomial",
p$trials,
paste0(p$mu, " * ", p$phi),
paste0("(1 - ", p$mu, ") * ", p$phi),
vec = FALSE
paste0(p$mu, multiply, p$phi),
paste0("(1 - ", p$mu, ")", multiply, p$phi)
)
}

Expand Down Expand Up @@ -732,9 +733,8 @@ stan_log_lik_beta <- function(bterms, ...) {
}

stan_log_lik_xbeta <- function(bterms, ...) {
reqn <- stan_log_lik_adj(bterms)
p <- stan_log_lik_dpars(bterms, reqn = reqn)
sdist("xbeta", p$mu, p$phi, p$kappa, vec = TRUE)
p <- stan_log_lik_dpars(bterms)
sdist("xbeta", p$mu, p$phi, p$kappa)
}

stan_log_lik_von_mises <- function(bterms, ...) {
Expand Down

0 comments on commit f7106d4

Please sign in to comment.