Commit 578e652e authored by Chris Jewell's avatar Chris Jewell
Browse files

Wrote multidimensional test for HaldDP.

parent ed8d944d
......@@ -82,10 +82,10 @@ test_that("HaldDP model construction", {
expect_error(model$summary())
model$update()
expect_equal_to_reference(model$summary(), "haldDPres1.rds")
model$update(n_iter=100)
model$update(n_iter = 100)
expect_equal_to_reference(model$summary(), "haldDPres2.rds")
expect_equal_to_reference(model$extract('lambda_j'), "haldDPlambdaj.rds")
expect_equal_to_reference(model$extract(flatten=TRUE), 'haldDPFlat.rds')
expect_equal_to_reference(model$extract(flatten = TRUE), 'haldDPFlat.rds')
model$fit_params(n_iter = 100,
burn_in = 10,
thin = 5)
......@@ -93,3 +93,20 @@ test_that("HaldDP model construction", {
model$update()
expect_equal_to_reference(model$summary(), "haldDPres3.rds")
})
test_that("Test time/location data structures", {
set.seed(1)
ss = group_by(sim_SA_data, Time, Location) %>%
slice(1:10) %>% ungroup %>% as.data.frame
model = HaldDP$new(
data = ss,
k = sim_SA_prev,
priors = priors,
a_q = 0.1
)
model$fit_params(n_iter = 100,
burn_in = 0,
thin = 1)
model$update()
expect_equal_to_reference(model$summary(), "haldDPdataStrct.rds")
})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment