| svykm {survey} | R Documentation |
Estimates the survival function using a weighted Kaplan-Meier estimator. Standard errors are not currently available.
svykm(formula, design,se=FALSE, ...) ## S3 method for class 'svykm': plot(x,xlab="time",ylab="Proportion surviving", ylim=c(0,1),ci=NULL,lty=1,...) ## S3 method for class 'svykm': lines(x,xlab="time",type="s",ci=FALSE,lty=1,...) ## S3 method for class 'svykmlist': plot(x, pars=NULL, ci=FALSE,...) ## S3 method for class 'svykm': quantile(x, probs=c(0.75,0.5,0.25),...) ## S3 method for class 'svykm': confint(object,parm,level=0.95,...)
formula |
Two-sided formula. The response variable should be a right-censored
Surv object |
design |
survey design object |
se |
Compute standard errors? This is slow for moderate to large data sets |
... |
in plot and lines methods, graphical
parameters |
x |
a svykm or svykmlist object |
xlab,ylab,ylim,type |
as for plot |
lty |
Line type, see par |
ci |
Plot the confidence interval |
pars |
A list of vectors of graphical parameters for the
separate curves in a svykmlist object |
object |
A svykm object |
parm |
vector of times to report confidence intervals |
level |
confidence level |
probs |
survival probabilities for computing survival quantiles
(note that these are the complement of the usual quantile input |
For svykm, an object of class svykm for a single curve or svykmlist
for multiple curves.
data(pbc, package="survival")
pbc$randomized <- with(pbc, !is.na(trt) & trt>0)
biasmodel<-glm(randomized~age*edema,data=pbc)
pbc$randprob<-fitted(biasmodel)
dpbc<-svydesign(id=~1, prob=~randprob, strata=~edema, data=subset(pbc,randomized))
s1<-svykm(Surv(time,status>0)~1, design=dpbc)
s2<-svykm(Surv(time,status>0)~I(bili>6), design=dpbc)
plot(s1)
plot(s2)
plot(s2, lwd=2, pars=list(lty=c(1,2),col=c("purple","forestgreen")))
quantile(s1, probs=c(0.9,0.75,0.5,0.25,0.1))
s3<-svykm(Surv(time,status>0)~I(bili>6), design=dpbc,se=TRUE)
plot(s3[[2]],col="purple")
confint(s3[[2]], 365*(1:5))