Skip to content

Commit

Permalink
Merge pull request #1632 from venpopov/feature/von_mises_mu_prior
Browse files Browse the repository at this point in the history
change default prior for von_mises mu tan_half link
  • Loading branch information
paul-buerkner authored Mar 23, 2024
2 parents 562ce64 + 0439339 commit 8bb3476
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/family-lists.R
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,14 @@
ybounds = c(-pi, pi), closed = c(TRUE, TRUE),
ad = c("weights", "subset", "cens", "trunc", "mi", "index"),
include = c("fun_tan_half.stan", "fun_von_mises.stan"),
normalized = ""
normalized = "",
# experimental use of default priors stored in families #1614
prior = function(dpar, link = "identity", ...) {
if (dpar == "mu" && link == "tan_half") {
return("student_t(1, 0, 1)")
}
NULL
}
)
}

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/tests.stancode.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ test_that("specified priors appear in the Stan code", {
# tests use of default priors stored in families #1614
scode <- stancode(y ~ x1, dat, family = negbinomial())
expect_match2(scode, "lprior += inv_gamma_lpdf(shape | 0.4, 0.3);")
scode <- stancode(y ~ x2, dat, family = von_mises())
expect_match2(scode, "lprior += student_t_lpdf(Intercept | 1, 0, 1);")

prior <- prior(gamma(0, 1), coef = x1)
expect_warning(stancode(y ~ x1, dat, prior = prior),
Expand Down

0 comments on commit 8bb3476

Please sign in to comment.