Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6070f0f
commit 74c54e0
Showing
14 changed files
with
262 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Snapshot output consistent | ||
# snapshot output consistent | ||
|
||
|
||
Call: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
test_that("Bisdom scaled WDPTs work as expected", { | ||
expect_equal(bisdom(c(2,6,20,3,385)), c(1, 2, 2, 1, 3)) | ||
expect_warning(bisdom("a string")) | ||
expect_true(is.na(bisdom(NA))) | ||
test_that("bisdom() works as expected", { | ||
bisdom(c(2,6,20,3,385)) |> expect_equal(c(1, 2, 2, 1, 3)) | ||
bisdom("a string") |> expect_warning() | ||
bisdom(NA) |> is.na() |> expect_true() | ||
|
||
expect_identical(bisdom(3600), bisdom(4000)) | ||
}) | ||
|
||
test_that("Confidence intervals work as expected", { | ||
expect_equal(round(CI(1:5), 2), 1.39) | ||
expect_warning(CI(NA)) | ||
test_that("CI() works as expected", { | ||
CI(1:5) |> round(2) |> expect_equal(1.39) | ||
CI(NA) |> expect_warning() | ||
}) | ||
|
||
test_that("Root mean square errors (RMSE) work as expected", { | ||
expect_equal(round(rmse(c(0.12,0.59,NA), c(0.15,0.63,1.2)), 4), 0.0354) | ||
expect_true(is.na(rmse(NA, NA))) | ||
test_that("rmse() works as expected", { | ||
rmse(c(0.12,0.59,NA), c(0.15,0.63,1.2)) |> round(4) |> expect_equal(0.0354) | ||
rmse(c(0.12,0.59,NA), c(0.15,0.63,1.2), rel = T) |> round(4) |> | ||
expect_equal(0.0996) | ||
rmse(NA, NA) |> is.na() |> expect_true() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
mlp <- runif(10, -2, 2) | ||
|
||
data(din32645) | ||
din <- calibration(Area ~ Conc, data = din32645) | ||
|
||
mm <- sapply(mlp, function(x){ | ||
mlp <- runif(10, -2, 2) | ||
me <- sapply(mlp, function(x) { | ||
conc <- din32645$Conc | ||
area <- din32645$Area * x | ||
mm <- calibration(area ~ conc, check_assumptions = F) | ||
matrix_effect(din, mm) | ||
}) | ||
}) | ||
|
||
test_that("matrix_effect() handles input errors correctly", { | ||
matrix_effect(1:10) |> expect_error() | ||
matrix_effect(din, 1:10) |> expect_error() | ||
|
||
matrix_effect(din, din) |> expect_silent() | ||
}) | ||
|
||
test_that("Matrix effect/SSE computed correctly", { | ||
expect_equal(mm - mlp + 1, rep(0, 10), ignore_attr = T) | ||
test_that("matrix_effect() is calculated correctly", { | ||
matrix_effect(din, din) |> expect_equal(0, ignore_attr = T) | ||
expect_equal(me - mlp + 1, rep(0, 10), ignore_attr = T) | ||
}) |
Oops, something went wrong.