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
library(survival) survfit(formula, data, weights, subset, na.action, etype, id, ...)
This function accepts the following arguments.
|formula||Describes the relationship between the response value and
the predictors. The response value should be a |
|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
|error||Specifies the type of error. Possible values are |
|conf.type||Confidence interval type. One of |
|conf.lower||A character string to specify modified lower limits to the curve; ...|