Skip to content

Commit

Permalink
fix tmbstan calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea-Havron-NOAA committed May 22, 2024
1 parent 58c3bfc commit da27b84
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
8 changes: 6 additions & 2 deletions tests/testthat/test-multivariate-prior.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,18 @@ test_that("test multivariate prior", {
expect_equal( log(.1) > ci[[3]][1] & log(.1) < ci[[3]][2], TRUE)
})

DataNLL$finalize(opt$par)
GrowthMVPrior$finalize(opt$par)
DataNLL$nll_vec
GrowthMVPrior$nll_vec
#Fully Bayesian
test_that("test_tmbstan", {
skip_on_ci("skip tmbstan")
library(tmbstan)
library(shinystan)
library(ggplot2)
newobj <- tmbstan(obj, warmup = 1000, iter = 4000)
launch_shinystan(newobj)
fit <- tmbstan(obj, init = "best.last.par")
launch_shinystan(obj)
})

clear()
Expand Down
13 changes: 7 additions & 6 deletions tests/testthat/test-predictive-prior.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ test_that("test single prior",{
expect_equal( log(.1) > ci[[3]][1] & log(.1) < ci[[3]][2], TRUE)
})

test_that( "test_tmbstan", {
skip_on_ci(library(tmbstan))
skip_on_ci(fit <- tmbstan(obj))
skip_on_ci(library(shinystan))
skip_on_ci(library(ggplot2))
skip_on_ci(launch_shinystan(fit))
test_that("test_tmbstan", {
skip_on_ci("skip tmbstan")
library(tmbstan)
library(shinystan)
library(ggplot2)
fit <- tmbstan(obj, init = "best.last.par")
launch_shinystan(obj)
})

clear()
Expand Down
20 changes: 13 additions & 7 deletions tests/testthat/test-prior.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,20 @@ test_that("test single prior",{
expect_equal( log(.1) > ci[[3]][1] & log(.1) < ci[[3]][2], TRUE)
})

test_that( "test_tmbstan", {
skip_on_ci(library(tmbstan))
skip_on_ci(fit <- tmbstan(obj))
skip_on_ci(library(shinystan))
skip_on_ci(library(ggplot2))
skip_on_ci(launch_shinystan(fit))
#Check nll output
DataNLL$finalize(opt$par)
GrowthKPrior$finalize(opt$par)
DataNLL$nll_vec
GrowthKPrior$nll_vec

test_that("test_tmbstan", {
skip_on_ci("skip tmbstan")
library(tmbstan)
library(shinystan)
library(ggplot2)
fit <- tmbstan(obj, init = "best.last.par")
launch_shinystan(obj)
})

clear()
# #update the von Bertalanffy object with updated parameters
# vonB$finalize(rep$par.fixed)
Expand Down

0 comments on commit da27b84

Please sign in to comment.