This function is used internally to contruct pseudo values by inverse of the probability of censoring weights.
subjectWeights(formula, data, method = c("cox", "marginal", "km", "nonpar",
"forest", "none"), args, lag = 1)
A survival formula like, Surv(time,status)~1 or
Hist(time,status)~1 where status=0 means censored. The status
variable is internally reversed for estimation of censoring rather
than survival probabilities. Some of the available models, see
argument model
, will use predictors on the right hand side
of the formula.
The data used for fitting the censoring model
Censoring model used for estimation of the (conditional) censoring distribution.
Arguments passed to the fitter of the method.
If equal to 1
then obtain G(T_i-|X_i)
, if
equal to 0
estimate the conditional censoring distribution
at the subjectTimes, i.e. (G(T_i|X_i)
).
The times at which weights are estimated
Estimated weights at individual time values
subjectTimes
The time lag.
The fitted censoring model
The method for modelling the censoring distribution
The call
Inverse of the probability of censoring weights usually refer to the probabilities of not being censored at certain time points. These probabilities are also the values of the conditional survival function of the censoring time given covariates. The function subjectWeights estimates the conditional survival function of the censoring times and derives the weights.
IMPORTANT: the data set should be ordered, order(time,-status)
in
order to get the weights
in the right order for some choices of
method
.
library(prodlim)
library(survival)
dat=SimSurv(300)
dat <- dat[order(dat$time,-dat$status),]
# using the marginal Kaplan-Meier for the censoring times
WKM=subjectWeights(Hist(time,status)~X2,data=dat,method="marginal")
plot(WKM$fit)
WKM$fit
WKM$weights
# using the Cox model for the censoring times given X2
WCox=subjectWeights(Surv(time,status)~X2,data=dat,method="cox")
WCox
plot(WCox$weights,WKM$weights)
# using the stratified Kaplan-Meier for the censoring times given X2
WKM2 <- subjectWeights(Surv(time,status)~X2,data=dat,method="nonpar")
plot(WKM2$fit,add=FALSE)
Run the code above in your browser using DataLab