View source: R/subjectWeights.R
subjectWeights | R Documentation |
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
)
formula |
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 |
data |
The data used for fitting the censoring model |
method |
Censoring model used for estimation of the (conditional) censoring distribution. |
args |
Arguments passed to the fitter of the method. |
lag |
If equal to |
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
.
times |
The times at which weights are estimated |
weights |
Estimated weights at individual time values
|
lag |
The time lag. |
fit |
The fitted censoring model |
method |
The method for modelling the censoring distribution |
call |
The call |
Thomas A. Gerds tag@biostat.ku.dk
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.