diff --git a/NEWS.md b/NEWS.md index 1789ad526..bb50517a2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,6 @@ Marta Kołczyńska. `mm` for easy specification of group-level correlation structures. * Improve workflow to feed back brms-created models which were fitted somewhere else back into brms. (#745) -* Allow `cosy` correlations to be negative. (#878) ### Bug Fixes diff --git a/R/stan-predictor.R b/R/stan-predictor.R index cb6dffa14..f55365fda 100644 --- a/R/stan-predictor.R +++ b/R/stan-predictor.R @@ -1202,14 +1202,15 @@ stan_ac <- function(bterms, data, prior, ...) { if (NROW(acef_cosy)) { # compound symmetry correlation structure # most code is shared with ARMA covariance models - # cosy correlations may be negative (#878) - str_add(out$tdata_def) <- glue( - " real lb_cosy{p} = -1.0 / (max(nobs_tg{p}) - 1);", - " // lower bound of the cosy correlation\n" - ) + # cosy correlations may be negative in theory but + # this causes problems divergent transitions (#878) + # str_add(out$tdata_def) <- glue( + # " real lb_cosy{p} = -1.0 / (max(nobs_tg{p}) - 1);", + # " // lower bound of the cosy correlation\n" + # ) str_add_list(out) <- stan_prior( prior, class = "cosy", px = px, suffix = p, - type = glue("real"), + type = glue("real"), comment = "compound symmetry correlation" ) } diff --git a/tests/testthat/tests.make_stancode.R b/tests/testthat/tests.make_stancode.R index a25692e8b..3fbb04099 100644 --- a/tests/testthat/tests.make_stancode.R +++ b/tests/testthat/tests.make_stancode.R @@ -690,7 +690,7 @@ test_that("Stan code for compound symmetry models is correct", { y ~ x + cosy(time), dat, prior = prior(normal(0, 2), cosy) ) - expect_match2(scode, "real cosy;") + expect_match2(scode, "real cosy;") expect_match2(scode, "chol_cor = cholesky_cor_cosy(cosy, max_nobs_tg);") expect_match2(scode, "target += normal_lpdf(cosy | 0, 2);")