| cch_tidiers {broom} | R Documentation |
Tidiers for case-cohort analyses: summarize each estimated coefficient, or test the overall model.
## S3 method for class 'cch' tidy(x, conf.level = 0.95, ...) ## S3 method for class 'cch' glance(x, ...)
x |
a "cch" object |
conf.level |
confidence level for CI |
... |
extra arguments (not used) |
It is not clear what an augment method would look like,
so none is provided. Nor is there currently any way to extract the
covariance or the residuals.
All tidying methods return a data.frame without rownames, whose structure depends on the method chosen.
tidy returns a data.frame with one row for each term
term |
name of term |
estimate |
estimate of coefficient |
stderror |
standard error |
statistic |
Z statistic |
p.value |
p-value |
conf.low |
low end of confidence interval |
conf.high |
high end of confidence interval |
glance returns a one-row data.frame with the following
columns:
score |
score |
rscore |
rscore |
p.value |
p-value from Wald test |
iter |
number of iterations |
n |
number of predictions |
nevent |
number of events |
cch
if (require("survival", quietly = TRUE)) {
# examples come from cch documentation
subcoh <- nwtco$in.subcohort
selccoh <- with(nwtco, rel==1|subcoh==1)
ccoh.data <- nwtco[selccoh,]
ccoh.data$subcohort <- subcoh[selccoh]
## central-lab histology
ccoh.data$histol <- factor(ccoh.data$histol,labels=c("FH","UH"))
## tumour stage
ccoh.data$stage <- factor(ccoh.data$stage,labels=c("I","II","III" ,"IV"))
ccoh.data$age <- ccoh.data$age/12 # Age in years
fit.ccP <- cch(Surv(edrel, rel) ~ stage + histol + age, data = ccoh.data,
subcoh = ~subcohort, id= ~seqno, cohort.size = 4028)
tidy(fit.ccP)
# coefficient plot
library(ggplot2)
ggplot(tidy(fit.ccP), aes(x = estimate, y = term)) + geom_point() +
geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) +
geom_vline(xintercept = 0)
# compare between methods
library(dplyr)
fits <- data_frame(method = c("Prentice", "SelfPrentice", "LinYing")) %>%
group_by(method) %>%
do(tidy(cch(Surv(edrel, rel) ~ stage + histol + age, data = ccoh.data,
subcoh = ~subcohort, id= ~seqno, cohort.size = 4028,
method = .$method)))
# coefficient plots comparing methods
ggplot(fits, aes(x = estimate, y = term, color = method)) + geom_point() +
geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) +
geom_vline(xintercept = 0)
}