expect_match2(stancode, "vector<lower=0, upper=1>[n_series] alpha_gp;") is not TRUE

`actual`:   FALSE
`expected`: TRUE

test_that("get_mvgam_priors works for a variety of ma and cor trends", {
priors <- get_mvgam_priors(y ~ s(season, k = 7),
trend_model = AR(p = 2, ma = TRUE, cor = TRUE),
trend_model = RW(ma = TRUE, cor = TRUE),
beta_data <- sim_mvgam(family = betar(),
test_that("get_mvgam_priors finds all classes for which priors can be specified", {
c("(Intercept)", "cov fixed effect", "cov2 fixed effect",
"cov:cov2 fixed effect", "s(season) smooth parameters",
test_that("family must be correctly specified", {
test_that("trend_model must be correctly specified", {
test_that("response variable must follow family-specific restrictions", {
'Values <= 0 not allowed for lognormal responses')
'Values < 0 not allowed for count family responses')
test_that("default intercept prior should match brms implementation", {
simdat <- sim_mvgam(family = gaussian(), mu = 500)
def_prior <- get_mvgam_priors(y ~ s(season),
paste0(brms::get_prior(y ~ 1, data = data.frame(y = simdat$data_train$y),
simdat <- sim_mvgam(family = poisson(), mu = 0)
simdat <- sim_mvgam(family = betar(), mu = 0)
simdat <- sim_mvgam(family = nb(), mu = 0)
test_that("specified priors appear in the Stan code", {
priors <- get_mvgam_priors(formula = y ~ s(season, bs = 'cc'),
priors$prior[3] <- "alpha_gp ~ normal(-1, 0.75);"
stancode <- mvgam(y ~ s(season, bs = 'cc'),
# Now the same using brms functionality; this time use a bound as well
priors <- prior(normal(-1, 0.75), class = alpha_gp, ub = 1)
test_that("specified trend_formula priors appear in the Stan code", {
priors <- get_mvgam_priors(formula = y ~ 1,
trend_formula = ~ s(season, bs = 'cc') +
priors$prior[5] <- "year_trend ~ uniform(-2, 1);"
test_that("priors on parametric effects behave correctly", {
priors$prior[1] <- "(Intercept) ~ normal(-1, 0.75);"
priors <- prior(normal(-1, 0.75), class = Intercept)
stancode <- mvgam(formula = y ~ s(season, bs = 'cc'),
# Bounds not allowed on parametric effect priors yet
priors <- prior(normal(-1, 0.75), class = `Intercept`, lb = 0)
expect_warning(mvgam(formula = y ~ s(season, bs = 'cc'),
test_that("priors on gp() effects work properly", {
mod <- mvgam(formula = y ~ gp(time, by = series, scale = FALSE),
trend_formula = ~ gp(season, scale = FALSE),