tonnytonnychopper
求助做出的生存函数的图上对于删失数据并没有显示+是怎么回事呢?
用的数据是www.umass.edu/statdata/statdata/data/uissurv.txt 公开的数据
w<- read.csv("uissurv.csv",header=T,sep=",")
library(survival);
y<-Surv(w$time,w$censor)
kmfit<-survfit(y~1,conf.int=0.95,conf.type="log")
plot(kmfit)
kmfit1<-survfit(y~site,w)
plot(kmfit1,lty=1:2)
WMU_xiaof
可以试试GGally包(ggplot绘图包+)
里面的ggsurv函数
Usage
ggsurv(s, CI = "def", plot.cens = TRUE, surv.col = "gg.def",
cens.col = "gg.def", lty.est = 1, lty.ci = 2, size.est = 0.5,
size.ci = size.est, cens.size = 2, cens.shape = 3, back.white = FALSE,
xlab = "Time", ylab = "Survival", main = "")
Arguments
s an object of class survfit
CI should a confidence interval be plotted? Defaults to TRUE for single stratum
objects and FALSE for multiple strata objects.
plot.cens mark the censored observations?
surv.col colour of the survival estimate. Defaults to black for one stratum, and to the
default ggplot2 colours for multiple strata. Length of vector with colour names
should be either 1 or equal to the number of strata.
cens.col colour of the points that mark censored observations.
lty.est linetype of the survival curve(s). Vector length should be either 1 or equal to the
number of strata.
lty.ci linetype of the bounds that mark the 95% CI.
size.est line width of the survival curve
size.ci line width of the 95% CI
cens.size point size of the censoring points
cens.shape shape of the points that mark censored observations.
back.white if TRUE the background will not be the default grey of ggplot2 but will be
white with borders around the plot.
xlab the label of the x-axis.
ylab the label of the y-axis.
main the plot label.
;-)