Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Poppy Miller
sourceR
Commits
578e652e
Commit
578e652e
authored
Apr 10, 2017
by
Chris Jewell
Browse files
Wrote multidimensional test for HaldDP.
parent
ed8d944d
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/testthat/haldDPdataStrct.rds
0 → 100644
View file @
578e652e
File added
tests/testthat/testHaldDP.R
View file @
578e652e
...
...
@@ -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"
)
})
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment