survival-analysis

Plotting survival curves in R with ggplot2

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 16:31:10
问题 I've been looking for a solution to plot survival curves using ggplot2. I've found some nice examples, but they do not follow the whole ggplot2 aesthetics (mainly regarding shaded confidence intervals and so on). So finally I've written my own function: ggsurvplot<-function(s, conf.int=T, events=T, shape="|", xlab="Time", ylab="Survival probability", zeroy=F, col=T, linetype=F){ #s: a survfit object. #conf.int: TRUE or FALSE to plot confidence intervals. #events: TRUE or FALSE to draw points

How to plot the survival curve generated by survreg (package survival of R)?

早过忘川 提交于 2019-11-27 11:29:14
I’m trying to fit and plot a Weibull model to a survival data. The data has just one covariate, cohort, which runs from 2006 to 2010. So, any ideas on what to add to the two lines of code that follows to plot the survival curve of the cohort of 2010? library(survival) s <- Surv(subSetCdm$dur,subSetCdm$event) sWei <- survreg(s ~ cohort,dist='weibull',data=subSetCdm) Accomplishing the same with the Cox PH model is rather straightforward, with the following lines. The problem is that survfit() doesn’t accept objects of type survreg. sCox <- coxph(s ~ cohort,data=subSetCdm) cohort <- factor(c(2010

How to plot the survival curve generated by survreg (package survival of R)?

五迷三道 提交于 2019-11-26 22:20:31
问题 I’m trying to fit and plot a Weibull model to a survival data. The data has just one covariate, cohort, which runs from 2006 to 2010. So, any ideas on what to add to the two lines of code that follows to plot the survival curve of the cohort of 2010? library(survival) s <- Surv(subSetCdm$dur,subSetCdm$event) sWei <- survreg(s ~ cohort,dist='weibull',data=subSetCdm) Accomplishing the same with the Cox PH model is rather straightforward, with the following lines. The problem is that survfit()