turnbull() estimates the survival function when event times are only known to lie in a window
(lower, upper], as with periodic follow-up visits or inspections. Exact, right-censored,
left-censored, and interval-censored observations can be mixed in one fit. With only exact and
right-censored times, the estimate is the Kaplan-Meier curve.
Usage
turnbull(
formula,
data,
weights,
subset,
na.action = stats::na.omit,
tol = 1e-09,
max_iter = 10000
)Arguments
- formula
A formula with a
Surv()response on the left and either1or the grouping variables on the right. The response is interval-censored, such asSurv(lower, upper, type = "interval2"), or right- or left-censored.- data
A data frame holding the variables in
formula.- weights
Optional case weights, a column of
dataor a numeric vector.- subset
An optional expression selecting the rows of
datato use.- na.action
What to do with rows that have missing values. The default drops them.
- tol
The convergence tolerance: the EM stops when no interval's mass changes by more than this. The default is
1e-9.- max_iter
The largest number of EM iterations. The default is
10000.
Value
A turnbull object. as.data.frame() gives one row per group and maximal intersection
interval: strata, the grouping variables, interval_low, interval_high, prob_mass, and
estimate, the survival just after the interval. predict(), quantile(), median(),
rmst(), and rmrl() read the curve.
Details
The nonparametric maximum likelihood estimate puts its probability mass on the maximal intersection intervals of the data. These are found by splitting the time axis at every observed bound and merging neighboring pieces that every observation either fully covers or fully excludes, since only their combined mass is identified (Gentleman and Geyer, 1994). The masses are then found with the self-consistency (EM) algorithm, which increases the likelihood at every step.
Only the total mass on each interval is identified, not where it sits inside the interval. So
the curve is known exactly outside the intervals and at those that are single points, and is
unknown strictly inside the others. predict() gives NA there, and quantile() gives the
bounds of the interval the curve crosses in rather than a single time. rmst() and rmrl()
need one curve, so they place each interval's mass at its upper end. That is the latest
placement the data allow, which makes them upper bounds rather than unbiased estimates.
References
Turnbull, B. W. (1976). The empirical distribution function with arbitrarily grouped, censored and truncated data. Journal of the Royal Statistical Society, Series B, 38, 290-295.
Gentleman, R. and Geyer, C. J. (1994). Maximum likelihood for interval censored data: consistency and computation. Biometrika, 81, 618-623.
Examples
# Six subjects seen at irregular visits. NA bounds are open, so (4, NA] is right-censored.
visits <- data.frame(
lower = c(0, 4, 7, 0, 3, 5),
upper = c(4, NA, 7, 2.5, 6, 5)
)
fit <- turnbull(Surv(lower, upper, type = "interval2") ~ 1, data = visits)
fit
#> <turnbull> Surv(lower, upper, type = "interval2") ~ 1
#>
#> n intervals ambiguous iterations converged
#> all 6 8 6 120 TRUE
as.data.frame(fit)
#> strata interval_low interval_high prob_mass estimate
#> 1 all 0.0 2.5 3.333333e-01 0.6666667
#> 2 all 2.5 3.0 4.075047e-38 0.6666667
#> 3 all 3.0 4.0 6.349381e-09 0.6666667
#> 4 all 4.0 5.0 2.965203e-26 0.6666667
#> 5 all 5.0 5.0 4.444444e-01 0.2222222
#> 6 all 5.0 6.0 2.965203e-26 0.2222222
#> 7 all 6.0 7.0 9.163655e-74 0.2222222
#> 8 all 7.0 7.0 2.222222e-01 0.0000000