From be79bd7d57c7aab78cecac0b6287639a1ec4f334 Mon Sep 17 00:00:00 2001 From: jsocolar Date: Sun, 10 Dec 2023 11:30:26 -0500 Subject: [PATCH] remove requirement not to use mixed with new data, and test --- R/predict_flocker.R | 5 ----- tests/testthat/test-predict_flocker.R | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/R/predict_flocker.R b/R/predict_flocker.R index b64fec9..1912a70 100644 --- a/R/predict_flocker.R +++ b/R/predict_flocker.R @@ -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) diff --git a/tests/testthat/test-predict_flocker.R b/tests/testthat/test-predict_flocker.R index eb1af1d..8cf7c21 100644 --- a/tests/testthat/test-predict_flocker.R +++ b/tests/testthat/test-predict_flocker.R @@ -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))) })