aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_multinomPois.R
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat/test_multinomPois.R')
-rw-r--r--tests/testthat/test_multinomPois.R6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/testthat/test_multinomPois.R b/tests/testthat/test_multinomPois.R
index ee51335..6b4b693 100644
--- a/tests/testthat/test_multinomPois.R
+++ b/tests/testthat/test_multinomPois.R
@@ -237,6 +237,12 @@ test_that("multinomPois can fit models with random effects",{
expect_equivalent(dim(pr), c(100, 4))
expect_equivalent(dim(pr2), c(5,4))
+ # Make sure simulate accounts for random effects
+ s <- simulate(fm, nsim=30)
+ avg <- apply(sapply(s, function(x) x[,1]),1, mean)
+ # average first count and predicted abundance should be highly correlated
+ expect_true(cor(avg, pr$Predicted) > 0.7)
+
umf2@y[1,1] <- NA
umf2@y[2,] <- NA
umf2@siteCovs$x1[3] <- NA