survfit.coxph package:survival R Documentation _C_o_m_p_u_t_e _a _S_u_r_v_i_v_a_l _C_u_r_v_e _f_r_o_m _a _C_o_x _m_o_d_e_l _D_e_s_c_r_i_p_t_i_o_n: Computes the predicted survivor function for a Cox proportional hazards model. _U_s_a_g_e: ## S3 method for class 'coxph': survfit(formula, newdata, se.fit=TRUE, conf.int=.95, individual=FALSE, type,vartype, conf.type=c("log","log-log","plain","none"),...) _A_r_g_u_m_e_n_t_s: formula: A 'coxph' object. newdata: a data frame with the same variable names as those that appear in the 'coxph' formula. The curve(s) produced will be representative of a cohort whose covariates correspond to the values in 'newdata'. Default is the mean of the covariates used in the 'coxph' fit. individual: a logical value indicating whether each row of 'newdata' represents a distinct individual (FALSE, the default), or if each row of the data frame represents different time epochs for only one individual (TRUE). In the former case the result will have one curve for each row in 'newdata', in the latter only a single curve will be produced. conf.int: the level for a two-sided confidence interval on the survival curve(s). Default is 0.95. se.fit: a logical value indicating whether standard errors should be computed. Default is 'TRUE'. type,vartype: a character string specifying the type of survival curve. Possible values are '"aalen"' or '"kaplan-meier"' (only the first two characters are necessary). The default is '"aalen"' Earlier versions of 'survfit' used 'type="tsiatis"' to get the '"aalen"' estimator. For backward compatibility, this is still allowed. conf.type: One of '"none"', '"plain"', '"log"' (the default), or '"log-log"'. Only enough of the string to uniquely identify it is necessary. The first option causes confidence intervals not to be generated. The second causes the standard intervals 'curve +- k *se(curve)', where k is determined from 'conf.int'. The log option calculates intervals based on the cumulative hazard or log(survival). The last option bases intervals on the log hazard or log(-log(survival)). ...: for future methods _D_e_t_a_i_l_s: See 'survfit' for more Details. The estimates used are the Kalbfleisch-Prentice (Kalbfleisch and Prentice, 1980, p.86) and the Tsiatis/Link/Breslow, which reduce to the Kaplan-Meier and Fleming-Harrington estimates, respectively, when the weights are unity. When the parent data is a Cox model, there is an extra term in the variance of the curve, due to the variance of the coefficients and hence variance in the computed weights. Details of the Aalen estimator and its variance are found in Tsiatis (1981). The two variants of the F-H estimate have to do with how ties are handled. If there were 3 deaths out of 10 at risk, then the first increments the hazard by 3/10 and the second by 1/10 + 1/9 + 1/8. For the first method S(t) = exp(H), where H is the Nelson-Aalen cumulative hazard estimate, whereas the 'fh2' method will give results S(t) results closer to the Kaplan-Meier. For curves created after a Cox model these correspond to the Breslow and Efron estimates, respectively, and the proper choice is made automatically. _V_a_l_u_e: an object of class '"survfit"'. See 'survfit.object' for details. Methods defined for survfit objects are 'print', 'plot', 'lines', and 'points'. _R_e_f_e_r_e_n_c_e_s: Dorey, F. J. and Korn, E. L. (1987). Effective sample sizes for confidence intervals for survival probabilities. _Statistics in Medicine_ *6*, 679-87. Fleming, T. H. and Harrington, D. P. (1984). Nonparametric estimation of the survival distribution in censored data. _Comm. in Statistics_ *13*, 2469-86. Kablfleisch, J. D. and Prentice, R. L. (1980). _The Statistical Analysis of Failure Time Data._ New York:Wiley. Link, C. L. (1984). Confidence intervals for the survival function using Cox's proportional hazards model with covariates. _Biometrics_ *40*, 601-610. Tsiatis, A. (1981). A large sample study of the estimate for the integrated hazard function in Cox's regression model for survival data. _Annals of Statistics_ *9*, 93-108. _S_e_e _A_l_s_o: 'print', 'plot', 'lines', 'coxph', 'Surv', 'strata'. _E_x_a_m_p_l_e_s: #fit a Kaplan-Meier and plot it fit <- survfit(Surv(time, status) ~ x, data = aml) plot(fit, lty = 2:3) legend(100, .8, c("Maintained", "Nonmaintained"), lty = 2:3) #fit a Cox proportional hazards model and plot the #predicted survival for a 60 year old fit <- coxph(Surv(futime, fustat) ~ age, data = ovarian) plot(survfit(fit, newdata=data.frame(age=60)), xscale=365.25, xlab = "Years", ylab="Survival") # Here is the data set from Turnbull # There are no interval censored subjects, only left-censored (status=3), # right-censored (status 0) and observed events (status 1) # # Time # 1 2 3 4 # Type of observation # death 12 6 2 3 # losses 3 2 0 3 # late entry 2 4 2 5 # tdata <- data.frame(time =c(1,1,1,2,2,2,3,3,3,4,4,4), status=rep(c(1,0,2),4), n =c(12,3,2,6,2,4,2,0,2,3,3,5)) fit <- survfit(Surv(time, time, status, type='interval') ~1, data=tdata, weight=n) # # Time to progression/death for patients with monoclonal gammopathy # Competing risk curves (cumulative incidence) fit1 <- survfit(Surv(stop, event=='progression') ~1, data=mgus1, subset=(start==0)) fit2 <- survfit(Surv(stop, status) ~1, data=mgus1, subset=(start==0), etype=event) #competing risks # CI curves are always plotted from 0 upwards, rather than 1 down plot(fit2, fun='event', xscale=365.25, xmax=7300, mark.time=FALSE, col=2:3, xlab="Years post diagnosis of MGUS") lines(fit1, fun='event', xscale=365.25, xmax=7300, mark.time=FALSE, conf.int=FALSE) text(10, .4, "Competing Risk: death", col=3) text(16, .15,"Competing Risk: progression", col=2) text(15, .30,"KM:prog")