Skip to content

Commit

Permalink
0.10.3.4: Update a few tests
Browse files Browse the repository at this point in the history
Tests, check, build_site passed.
  • Loading branch information
sfcheung committed Oct 23, 2023
1 parent 2170446 commit 681cef3
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: semlbci
Title: Likelihood-Based Confidence Interval in Structural Equation Models
Version: 0.10.3.3
Version: 0.10.3.4
Authors@R:
c(
person(given = "Shu Fai",
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# semlbci 0.10.3.3
# semlbci 0.10.3.4

- Updated README.md for CRAN release. Identical
to the CRAN release in code. (0.10.3.1)
- Added an R CMD check for noSuggests. (0.10.3.2)
- Revised an example of `syntax_to_i()`
for a coming changes to the parser of
`lavaan` (0.10.3.3).
- Updated a few tests (0.10.3.4).

# semlbci 0.10.3

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![DOI](https://img.shields.io/badge/doi-10.1080/10705511.2023.2183860-blue.svg)](https://doi.org/10.1080/10705511.2023.2183860)
<!-- badges: end -->

(Version 0.10.3.3, updated on 2023-10-23, [release history](https://sfcheung.github.io/semlbci/news/index.html))
(Version 0.10.3.4, updated on 2023-10-23, [release history](https://sfcheung.github.io/semlbci/news/index.html))

# semlbci <img src="man/figures/logo.png" align="right" height="150" />

Expand Down
9 changes: 5 additions & 4 deletions tests/testthat/test-ci_bound_wn_i_mg_rb_ustd_pa.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ time1u <- system.time(out1u <- ci_bound_wn_i( 1, 16, sem_out = fit, f_constr = f
time2l <- system.time(out2l <- ci_bound_wn_i(10, 16, sem_out = fit, f_constr = fn_constr0, which = "lbound", opts = opts0, verbose = TRUE, ciperc = ciperc, sf = sf2$c_r, sf2 = sf2$c_rb))
time2u <- system.time(out2u <- ci_bound_wn_i(10, 16, sem_out = fit, f_constr = fn_constr0, which = "ubound", opts = opts0, verbose = TRUE, ciperc = ciperc, sf = sf2$c_r, sf2 = sf2$c_rb))

# 2023-10-23: Updated precomputed answers manually checked for validity.
test_that("Check against precomputed answers", {
expect_equal(out1l$bound, -0.1900844, tolerance = 1e-5)
expect_equal(out1u$bound, 2.751777, tolerance = 1e-5)
expect_equal(out2l$bound, 0.362989, tolerance = 1e-5)
expect_equal(out2u$bound, 0.7840242, tolerance = 1e-5)
expect_equal(out1l$bound, -0.190309, tolerance = 1e-4)
expect_equal(out1u$bound, 2.752005, tolerance = 1e-4)
expect_equal(out2l$bound, 0.362989, tolerance = 1e-4)
expect_equal(out2u$bound, 0.7840242, tolerance = 1e-4)
})

skip("Run only if data changed")
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-ci_bound_wn_i_mg_rb_ustd_pa_user.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ opts0 <- list(#ftol_abs = 1e-7,
time1l <- system.time(out1l <- ci_bound_wn_i(1,16, sem_out = fit, f_constr = fn_constr0, which = "lbound", opts = opts0, verbose = TRUE, ciperc = ciperc, sf = sf1$c_r, sf2 = sf1$c_rb))
time2u <- system.time(out2u <- ci_bound_wn_i(17,16, sem_out = fit, f_constr = fn_constr0, which = "ubound", opts = opts0, verbose = TRUE, ciperc = ciperc, sf = sf2$c_r, sf2 = sf2$c_rb))

# 2023-10-23: Updated precomputed answers manually checked for validity.
test_that("Check against precomputed answers", {
expect_equal(out1l$bound, -0.1900844, tolerance = 1e-5)
expect_equal(out2u$bound, 1.665516, tolerance = 1e-5)
expect_equal(out1l$bound, -0.190309, tolerance = 1e-4)
expect_equal(out2u$bound, 1.665516, tolerance = 1e-4)
})

skip("Run only if data changed")
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-ci_bound_wn_i_mg_std_pa_user.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ opts0 <- list(#ftol_abs = 1e-7,
time1l <- system.time(out1l <- ci_bound_wn_i(17, 16, sem_out = fit, f_constr = fn_constr0, which = "lbound", standardized = TRUE, ciperc = ciperc, opts = opts0, verbose = TRUE, wald_ci_start = TRUE, std_method = "internal"))
time2u <- system.time(out2u <- ci_bound_wn_i(1, 16, sem_out = fit, f_constr = fn_constr0, which = "ubound", standardized = TRUE, ciperc = ciperc, opts = opts0, verbose = TRUE, wald_ci_start = TRUE, std_method = "internal"))

# 2023-10-23: Updated precomputed answers manually checked for validity.
test_that("Check against precomputed answers", {
expect_equal(out1l$bound, 0.06101715, tolerance = 1e-5)
expect_equal(out2u$bound, 0.4024615, tolerance = 1e-5)
expect_equal(out1l$bound, 0.06101715, tolerance = 1e-4)
expect_equal(out2u$bound, 0.4024136, tolerance = 1e-4)
})

skip("Run only if data changed")
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-ci_bound_wn_i_mg_ustd_pa_user.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ fn_constr0 <- set_constraint(fit, ciperc = ciperc)
time1l <- system.time(out1l <- ci_bound_wn_i(17,16, sem_out = fit, f_constr = fn_constr0, which = "lbound", verbose = TRUE, ciperc = ciperc))
time2u <- system.time(out2u <- ci_bound_wn_i(18,16, sem_out = fit, f_constr = fn_constr0, which = "ubound", verbose = TRUE, ciperc = ciperc))

# 2023-10-23: Updated precomputed answers manually checked for validity.
test_that("Check against precomputed answers", {
expect_equal(out1l$bound, 0.04693643, tolerance = 1e-5)
expect_equal(out2u$bound, 13.24302, tolerance = 1e-5)
expect_equal(out1l$bound, 0.04712413, tolerance = 1e-4)
expect_equal(out2u$bound, 13.24741, tolerance = 1e-4)
})

skip("Run only if data changed")
Expand Down

0 comments on commit 681cef3

Please sign in to comment.