Debian Codegraph @

man/glance.survfit.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/survival-survfit.R
3 \name{glance.survfit}
4 \alias{glance.survfit}
5 \title{Glance at a(n) survfit object}
6 \usage{
7 \method{glance}{survfit}(x, ...)
8 }
9 \arguments{
10 \item{x}{An \code{survfit} object returned from \code{\link[survival:survfit]{survival::survfit()}}.}
11
12 \item{...}{Additional arguments passed to \code{\link[survival:summary.survfit]{survival::summary.survfit()}}. Important
13 arguments include \code{rmean}.}
14 }
15 \description{
16 Glance accepts a model object and returns a \code{\link[tibble:tibble]{tibble::tibble()}}
17 with exactly one row of model summaries. The summaries are typically
18 goodness of fit measures, p-values for hypothesis tests on residuals,
19 or model convergence information.
20
21 Glance never returns information from the original call to the modeling
22 function. This includes the name of the modeling function or any
23 arguments passed to the modeling function.
24
25 Glance does not calculate summary measures. Rather, it farms out these
26 computations to appropriate methods and gathers the results together.
27 Sometimes a goodness of fit measure will be undefined. In these cases
28 the measure will be reported as \code{NA}.
29
30 Glance returns the same number of columns regardless of whether the
31 model matrix is rank-deficient or not. If so, entries in columns
32 that no longer have a well-defined value are filled in with an \code{NA}
33 of the appropriate type.
34 }
35 \examples{
36 \dontshow{if (rlang::is_installed(c("survival", "ggplot2"))) withAutoprint(\{ # examplesIf}
37
38 # load libraries for models and data
39 library(survival)
40
41 # fit model
42 cfit <- coxph(Surv(time, status) ~ age + sex, lung)
43 sfit <- survfit(cfit)
44
45 # summarize model fit with tidiers + visualization
46 tidy(sfit)
47 glance(sfit)
48
49 library(ggplot2)
50
51 ggplot(tidy(sfit), aes(time, estimate)) +
52 geom_line() +
53 geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .25)
54
55 # multi-state
56 fitCI <- survfit(Surv(stop, status * as.numeric(event), type = "mstate") ~ 1,
57 data = mgus1, subset = (start == 0)
58 )
59
60 td_multi <- tidy(fitCI)
61
62 td_multi
63
64 ggplot(td_multi, aes(time, estimate, group = state)) +
65 geom_line(aes(color = state)) +
66 geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .25)
67 \dontshow{\}) # examplesIf}
68 }
69 \seealso{
70 \code{\link[=glance]{glance()}}, \code{\link[survival:survfit]{survival::survfit()}}
71
72 Other cch tidiers:
73 \code{\link{glance.cch}()},
74 \code{\link{tidy.cch}()}
75
76 Other survival tidiers:
77 \code{\link{augment.coxph}()},
78 \code{\link{augment.survreg}()},
79 \code{\link{glance.aareg}()},
80 \code{\link{glance.cch}()},
81 \code{\link{glance.coxph}()},
82 \code{\link{glance.pyears}()},
83 \code{\link{glance.survdiff}()},
84 \code{\link{glance.survexp}()},
85 \code{\link{glance.survreg}()},
86 \code{\link{tidy.aareg}()},
87 \code{\link{tidy.cch}()},
88 \code{\link{tidy.coxph}()},
89 \code{\link{tidy.pyears}()},
90 \code{\link{tidy.survdiff}()},
91 \code{\link{tidy.survexp}()},
92 \code{\link{tidy.survfit}()},
93 \code{\link{tidy.survreg}()}
94 }
95 \concept{cch tidiers}
96 \concept{survival tidiers}
97 \value{
98 A \code{\link[tibble:tibble]{tibble::tibble()}} with exactly one row and columns:
99 \item{events}{Number of events.}
100 \item{n.max}{Maximum number of subjects at risk.}
101 \item{n.start}{Initial number of subjects at risk.}
102 \item{nobs}{Number of observations used.}
103 \item{records}{Number of observations}
104 \item{rmean}{Restricted mean (see [survival::print.survfit()]).}
105 \item{rmean.std.error}{Restricted mean standard error.}
106 \item{conf.low}{lower end of confidence interval on median}
107 \item{conf.high}{upper end of confidence interval on median}
108 \item{median}{median survival}
109
110 }