Survival analysis is concerned with looking at the amount of time that elapses before an event occurs. An obvious application is to look at mortality statistics (predicting how long people live), but it can also be applied to mechanical systems (the time before a failure occurs), marketing (the amount of time before a consumer cancels an account), or other areas.

In R, there are a variety of functions in the `survival`

library for modeling survival data.

To estimate a survival curve for censored data, you can use the
`survfit`

function:

library(survival) survfit(formula, data, weights, subset, na.action, etype, id, ...)

This function accepts the following arguments.

Argument | Description |
---|---|

formula | Describes the relationship between the response value and
the predictors. The response value should be a `Surv` object. |

data | The data frame in which to evaluate formula. |

weights | Weights for observations. |

subset | Subset of observation to use in fitting the model. |

na.action | Function to deal with missing values. |

etype | The variable giving the type of event. |

id | The variable that identifies individual subjects. |

type | Specifies the type of survival curve. Options include
`"kaplan-meier"` , `"fleming-harrington"` , and `"fh2"` . |

error | Specifies the type of error. Possible values are `"greenwood"` for the Greenwood formula or
`"tsiatis"` for the Tsiatis
formula. |

conf.type | Confidence interval type. One of `"none"` , `"plain"` , `"log"` (the default), or `"log-log"` . |

conf.lower | A character string to specify modified lower limits to the curve; ... |

Start Free Trial

No credit card required