Skip to content

Commit

Permalink
Merge pull request #314 from poissonconsulting/dev
Browse files Browse the repository at this point in the history
fix currently failing tests on github actions
  • Loading branch information
joethorley authored Nov 8, 2023
2 parents ce01432 + 58e639c commit 600452f
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 17 deletions.
2 changes: 2 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ Get started with ssdtools at <https://bcgov.github.io/ssdtools/articles/ssdtools

A shiny app to allow non-R users to interface with ssdtools is available at <https://github.com/bcgov/shinyssdtools>.

For the latest changes visit [NEWS](https://bcgov.github.io/ssdtools/news).

The citation for the shiny app:

*Dalgarno, S. 2021. shinyssdtools: A web application for fitting Species Sensitivity Distributions (SSDs). JOSS 6(57): 2848. https://joss.theoj.org/papers/10.21105/joss.02848.*
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ Get started with ssdtools at
A shiny app to allow non-R users to interface with ssdtools is available
at <https://github.com/bcgov/shinyssdtools>.

For the latest changes visit
[NEWS](https://bcgov.github.io/ssdtools/news).

The citation for the shiny app:

*Dalgarno, S. 2021. shinyssdtools: A web application for fitting Species
Expand Down
Binary file removed man/figures/README-unnamed-chunk-10-1.png
Binary file not shown.
Binary file removed man/figures/README-unnamed-chunk-11-1.png
Binary file not shown.
Binary file removed man/figures/README-unnamed-chunk-12-1.png
Binary file not shown.
Binary file removed man/figures/README-unnamed-chunk-7-1.png
Binary file not shown.
Binary file removed man/figures/README-unnamed-chunk-8-1.png
Binary file not shown.
Binary file modified man/figures/README-unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/test-glance.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ test_that("glance reweight same log_lik", {
expect_identical(glance$nobs, rep(28L, 3))
expect_identical(glance_cens$aicc, rep(NA_real_, 3))
expect_identical(glance_cens$nobs, rep(NA_integer_, 3))
expect_equal(glance_cens$weight, glance$weight, tolerance = 0.0001)
expect_equal(glance_cens$weight, glance$weight, tolerance = 1e-04)
expect_identical(glance_cens_n$weight, rep(NA_real_, 3))
})
6 changes: 3 additions & 3 deletions tests/testthat/test-hc-root.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_that("hc root lnorm", {
hc_root <- ssd_hc(fits, average = TRUE, root = TRUE)
expect_identical(hc_average$est, hc_dist$est)
expect_identical(hc_average$est, hc_dist$est)
expect_identical(hc_root, hc_average, tolerance = 1e-10)
expect_equal(hc_root, hc_average)
expect_equal(hc_root$est, 1.68117483988121, tolerance = 1e-6)

testthat::expect_snapshot({
Expand All @@ -37,8 +37,8 @@ test_that("hc root all", {
hc_average <- ssd_hc(fits, average = TRUE)
hc_root <- ssd_hc(fits, average = TRUE, root = TRUE)
expect_equal(hc_root, hc_average, tolerance = 1e-1)
expect_identical(hc_average$est, 1.24151700389853, tolerance = 1e-10)
expect_equal(hc_root$est, 1.25678623624403, tolerance = 1e-10)
expect_equal(hc_average$est, 1.24151700389853)
expect_equal(hc_root$est, 1.25678623624403)
testthat::expect_snapshot({
hc_root
})
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-hp-root.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ test_that("hp root lnorm", {
hp_average <- ssd_hp(fits, average = TRUE)
hp_root <- ssd_hp(fits, average = TRUE, root = TRUE)
expect_identical(hp_average$est, hp_dist$est)
expect_identical(hp_root, hp_average, tolerance = 1e-10)
expect_equal(hp_average$est, 1.9543030195088, tolerance = 1e-10)
expect_equal(hp_root, hp_average)
expect_equal(hp_average$est, 1.9543030195088)
expect_equal(hp_root$est, 1.95430301950878, tolerance = 1e-6)

testthat::expect_snapshot({
Expand Down
24 changes: 13 additions & 11 deletions tests/testthat/test-multi.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ test_that("ssd_pmulti", {
expect_identical(ssd_pmulti(-Inf, wt_est), 0)
expect_identical(ssd_pmulti(Inf, wt_est), 1)
expect_equal(ssd_pmulti(0, wt_est), 0)
expect_equal(ssd_pmulti(1, wt_est), 0.0391155639855389)
expect_equal(ssd_pmulti(10000, wt_est), 0.99991762078885)
expect_equal(ssd_pmulti(c(1,2), wt_est), c(0.0391155639855389, 0.083756266589807))
expect_equal(ssd_pmulti(c(1,NA), wt_est), c(0.0391155639855389, NA))
expect_equal(ssd_pmulti(1, wt_est, lower.tail = FALSE), 1-0.0391155639855389)
expect_equal(ssd_pmulti(1, wt_est, log.p = TRUE), log(0.0391155639855389))
expect_equal(ssd_pmulti(1, wt_est, lower.tail = FALSE, log.p = TRUE), log(1-0.0391155639855389))
pone <- 0.0391155639855389
expect_equal(ssd_pmulti(1, wt_est), pone)
expect_equal(ssd_pmulti(10000, wt_est), 0.99991762078885, tolerance = 1e-5)
expect_equal(ssd_pmulti(c(1,2), wt_est), c(pone, 0.083756266589807))
expect_equal(ssd_pmulti(c(1,NA), wt_est), c(pone, NA))
expect_equal(ssd_pmulti(1, wt_est, lower.tail = FALSE), 1-pone)
expect_equal(ssd_pmulti(1, wt_est, log.p = TRUE), log(pone))
expect_equal(ssd_pmulti(1, wt_est, lower.tail = FALSE, log.p = TRUE), log(1-pone))
})

test_that("ssd_pmulti weights", {
Expand All @@ -46,11 +47,12 @@ test_that("ssd_qmulti", {
expect_identical(ssd_qmulti(Inf, wt_est), NaN)
expect_identical(ssd_qmulti(1, wt_est), Inf)
expect_equal(ssd_qmulti(0, wt_est), 0)
q75 <- 32.4740714551225
expect_equal(ssd_qmulti(0.5, wt_est), 15.3258170124633)
expect_equal(ssd_qmulti(c(0.5, 0.75), wt_est), c(15.3258170124633, 32.4740714551225))
expect_equal(ssd_qmulti(0.25, wt_est, lower.tail = FALSE), 32.4740714551225)
expect_equal(ssd_qmulti(log(0.75), wt_est, log.p = TRUE), 32.4740714551225)
expect_equal(ssd_qmulti(log(0.25), wt_est, lower.tail = FALSE, log.p = TRUE), 32.4740714551225)
expect_equal(ssd_qmulti(c(0.5, 0.75), wt_est), c(15.3258170124633, q75))
expect_equal(ssd_qmulti(0.25, wt_est, lower.tail = FALSE), q75)
expect_equal(ssd_qmulti(log(0.75), wt_est, log.p = TRUE), q75)
expect_equal(ssd_qmulti(log(0.25), wt_est, lower.tail = FALSE, log.p = TRUE), q75)
})

test_that("ssd_qmulti weights", {
Expand Down

0 comments on commit 600452f

Please sign in to comment.