Skip to content

Commit b974f96

Browse files
Merge pull request #423 from villegar/v6.3.4-dev
Roll back changes done to the test
2 parents a57c91a + 9d74b26 commit b974f96

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

tests/testthat/test-smk-corTestDS.R

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ test_that("simple corTestDS, some, pearson, without na, pearson", {
182182

183183
context("corTestDS::smk::with na, pearson")
184184
test_that("simple corTestDS, some, with na, pearson", {
185-
x <- c(0.0, NA, 2.0, 3.0, NA, 5.0, NA, 7.0)
185+
x <- c(NA, 1.0, 2.0, 3.0, NA, 5.0, NA, 7.0)
186186
y <- c(0.0, 1.0, NA, 3.0, 4.0, NA, NA, 7.0)
187187

188188
res <- corTestDS("x", "y", "pearson", NULL, 0.95)
@@ -198,31 +198,7 @@ test_that("simple corTestDS, some, with na, pearson", {
198198

199199
expect_equal(class(res$`Correlation test`$statistic), "numeric")
200200
expect_length(res$`Correlation test`$statistic, 1)
201-
202-
# extract information from the results
203-
t_stat <- res$`Correlation test`$statistic[[1]]
204-
# degrees of freedom
205-
df <- res$`Number of pairwise complete cases` - 2
206-
# re-calculate the value for r (correlation)
207-
## t_stat <- sqrt(df) * r / sqrt(1 - r^2) # Equation 1
208-
## calculate intermediate coefficient, derived from Equation 1
209-
A <- t_stat / sqrt(df)
210-
## use the intermediate value to estimate the correlation value, r
211-
r <- sqrt(A^2 / (1 + A^2))
212-
213-
# if testing on Apple M1: due to numeric precision
214-
if (getElement(Sys.info(), "sysname") == "Darwin" &&
215-
getElement(R.version, "arch") == "aarch64") {
216-
# t-stat should be a very large value, because r ~ 1, but not exactly 1
217-
expect_false(is.infinite(t_stat))
218-
# r ~ 1
219-
expect_false(is.nan(r))
220-
}
221-
else { # other architectures
222-
expect_true(is.infinite(t_stat))
223-
# the estimated value for r should NaN
224-
expect_true(is.nan(r))
225-
}
201+
expect_true(is.infinite(res$`Correlation test`$statistic[[1]]))
226202

227203
expect_equal(class(res$`Correlation test`$parameter), "integer")
228204
expect_length(res$`Correlation test`$parameter, 1)

0 commit comments

Comments
 (0)