Skip to content

Commit

Permalink
minor test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Mar 19, 2024
1 parent 05a0eb0 commit 8b7f494
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions tests/local/tests.models-3.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test_that("generalized extreme value models work correctly", {
bf(SeaLevel ~ cYear + SOI,
sigma ~ s(cYear, bs = "bs", m = 1, k = 3) + SOI),
data = fremantle, family = gen_extreme_value(),
knots = knots, inits = 0.5, chains = 4,
knots = knots, init = 0.5, chains = 4,
control = list(adapt_delta = 0.95), refresh = 0
)
print(fit_gev)
Expand Down Expand Up @@ -182,22 +182,22 @@ test_that("Mixture models work correctly", {
fit1 <- brm(
bform1, data = dat, family = mixfam,
prior = c(prior, prior(dirichlet(1, 1, 1), theta)),
chains = 2, inits = 0, refresh = 0
chains = 2, init = 0, refresh = 0, seed = 1234
)
print(fit1)
expect_ggplot(pp_check(fit1))
loo1 <- LOO(fit1)
loo1 <- loo(fit1)
expect_equal(dim(pp_mixture(fit1)), c(nobs(fit1), 4, 3))

bform2 <- bf(bform1, theta1 = 1, theta2 = 1, theta3 = 1)
fit2 <- brm(
bform2, data = dat, family = mixfam,
prior = prior, chains = 2,
inits = 0, refresh = 0
init = 0, refresh = 0
)
print(fit2)
expect_ggplot(pp_check(fit2))
loo2 <- LOO(fit2)
loo2 <- loo(fit2)
expect_gt(loo2$estimates[3, 1], loo1$estimates[3, 1])
expect_equal(dim(pp_mixture(fit2)), c(nobs(fit2), 4, 3))

Expand Down
6 changes: 3 additions & 3 deletions tests/local/tests.models-5.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,21 @@ test_that("projpred methods can be run", {

test_that("alternative algorithms can be used", {
fit <- brm(
count ~ zBase * Trt, data = epilepsy,
count ~ zBase, data = epilepsy,
backend = "cmdstanr", algorithm = "meanfield"
)
summary(fit)
expect_is(fit, "brmsfit")

fit <- brm(
count ~ zBase * Trt, data = epilepsy,
count ~ zBase, data = epilepsy,
backend = "cmdstanr", algorithm = "pathfinder"
)
summary(fit)
expect_is(fit, "brmsfit")

fit <- brm(
count ~ zBase * Trt, data = epilepsy,
count ~ zBase, data = epilepsy,
backend = "cmdstanr", algorithm = "laplace"
)
summary(fit)
Expand Down

0 comments on commit 8b7f494

Please sign in to comment.