Skip to content

Commit

Permalink
Merge branch 'develop' into 44-generalize-setting-the-priors-dependen…
Browse files Browse the repository at this point in the history
…t-on-the-specified-formula
  • Loading branch information
GidonFrischkorn authored Feb 19, 2024
2 parents 5ead410 + 286e2bb commit cdbcf0c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

### Bug fixes
* fix a bug in the mixture3p and IMM models which caused an error when intercept was not supressed and set size was used as predictor
* add postprocessing methods for sdmSimple to allow for pp_check(), conditional_effects and bridgesampling usage with the model (#30)


# bmm 0.3.0

Expand Down
18 changes: 18 additions & 0 deletions R/bmm_model_sdmSimple.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ configure_model.sdmSimple <- function(model, data, formula) {
"sdm_simple", dpars = c("mu", "c","kappa"),
links = c("identity","identity", "log"), lb = c(NA, NA, NA),
type = "real", loop=FALSE,
log_lik = log_lik_sdm_simple,
posterior_predict = posterior_predict_sdm_simple
)
family <- sdm_simple

Expand Down Expand Up @@ -146,3 +148,19 @@ postprocess_brm.sdmSimple <- function(model, fit) {
fit$formula$family$link_c <- "log"
fit
}

log_lik_sdm_simple <- function(i, prep) {
mu <- brms::get_dpar(prep, "mu", i = i)
c <- brms::get_dpar(prep, "c", i = i)
kappa <- brms::get_dpar(prep, "kappa", i = i)
y <- prep$data$Y[i]
dsdm(y, mu, c, kappa, log=T)
}

posterior_predict_sdm_simple <- function(i, prep, ...) {
mu <- brms::get_dpar(prep, "mu", i = i)
c <- brms::get_dpar(prep, "c", i = i)
kappa <- brms::get_dpar(prep, "kappa", i = i)
rsdm(length(mu), mu, c, kappa)
}

0 comments on commit cdbcf0c

Please sign in to comment.