Skip to content

Commit

Permalink
remove requirement not to use mixed with new data, and test
Browse files Browse the repository at this point in the history
  • Loading branch information
jsocolar committed Dec 10, 2023
1 parent d1dbb61 commit be79bd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 0 additions & 5 deletions R/predict_flocker.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ predict_flocker <- function(flocker_fit, draw_ids = NULL,
msg = "`mixed` must be a single logical"
)

assertthat::assert_that(
!mixed | is.null(new_data),
msg = "`mixed` must be `FALSE` if new_data is supplied"
)

assertthat::assert_that(is.null(new_data) | is_flocker_data(new_data))

total_iter <- brms::ndraws(flocker_fit)
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-predict_flocker.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,13 @@ test_that("mixed checks work", {
allow_new_levels = TRUE, sample_new_levels = "gaussian"
)
expect_true(all(p_single_mixed %in% c(0,1)))

sfd <- simulate_flocker_data(n_pt = 5, n_sp = 5, n_rep = 2)
fd <- make_flocker_data(sfd$obs, sfd$unit_covs, sfd$event_covs)
p_single_mixed <- predict_flocker(
example_flocker_model_single, mixed = TRUE,
allow_new_levels = TRUE, sample_new_levels = "gaussian",
new_data = fd
)
expect_true(all(p_single_mixed %in% c(0,1)))
})

0 comments on commit be79bd7

Please sign in to comment.