Skip to content

Commit

Permalink
Merge pull request #97 from jsocolar/reduce-size
Browse files Browse the repository at this point in the history
Reduce size
  • Loading branch information
jsocolar authored Dec 5, 2023
2 parents 04d77cd + 2327b89 commit 1b3982b
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 15 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 = 990
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 = 990
warmup = 996
)

#### data augmented model ####
Expand All @@ -51,7 +51,7 @@ example_flocker_model_aug <- flock(
backend = "cmdstanr",
cores = 4,
iter = 1000,
warmup = 990
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 = 990
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 = 990
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 = 990
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 = 990
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.
Binary file modified man/figures/logo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/logo3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/test_data/test_fit.rds
Binary file not shown.
6 changes: 3 additions & 3 deletions tests/testthat/test-log_lik_functions.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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(40, 900))
ll_test <- log_lik_flocker(example_flocker_model_single, draw_ids = 1:20)
expect_equal(dim(ll_test), c(20, 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))

# check classes/values
expect_equal(class(ll_test), c("matrix", "array"))
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-loo_flocker.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("loo_flocker_onefit works correctly", {
suppressWarnings(test_loo <- loo_flocker(example_flocker_model_single))
suppressWarnings(test_loo_thinned <- loo_flocker(example_flocker_model_single, 5))
suppressWarnings(test_loo_thinned <- loo_flocker(example_flocker_model_single, 2))
suppressWarnings(test_loo_list <- loo_flocker(rep(list(example_flocker_model_single), 2)))

# check error
Expand All @@ -10,7 +10,7 @@ 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(40, 900))
expect_equal(attributes(test_loo)$dims, c(16, 900))
expect_equal(attributes(test_loo_thinned)$dims, c(8, 900))

# check list output
Expand All @@ -26,10 +26,10 @@ test_that("loo_flocker_onefit works correctly", {

suppressWarnings(test_loo <- loo_flocker_onefit(example_flocker_model_single, thin = NULL))
suppressWarnings(test_loo_alt <- loo_flocker_onefit(example_flocker_model_single, thin=1))
suppressWarnings(test_loo_thinned <- loo_flocker_onefit(example_flocker_model_single, thin = 5))
suppressWarnings(test_loo_thinned <- loo_flocker_onefit(example_flocker_model_single, thin = 2))

# check dimensions
expect_equal(attributes(test_loo)$dims, c(40, 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
Expand All @@ -42,7 +42,7 @@ test_that("loo_flocker_onefit works correctly", {

# check model naming
suppressWarnings(test_compare <- loo_compare_flocker(list(example_flocker_model_single, example_flocker_model_single),
model_names = c("m1", "m2"), thin = 5))
model_names = c("m1", "m2"), thin = 2))
expect_identical(row.names(test_compare), c("m1", "m2"))

# check test output identical
Expand Down

0 comments on commit 1b3982b

Please sign in to comment.