aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_compare_investr.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-03-23 10:32:36 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-03-31 18:35:09 +0200
commitf4fcef8228ebd5a1a73bc6edc47b5efa259c2e20 (patch)
treef9e0489c8941257b5055783a443f4859212ad4f1 /tests/testthat/test_compare_investr.R
parent4c2b22d75cc5102ddc595ea479c46bfdb46c1016 (diff)
Use 'investr' conditionally in tests, updates
Most prominently, a README was added, giving a nice overview for the people visiting the github page, the package page on CRAN, or the online docs at pkgdown.jrwb.de. The maintainer e-mail address was also updated.
Diffstat (limited to 'tests/testthat/test_compare_investr.R')
-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