Skip to content

Commit

Permalink
update warning message for
Browse files Browse the repository at this point in the history
  • Loading branch information
qinyun-lin committed Jul 24, 2024
1 parent 2e5efa1 commit 1ef54f9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/cop_pse_auxiliary.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cal_ryz <- function(ryxGz, R2){
if (R2yz >= 0) {
ryz <- sqrt(R2yz)
} else {
stop("The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. The unconditional ITCV is not conceptualized for\n this scenario.")
stop("The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. Note: the unconditional ITCV is not conceptualized\n for this scenario.")
}
return(ryz)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-auxillary.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context("Checking auxiliary")
test_that("cal_ryz works", {
expect_equal(cal_ryz(0.1, 0.6), tolerance = .001, 0.7719842)
expect_equal(cal_ryz(0.2, 0.6), tolerance = .001, 0.7637626)
expect_error(expect_message(cal_ryz(0.6, 0.2)), "The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. The unconditional ITCV is not conceptualized for\n this scenario.")
expect_error(expect_message(cal_ryz(0.6, 0.2)), "The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. Note: the unconditional ITCV is not conceptualized\n for this scenario.")
})

test_that("cal_rxz works", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-cop_pse_auxiliary.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context("Checking auxiliary")
test_that("cal_ryz works", {
expect_equal(cal_ryz(0.1, 0.6), tolerance = .001, 0.7719842)
expect_equal(cal_ryz(0.2, 0.6), tolerance = .001, 0.7637626)
expect_error(expect_message(cal_ryz(0.6, 0.2)), "The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. The unconditional ITCV is not conceptualized for\n this scenario.")
expect_error(expect_message(cal_ryz(0.6, 0.2)), "The calculated variance in Y explained by Z is less than 0. This can occur if Z\n suppresses the relationship between X and Y. That is, if partialling on Z increases\n the relationship between X and Y. Note: the unconditional ITCV is not conceptualized\n for this scenario.")
})

test_that("cal_rxz works", {
Expand Down

0 comments on commit 1ef54f9

Please sign in to comment.