Description Usage Arguments Details Value Author(s) Examples
This function is used internally to obtain inverse of the probability of censoring weights.
1 2 
formula 
A survival formula like, 
data 
The data used for fitting the censoring model 
method 
Censoring model used for estimation of the (conditional) censoring distribution. 
args 
A list of arguments which is passed to method 
times 
For 
subject.times 
For 
lag 
If equal to 
what 
Decide about what to do: If equal to

keep 
Which elements to add to the output. Any subset of the vector 
Inverse of the probability of censoring weights (IPCW) 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 ipcw 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 values IPCW.subject.times
in the right order for some
choices of method
.
A list with elements depending on argument keep
.
times 
The times at which weights are estimated 
IPCW.times 
Estimated weights at 
IPCW.subject.times 
Estimated weights at individual time values

fit 
The fitted censoring model 
method 
The method for modelling the censoring distribution 
call 
The call 
Thomas A. Gerds [email protected]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48  library(prodlim)
library(rms)
dat=SimSurv(30)
dat < dat[order(dat$time),]
# using the marginal KaplanMeier for the censoring times
WKM=ipcw(Hist(time,status)~X2,
data=dat,
method="marginal",
times=sort(unique(dat$time)),
subject.times=dat$time,keep=c("fit"))
plot(WKM$fit)
WKM$fit
# using the Cox model for the censoring times given X2
library(survival)
WCox=ipcw(Hist(time=time,event=status)~X2,
data=dat,
method="cox",
times=sort(unique(dat$time)),
subject.times=dat$time,keep=c("fit"))
WCox$fit
plot(WKM$fit)
lines(sort(unique(dat$time)),
1WCox$IPCW.times[1,],
type="l",
col=2,
lty=3,
lwd=3)
lines(sort(unique(dat$time)),
1WCox$IPCW.times[5,],
type="l",
col=3,
lty=3,
lwd=3)
# using the stratified KaplanMeier
# for the censoring times given X2
WKM2=ipcw(Hist(time,status)~X2,
data=dat,
method="nonpar",
times=sort(unique(dat$time)),
subject.times=dat$time,keep=c("fit"))
plot(WKM2$fit,add=FALSE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.