Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jsocolar committed Dec 5, 2023
1 parent 8528e70 commit 2327b89
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions data-raw/example_flocker_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ example_flocker_model_single <- flock(
backend = "cmdstanr",
cores = 4,
iter = 1000,
warmup = 997
warmup = 996
)

#### single-season rep-constant model ####
Expand All @@ -30,7 +30,7 @@ example_flocker_model_single_C <- flock(
backend = "cmdstanr",
cores = 4,
iter = 1000,
warmup = 997
warmup = 996
)

#### data augmented model ####
Expand All @@ -51,7 +51,7 @@ example_flocker_model_aug <- flock(
backend = "cmdstanr",
cores = 4,
iter = 1000,
warmup = 997
warmup = 996
)

#### multiseason colex with explicit inits ####
Expand All @@ -74,7 +74,7 @@ example_flocker_model_multi_colex_ex <- flock(
cores = 4,
backend = "cmdstanr",
iter = 1000,
warmup = 997
warmup = 996
)

#### multiseason colex with equilibrium inits ####
Expand All @@ -96,7 +96,7 @@ example_flocker_model_multi_colex_eq <- flock(
cores = 4,
backend = "cmdstanr",
iter = 1000,
warmup = 997
warmup = 996
)

#### multiseason autologistic with explicit inits ####
Expand All @@ -119,7 +119,7 @@ example_flocker_model_multi_auto_ex <- flock(
cores = 4,
backend = "cmdstanr",
iter = 1000,
warmup = 997
warmup = 996
)

#### multiseason autologistic with equilibrium inits ####
Expand All @@ -141,7 +141,7 @@ example_flocker_model_multi_auto_eq <- flock(
cores = 4,
backend = "cmdstanr",
iter = 1000,
warmup = 997
warmup = 996
)

usethis::use_data(example_flocker_model_single, overwrite = TRUE)
Expand Down
Binary file modified data/example_flocker_model_aug.rda
Binary file not shown.
Binary file modified data/example_flocker_model_multi_auto_eq.rda
Binary file not shown.
Binary file modified data/example_flocker_model_multi_auto_ex.rda
Binary file not shown.
Binary file modified data/example_flocker_model_multi_colex_eq.rda
Binary file not shown.
Binary file modified data/example_flocker_model_multi_colex_ex.rda
Binary file not shown.
Binary file modified data/example_flocker_model_single.rda
Binary file not shown.
Binary file modified data/example_flocker_model_single_C.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/testthat/test-log_lik_functions.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("check log_lik functions work correctly", {
# check dims
ll_test <- log_lik_flocker(example_flocker_model_single)
expect_equal(dim(ll_test), c(12, 900))
expect_equal(dim(ll_test), c(16, 900))
ll_test <- log_lik_flocker(example_flocker_model_single, draw_ids = 1:10)
expect_equal(dim(ll_test), c(10, 900))

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-loo_flocker.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ test_that("loo_flocker_onefit works correctly", {
expect_error(loo_flocker(list(example_flocker_model_single, 1)), "x is a list, but x\\[\\[2\\]\\] is not a flocker_fit object.")

# check dims
expect_equal(attributes(test_loo)$dims, c(12, 900))
expect_equal(attributes(test_loo_thinned)$dims, c(6, 900))
expect_equal(attributes(test_loo)$dims, c(16, 900))
expect_equal(attributes(test_loo_thinned)$dims, c(8, 900))

# check list output
expect_identical(class(test_loo_list), "list")
Expand All @@ -29,8 +29,8 @@ test_that("loo_flocker_onefit works correctly", {
suppressWarnings(test_loo_thinned <- loo_flocker_onefit(example_flocker_model_single, thin = 2))

# check dimensions
expect_equal(attributes(test_loo)$dims, c(12, 900))
expect_equal(attributes(test_loo_thinned)$dims, c(6, 900))
expect_equal(attributes(test_loo)$dims, c(16, 900))
expect_equal(attributes(test_loo_thinned)$dims, c(8, 900))

# check thin = NULL specification returns same output
expect_identical(test_loo, test_loo_alt)
Expand Down

0 comments on commit 2327b89

Please sign in to comment.