Nothing
test_that("extract_tdt keeps bootstrap draws but withholds limits below 20 usable refits", {
raw <- simulate_tls(family = "binomial", seed = 143)
standardized <- standardize_data(
raw, temp = "temp", duration = "duration", n_total = "total",
n_surv = "survived", duration_unit = "minutes"
)
fit <- fit_4pl(standardized, family = "binomial", t_ref = 60, quiet = TRUE)
estimate <- stats::setNames(fit$fit$estimates$estimate,
fit$fit$estimates$parameter)
replicates <- matrix(
rep(estimate, 100L), nrow = 100L, byrow = TRUE,
dimnames = list(NULL, names(estimate))
)
converged <- c(TRUE, TRUE, rep(FALSE, 98L))
local_mocked_bindings(
tls_bootstrap_replicates = function(fit, nboot = 1000L, seed = NULL,
cores = 1L, trace = FALSE) {
list(replicates = replicates, converged = converged,
n_converged = sum(converged), nboot = 100L,
param_names = names(estimate))
},
.package = "freqTLS"
)
warning_text <- character()
withCallingHandlers(
extracted <- extract_tdt(fit, nboot = 100, seed = 144),
warning = function(w) {
warning_text <<- c(warning_text, conditionMessage(w))
invokeRestart("muffleWarning")
}
)
expect_true(any(grepl("Only 2 of 100 requested bootstrap refits",
warning_text, fixed = TRUE)))
summarized <- suppressWarnings(tls(fit, method = "bootstrap", nboot = 100,
seed = 144))
expect_equal(nrow(extracted$z$draws), 2L)
expect_equal(nrow(extracted$CTmax$draws), 2L)
expect_true(all(is.na(extracted$z$summary[c("z_lower", "z_upper")])))
expect_true(all(is.na(extracted$CTmax$summary[c("temp_lower", "temp_upper")])))
expect_equal(extracted$meta$nboot_requested, 100L)
expect_equal(extracted$meta$n_converged, 2L)
expect_equal(extracted$meta$n_failed, 98L)
expect_equal(extracted$meta$interval_counts$n_usable, c(2L, 2L))
expect_true(all(extracted$meta$interval_counts$conf.status ==
"bootstrap_unstable"))
expect_true(all(is.na(summarized$summary$lower) &
is.na(summarized$summary$upper)))
expect_equal(summarized$meta$nboot_requested, 100L)
expect_equal(summarized$meta$n_converged, 2L)
expect_equal(summarized$meta$n_failed, 98L)
printed <- paste(capture.output(print(summarized)), collapse = "\n")
expect_match(printed, "Bootstrap refits: 2 of 100 converged")
expect_match(printed, "bootstrap_unstable")
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.