updating tests

parent 95ce1281
Pipeline #147619948 failed with stages
in 8 minutes and 11 seconds
......@@ -23,7 +23,7 @@ test_that("p combos", {
combo <- rhoR:::genPcombo(0.8, p_min, p_max, 0.5)
expect_true(p_min < combo && combo < p_max)
expect_error(rhoR:::genPcombo(0.9, p_min, p_max, 0.5))
expect_match(tryCatch(genPcombo(0.9, p_min, p_max, 0.5), error = function(e) { e$message }), regexp = "nested too deeply")
})
test_that("create random sets", {
......@@ -147,28 +147,39 @@ test_that("compare calcRhos", {
kmin <- 0.85
kmax <- 0.95
pmin <- 0.8
pmax <- 0.95
pmax <- 1
kps_list <- rhoR:::generateKPs(num, br, kmin, kmax, pmin, pmax)
kps_r <- matrix(unlist(kps_list), byrow = TRUE, ncol = 2, dimnames = list(NULL, names(kps_list[[1]])))
kps_c <- generate_kp_list(num, br, kmin, kmax, pmin, pmax)
# kps_list <- rhoR:::generateKPs(num, br, kmin, kmax, pmin, pmax)
# kps_r <- matrix(unlist(kps_list), byrow = TRUE, ncol = 2, dimnames = list(NULL, names(kps_list[[1]])))
# col_1 <- round(kps_r[, 1], 4)
# col_2 <- round(kps_r[, 2], 4)
# col_1_c <- paste0("c(", paste(shQuote(col_1), collapse = ", "), ")")
# col_2_c <- paste0("c(", paste(shQuote(col_2), collapse = ", "), ")")
# col_1_n <- as.numeric(eval(parse(text = col_1_c)))
# col_2_n <- as.numeric(eval(parse(text = col_2_c)))
col_1_n <- c('0.9477', '0.8846', '0.995', '0.9396', '0.9107', '0.9608', '0.9244', '0.9663', '0.9119', '0.9362', '0.951', '0.9921', '0.9482', '0.9848', '0.8578', '0.8077', '0.8813', '0.8965', '0.9972', '0.9852', '0.8374', '0.8802', '0.9167', '0.9315', '0.9851', '0.8017', '0.9858', '0.9597', '0.9911', '0.9765', '0.9331', '0.9192', '0.9422', '0.9097', '0.9745', '0.9111', '0.9888', '0.9791', '0.9715', '0.9704', '0.87', '0.9081', '0.9594', '0.9945', '0.8935', '0.8569', '0.9383', '0.8428', '0.9888', '0.8261', '0.9201', '0.8785', '0.9254', '0.9884', '0.8937', '0.9242', '0.9903', '0.9901', '0.9476', '0.8804', '0.9043', '0.9409', '0.8611', '0.9427', '0.8889', '0.9737', '0.8799', '0.9152', '0.9924', '0.8264', '0.9396', '0.888', '0.9308', '0.947', '0.8757', '0.9344', '0.9977', '0.9203', '0.9397', '0.993', '0.993', '0.9421', '0.9979', '0.9192', '0.8453', '0.89', '0.9293', '0.8432', '0.8989', '0.88', '0.929', '0.9512', '0.9832', '0.8459', '0.9716', '0.8141', '0.9671', '0.9729', '0.9396', '0.8969')
col_2_n <- c('0.9112', '0.8881', '0.8552', '0.9354', '0.8877', '0.872', '0.8874', '0.9495', '0.9168', '0.9312', '0.9483', '0.9083', '0.9246', '0.8948', '0.8749', '0.8502', '0.8654', '0.9071', '0.8625', '0.9197', '0.8561', '0.86', '0.919', '0.931', '0.9106', '0.8557', '0.8745', '0.9066', '0.9257', '0.944', '0.9105', '0.8832', '0.9038', '0.9081', '0.938', '0.8537', '0.9294', '0.9156', '0.878', '0.9453', '0.8798', '0.9372', '0.8897', '0.9069', '0.8939', '0.8985', '0.9465', '0.8858', '0.8757', '0.8584', '0.9423', '0.857', '0.8533', '0.9303', '0.8974', '0.8847', '0.9486', '0.9432', '0.9316', '0.9058', '0.9326', '0.8833', '0.8728', '0.8769', '0.9217', '0.936', '0.8633', '0.8762', '0.9494', '0.8729', '0.9094', '0.8722', '0.9401', '0.9283', '0.8552', '0.9378', '0.8546', '0.8658', '0.8843', '0.9097', '0.8675', '0.8783', '0.8855', '0.8707', '0.8832', '0.8795', '0.883', '0.8515', '0.8611', '0.9091', '0.8809', '0.9363', '0.9112', '0.8765', '0.9125', '0.8524', '0.8681', '0.8538', '0.9349', '0.8765')
kps_r <- matrix(as.numeric(c(col_1_n, col_2_n)), ncol = 2)
kps_list <- apply(kps_r2, 1, function(r) list(precision = r[1], kappa = r[2]))
observedKappa = 0.91
fullSetBaserate = 0.2
handSetLength = 100
handSetBaserateInflation = 0.2
calc_rs <- replicate(10, rhoR:::calcRho( observedKappa, fullSetBaserate, handSetLength, handSetBaserateInflation, KPs = kps_list))
calc_cs <- replicate(10, rhoR:::calcRho_c(observedKappa, fullSetBaserate, handSetLength, handSetBaserateInflation, KPs = kps_r))
expect_true(rhoR:::all_equal(mean(calc_rs), mean(calc_cs), tolerance = 0.05))
calc_rs <- replicate(50, rhoR:::calcRho( observedKappa, fullSetBaserate, handSetLength, handSetBaserateInflation, KPs = kps_list))
calc_cs <- replicate(50, rhoR:::calcRho_c(observedKappa, fullSetBaserate, handSetLength, handSetBaserateInflation, KPs = kps_r))
expect_true(rhoR:::all_equal(mean(calc_rs), mean(calc_cs), tolerance = 0.1))
calc_rs <- replicate(50, rhoR:::calcRho( observedKappa, fullSetBaserate, handSetLength, handSetBaserateInflation, KPs = kps_list, replicates = 50))
calc_cs <- replicate(50, rhoR:::calcRho_c(observedKappa, fullSetBaserate, handSetLength, handSetBaserateInflation, KPs = kps_r, replicates = 50))
testthat::expect_true(rhoR:::all_equal(mean(calc_rs), mean(calc_cs), tolerance = 0.05))
testthat::expect_true(rhoR:::all_equal(mean(calc_rs), mean(calc_cs), tolerance = 0.1))
calc_rs <- replicate(10, rhoR:::calcRho( observedKappa, fullSetBaserate, handSetLength, handSetBaserateInflation))
calc_cs <- replicate(10, rhoR:::calcRho_c(observedKappa, fullSetBaserate, handSetLength, handSetBaserateInflation))
expect_true(rhoR:::all_equal(mean(calc_rs), mean(calc_cs), tolerance = 0.05))
expect_true(rhoR:::all_equal(mean(calc_rs), mean(calc_cs), tolerance = 0.1))
})
test_that("kps from c", {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment