| 1 |
skip_on_cran() |
| 2 |
|
| 3 |
skip_if_not_installed("modeltests") |
| 4 |
library(modeltests) |
| 5 |
|
| 6 |
skip_if_not_installed("survival") |
| 7 |
suppressPackageStartupMessages(library(survival)) |
| 8 |
|
| 9 |
subcoh <- nwtco$in.subcohort |
| 10 |
selccoh <- with(nwtco, rel == 1 | subcoh == 1) |
| 11 |
ccoh.data <- nwtco[selccoh, ] |
| 12 |
ccoh.data$subcohort <- subcoh[selccoh] |
| 13 |
ccoh.data$histol <- factor(ccoh.data$histol, labels = c("FH", "UH")) |
| 14 |
ccoh.data$stage <- |
| 15 |
factor(ccoh.data$stage, labels = c("I", "II", "III", "IV")) |
| 16 |
ccoh.data$age <- ccoh.data$age / 12 |
| 17 |
|
| 18 |
fit <- cch( |
| 19 |
Surv(edrel, rel) ~ stage + histol + age, |
| 20 |
data = ccoh.data, |
| 21 |
subcoh = ~subcohort, |
| 22 |
id = ~seqno, |
| 23 |
cohort.size = 4028 |
| 24 |
) |
| 25 |
|
| 26 |
test_that("cch tidier arguments", { |
| 27 |
check_arguments(tidy.cch, strict = FALSE) |
| 28 |
check_arguments(glance.cch) |
| 29 |
}) |
| 30 |
|
| 31 |
test_that("tidy.cch", { |
| 32 |
td <- tidy(fit) |
| 33 |
check_tidy_output(td) |
| 34 |
}) |
| 35 |
|
| 36 |
test_that("glance.cch", { |
| 37 |
gl <- glance(fit) |
| 38 |
check_glance_outputs(gl) |
| 39 |
}) |