Skip to content

Commit

Permalink
Additional test on simulated data set
Browse files Browse the repository at this point in the history
  • Loading branch information
rsetienne committed Jul 5, 2024
1 parent 0a5cf8e commit 5f435c7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
Binary file added data/frogs_sim_CS_T30_M1000_R5000.Rdata
Binary file not shown.
44 changes: 42 additions & 2 deletions tests/testthat/test-integration_DAISIE.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ test_that("IW and CS loglik is same when K = Inf", {
testthat::expect_equal(loglik_IW, loglik_CS, tol = 5E-6)
})

test_that("IW and CS loglik is same when K = Inf", {
test_that("IW loglik is correct", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()
M <- 1000
frogs_datalist <- NULL
rm(frogs_datalist)
data(frogs_datalist, package = "DAISIE")
frogs_datalist[[1]]$not_present <- frogs_datalist[[1]]$not_present + (M - 300)
M <- 1000
ddmodel <- 11
initparsopt <- c(4.012298e-01,1.699521e-01,1.319595e+02,3.487955e-04)
idparsopt <- c(1,2,3,4)
Expand Down Expand Up @@ -137,6 +139,44 @@ test_that("IW and CS loglik is same when K = Inf", {
testthat::expect_equal(initloglik_IW, -215.097677998973, tol = 1E-6)
})

test_that("IW loglik is correct", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()
frogs_sim_CS_T30_M1000_R5000 <- NULL
rm(frogs_sim_CS_T30_M1000_R5000)
data(frogs_sim_CS_T30_M1000_R5000, package = "DAISIE")
datalist <- frogs_sims[[897]]
M <- 1000
ddmodel <- 11
initparsopt <- c(4.012298e-01,1.699521e-01,1.319595e+02,3.487955e-04)
idparsopt <- c(1,2,3,4)
parsfix <- 0
idparsfix <- 5
verbose <- 1
cond <- 1
res <- 200
methode <- 'odeint::runge_kutta_fehlberg78'
tolint <- c(1E-16, 1E-14)

trparsopt <- initparsopt / (1 + initparsopt)
trparsopt[which(initparsopt == Inf)] <- 1
trparsfix <- parsfix / (1 + parsfix)
trparsfix[which(parsfix == Inf)] <- 1
pars2 <- c(res, ddmodel, cond, verbose)
initloglik_IW <- DAISIE_loglik_IW_choosepar(trparsopt = trparsopt,
trparsfix = trparsfix,
idparsopt = idparsopt,
idparsfix = idparsfix,
M = M,
pars2 = pars2,
datalist = datalist,
methode = methode,
abstolint = tolint[1],
reltolint = tolint[2])

testthat::expect_equal(initloglik_IW, -244.7340301475871911, tol = 1E-6)
})

test_that("DAISIE_ML simple case works", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
Expand Down

0 comments on commit 5f435c7

Please sign in to comment.