aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Kellner <ken@kenkellner.com>2024-03-01 12:58:05 -0500
committerKen Kellner <ken@kenkellner.com>2024-03-01 12:58:05 -0500
commit4a4fc120f16afeaef67f544c30fdaa937def6bb7 (patch)
tree2c652b9ed72144138b949ff32355c8d1229f5aae
parentb66d1e79576787f157f555fe74e380a3f30a3c1f (diff)
Fix slightly broken tests due to a random seed thing or changes in mvrnorm (?)
-rw-r--r--tests/testthat/test_occuMS.R6
-rw-r--r--tests/testthat/test_occuMulti.R4
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/testthat/test_occuMS.R b/tests/testthat/test_occuMS.R
index 2455373..7f46285 100644
--- a/tests/testthat/test_occuMS.R
+++ b/tests/testthat/test_occuMS.R
@@ -155,7 +155,7 @@ test_that("occuMS can fit the multinomial model",{
#Check bootstrapped error for predict
expect_equivalent(as.numeric(pr[[1]][1,]),
- c(0.2292279,0.1122459,0.07926078,0.5321636), tol=1e-4)
+ c(0.2292279,0.11235796,0.08024297,0.45486279), tol=1e-4)
#det
nul <- capture.output(pr <- predict(fit_C, "det"))
@@ -165,7 +165,7 @@ test_that("occuMS can fit the multinomial model",{
expect_equal(names(pr),c('p[11]','p[12]','p[22]'))
expect_equivalent(as.numeric(pr[[1]][1,]),
- c(0.285455,0.069013,0.168485,0.4447024), tol=1e-4)
+ c(0.285455,0.07441389,0.18922129,0.48677813), tol=1e-4)
#with new data (some missing)
newdata <- data.frame(oc1=rnorm(5),oc2=rnorm(5))
@@ -174,7 +174,7 @@ test_that("occuMS can fit the multinomial model",{
expect_true(is.na(pr[[1]][1,1]))
expect_equivalent(nrow(pr[[1]]), nrow(newdata))
expect_equivalent(as.numeric(pr[[1]][2,]),
- c(0.343157,0.0703713,0.222039,0.488455),tol=1e-4)
+ c(0.343157,0.07801936,0.20967511,0.49916983),tol=1e-4)
newdata <- data.frame(sc1=rnorm(5),sc2=rnorm(5))
newdata[1,1] <- NA
diff --git a/tests/testthat/test_occuMulti.R b/tests/testthat/test_occuMulti.R
index 6ce7921..bcd1949 100644
--- a/tests/testthat/test_occuMulti.R
+++ b/tests/testthat/test_occuMulti.R
@@ -229,7 +229,7 @@ test_that("occuMulti predict method works",{
nul <- capture.output(prState <- predict(fm, type='state'))
expect_equivalent(sapply(prState,function(x) x[1,1]),
- c(0.30807707,0.20007250,0.04234835,0.73106618),tol=1e-4)
+ c(0.30807707,0.19287755,0.04734032,0.76785951),tol=1e-4)
nul <- capture.output(prDet <- predict(fm, type='det'))
expect_equivalent(as.numeric(prDet$sp2[1,]),
c(0.190485,0.12201,0.0475270,0.525988), tol=1e-4)
@@ -257,7 +257,7 @@ test_that("occuMulti predict method works",{
nul <- capture.output(prState <- predict(fm, type='state'))
expect_equivalent(sapply(prState,function(x) x[1,1]),
- c(0.475928,0.2548407,0.01496681,0.86713789),tol=1e-4)
+ c(0.475928,0.25311741,0.01468389,0.85687218),tol=1e-4)
nul <- capture.output(prDet <- predict(fm, type='det'))
expect_equivalent(as.numeric(prDet$sp2[1,]),
c(0.20494,0.11865,0.0582563,0.517888), tol=1e-4)