Commit 3d904df0 authored by Chris Jewell's avatar Chris Jewell
Browse files

Updated HaldDP test for new data structures.

parent f5ee26e8
......@@ -53,8 +53,7 @@ dat <- structure(
k <- data.frame(
Value = rep(1, 6),
Source = colnames(campy[, 2:7]),
Time = rep("1", 6),
Location = rep("A", 6)
Time = rep("1", 6)
)
# Test priors
priors <-
......@@ -69,8 +68,30 @@ priors <-
# Test suite
test_that("HaldDP model construction", {
set.seed(1)
y = Y(dat, y = 'Human', type = 'Type')
src = melt(
dat,
id.vars = c('Time', 'Type'),
measure.vars = c(
'ChickenA',
'ChickenB',
'ChickenC',
'Bovine',
'Ovine',
'Environment'
),
variable.name = 'Source',
value.name = 'Count'
)
x = X(src,
x = 'Count',
type = 'Type',
source = 'Source')
k = Prev(k, prev = 'Value', source = 'Source')
model <- HaldDP$new(
data = dat,
y = y,
x = x,
k = k,
priors = priors,
a_q = 0.1
......@@ -93,5 +114,3 @@ test_that("HaldDP model construction", {
model$update()
expect_equal_to_reference(model$summary(), "haldDPres3.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