svykm {survey} | R Documentation |
Estimates the survival function using a weighted Kaplan-Meier estimator. Standard errors are not currently available.
svykm(formula, design, ...) ## S3 method for class 'svykm': plot(x,xlab="time",ylab="Proportion surviving", ylim=c(0,1),...) ## S3 method for class 'svykm': lines(x,xlab="time",type="s",...) ## S3 method for class 'svykmlist': plot(x, pars=NULL, ...) ## S3 method for class 'svykm': quantile(x, probs=c(0.75,0.5,0.25),...)
formula |
Two-sided formula. The response variable should be a right-censored
Surv object |
design |
survey design object |
... |
in plot and lines methods, graphical
parameters |
x |
a svykm or svykmlist object |
xlab,ylab,ylim,type |
as for plot |
pars |
A list of vectors of graphical parameters for the
separate curves in a svykmlist object |
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") biasmodel<-glm(I(trt>0)~age*edema,data=pbc) pbc$randprob<-fitted(biasmodel) dpbc<-svydesign(id=~1, prob=~randprob, strata=~edema, data=subset(pbc,trt>0)) s1<-svykm(Surv(time,status)~1, design=dpbc) s2<-svykm(Surv(time,status)~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))