Skip to content

Commit

Permalink
Update test DAISIE_ML1
Browse files Browse the repository at this point in the history
  • Loading branch information
rsetienne committed Jul 1, 2024
1 parent a5ac732 commit 18ddc2e
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions tests/testthat/test-DAISIE_ML1.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
context("DAISIE_ML1")

test_that("use", {
test_that("DAISIE_ML1 works and simplex and subplex give the same answer", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
data(Galapagos_datalist)
Expand All @@ -10,29 +10,43 @@ test_that("use", {
idparsopt <- c(1,2,3,4,5)
parsfix <- c()
idparsfix <- c()
tested_MLE <- DAISIE_ML1(
tested_MLE1 <- DAISIE_ML1(
datalist = datalist,
initparsopt = initparsopt,
idparsopt = idparsopt,
parsfix = parsfix,
ddmodel = ddmodel,
idparsfix = idparsfix,
verbose = 0,
tol = c(0.01, 0.1, 0.001),
tol = c(0.0001, 0.001, 0.0001),
res = 15,
tolint = c(0.1, 0.01),
optimmethod = 'subplex',
num_cycles = 3)
tested_MLE2 <- DAISIE_ML1(
datalist = datalist,
initparsopt = as.numeric(tested_MLE1[1:5]),
idparsopt = idparsopt,
parsfix = parsfix,
ddmodel = ddmodel,
idparsfix = idparsfix,
verbose = 0,
tol = c(0.0001, 0.001, 0.0001),
res = 15,
tolint = c(0.1, 0.01),
optimmethod = 'simplex')
testthat::expect_equal(tested_MLE1, tested_MLE2)
expected_MLE <- data.frame(
lambda_c = 3.689104200780465,
mu = 4.31030299415995,
K = 906.6501180193454,
gamma = 0.0173458887696076,
lambda_a = 3.677789527566334,
loglik = -64.2199684450019,
lambda_c = 4.0275356252375420,
mu = 4.8740259531255852,
K = 2001.9278290878507960,
gamma = 0.0202054262850127,
lambda_a = 4.0124628182465916,
loglik = -63.9341963365704231,
df = 5L,
conv = 0L
)
testthat::expect_equal(tested_MLE, expected_MLE)
testthat::expect_equal(tested_MLE1, expected_MLE)
})

test_that("abuse", {
Expand Down

0 comments on commit 18ddc2e

Please sign in to comment.