Skip to content

Commit

Permalink
fix tmbstan error
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea-Havron-NOAA committed Jun 25, 2024
1 parent 9532ca6 commit 6682441
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/test-predictive-prior.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ print(obj$gr(obj$par))
# })

test_that("test tmbstan, single predictive prior", {
fit <- tmbstan::tmbstan(obj, init = "best.last.par")
fit <- tmbstan::tmbstan(obj)
#pairs(fit, pars=names(obj$par))
postmle <- as.matrix(fit)
expect_equal(unname(mu[1]), median(postmle[,1]), tolerance = .1)
Expand Down Expand Up @@ -157,10 +157,10 @@ obj <- TMB::MakeADFun(Data, Parameters, DLL="ModularTMBExample")
#newtonOption(obj, smartsearch=FALSE)

test_that("test tmbstan, predictive mutivariate prior", {
fit <- tmbstan::tmbstan(obj, init = "best.last.par", iter = 4000)
fit <- tmbstan::tmbstan(obj)
#pairs(fit, pars=names(obj$par))
#traceplot(fit, pars=names(obj$par), inc_warmup=TRUE)
postmle <- as.matrix(fit)[,1:2]
expect_equal(unname(mu), unname(apply(postmle, 2, median)), tolerance = .01)
expect_equal(unname(Sigma), unname(var(postmle)), tolerance = .1)
})
})

0 comments on commit 6682441

Please sign in to comment.