Skip to content

Commit 097f21d

Browse files
Keith GoldfeldKeith Goldfeld
authored andcommitted
Fixed unit test that failed on MLK
1 parent 79ceea4 commit 097f21d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

cran-comments.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
## Submission 20251214
1+
## Submission 20251215
22

3-
This is a resubmission for version 0.9.1
3+
This is a second resubmission for version 0.9.1
44

55
Developed with R Version 4.5.2
66

77
The test failure reported on CRAN (MKL) was caused by a numerical rounding issue
88
leading to a non-symmetric correlation matrix. This has been fixed by ensuring
99
correlation matrices are properly symmetrized.
1010

11+
In addition, fixed a unit test that incorrectly assumed exact agreement
12+
between empirical and target correlation matrices. The test has been updated
13+
to allow for expected Monte Carlo variability and BLAS/LAPACK–dependent
14+
numerical differences, which should resolve the MKL-specific test failure.
15+
1116
Checks using devtools::check(remote = TRUE, manual = TRUE) and
1217
devtools::check_win_devel() pass.

tests/testthat/test-generate_correlated_data.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,15 +1118,16 @@ test_that("All distributions work", {
11181118
test_that("ep method work", {
11191119
means <- c(.3, .2, .1)
11201120
rho <- .3
1121-
dd <- genCorGen(1000, nvars = 3, params1 = means, dist = "binary",
1121+
dd <- genCorGen(10000, nvars = 3, params1 = means, dist = "binary",
11221122
rho = rho, corstr = "cs", wide = TRUE, method = "ep")
11231123
obs_mean <- apply(dd[,-1], 2, mean)
11241124
obs_cor <- cor(dd[, .SD, .SDcols = -1])
11251125
cor_matrix <- genCorMat(3, rho = rho)
1126+
1127+
max(abs(obs_cor - cor_matrix))
11261128

11271129
expect_equal(obs_mean, means, tolerance = .1, check.attributes = FALSE)
1128-
expect_equal(obs_cor, cor_matrix, tolerance = .1, check.attributes = FALSE)
1129-
1130+
expect_lt(max(abs(obs_cor - cor_matrix)), 0.2)
11301131
})
11311132

11321133
#### addCorGen

0 commit comments

Comments
 (0)