aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/test_compare_investr.R10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/testthat/test_compare_investr.R b/tests/testthat/test_compare_investr.R
index 6191c89..2830679 100644
--- a/tests/testthat/test_compare_investr.R
+++ b/tests/testthat/test_compare_investr.R
@@ -1,12 +1,12 @@
-context("Compare with investr::calibrate")
+if (requireNamespace("investr")) {
-library(chemCal)
-library(investr)
+context("Compare with investr::calibrate")
test_that("Unweighted regressions give same results as investr::calibrate using the Wald method", {
+
compare_investr <- function(object, y_sample) {
pred_chemCal <- inverse.predict(object, y_sample)
- pred_investr <- calibrate(object, y_sample, interval = "Wald")
+ pred_investr <- investr::calibrate(object, y_sample, interval = "Wald")
expect_equivalent(pred_chemCal[["Prediction"]],
pred_investr$estimate)
expect_equivalent(pred_chemCal[["Standard Error"]],
@@ -28,3 +28,5 @@ test_that("Unweighted regressions give same results as investr::calibrate using
m_m3 <- lm(y ~ x, massart97ex3)
compare_investr(m_m3, 15)
})
+
+}

Contact - Imprint