
Compute redistribute-to-the-right weights
rttright.RdFor many survival estimands, one approach is to redistribute each censored observation's weight to those other observations with a longer survival time (think of distributing an estate to the heirs). Then compute on the remaining, uncensored data.
Arguments
- formula
a formula object, which must have a
Survobject as the response on the left of the~operator and, if desired, terms separated by + operators on the right. Each unique combination of predictors will define a separate strata.- data
a data frame in which to interpret the variables named in the formula,
subsetandweightsarguments.- weights
The weights must be nonnegative and it is strongly recommended that they be strictly positive, since zero weights are ambiguous, compared to use of the
subsetargument.- subset
expression saying that only a subset of the rows of the data should be used in the fit.
- na.action
a missing-data filter function, applied to the model frame, after any
subsetargument has been used. Default isoptions()$na.action.- times
a vector of time points, for which to return updated weights. If missing, a time after the largest time in the data is assumed.
- id
optional: if the data set has multiple rows per subject, a a variable containing the subect identifier of each row.
- timefix
correct for possible round-off error
- renorm
the resulting weights sum to 1 within each group
Details
The formula argument is treated exactly the same as in the
survfit function.
Redistribution is recursive: redistribute the weight of the first
censored observation to all those with longer time, which may include
other censored observations. Then redistribute the next smallest and
etc. up to the specified time value.
After re-distributing the weight for a censored observation to other
observations that are not censored, ordinary non-censored methods can
often be applied. For example, redistribution of the weights,
followed by computation of the weighted cumulative distribution
function, reprises the Kaplan-Meier estimator.
A primary use of this routine is illustration of methods or exploration of new methods. Methods that use RTTR directly, such as the Brier score, will often do these compuations internally.
A covariate on the right hand side of the formula causes redistribution to occur within group; a censoring in group 1 redistributes weights to others in group 1, etc. This is appropriate when the censoring pattern depends upon group.
Examples
afit <- survfit(Surv(time, status) ~1, data=aml)
rwt <- rttright(Surv(time, status) ~1, data=aml)
# Reproduce a Kaplan-Meier
index <- order(aml$time)
cdf <- cumsum(rwt[index]) # weighted CDF
cdf <- cdf[!duplicated(aml$time[index], fromLast=TRUE)] # remove duplicate times
cbind(time=afit$time, KM= afit$surv, RTTR= 1-cdf)
#> time KM RTTR
#> [1,] 5 0.91304348 0.91304348
#> [2,] 8 0.82608696 0.82608696
#> [3,] 9 0.78260870 0.78260870
#> [4,] 12 0.73913043 0.73913043
#> [5,] 13 0.69565217 0.69565217
#> [6,] 16 0.69565217 0.69565217
#> [7,] 18 0.64596273 0.64596273
#> [8,] 23 0.54658385 0.54658385
#> [9,] 27 0.49689441 0.49689441
#> [10,] 28 0.49689441 0.49689441
#> [11,] 30 0.44168392 0.44168392
#> [12,] 31 0.38647343 0.38647343
#> [13,] 33 0.33126294 0.33126294
#> [14,] 34 0.27605245 0.27605245
#> [15,] 43 0.22084196 0.22084196
#> [16,] 45 0.16563147 0.16563147
#> [17,] 48 0.08281573 0.08281573
#> [18,] 161 0.08281573 0.08281573
# Hormonal patients have a diffent censoring pattern
wt2 <- rttright(Surv(dtime, death) ~ hormon, rotterdam, times= 365*c(3, 5))
dim(wt2)
#> [1] 2982 2