Main Content

Analysis of Lifetime Data

Nonparametric and semiparametric methods for analyzing reliability and survival data

Survival analysis is time-to-event analysis, that is, when the outcome of interest is the time until an event occurs. Examples of time-to-events are the time until infection, reoccurrence of a disease, or recovery in health sciences; the duration of unemployment in economics; the time until the failure of a machine part or the lifetime of light bulbs in engineering, and so on.

To perform survival analysis:

  • Fit a model to your data. Use one or more of the functions listed on this page under Lifetime Data Analysis or Cox Proportional Hazards Models.

  • Plot or otherwise analyze the fitted model using the methods in the examples listed on this page under Topics, or using Cox Proportional Hazards Models functions.

The fitcox function provides an object-oriented way to fit a Cox proportional hazards model. The resulting CoxModel object contains many statistics and methods for analysis. coxphfit is an older function for fitting Cox models that also enables code generation.


expand all

ksdensityKernel smoothing function estimate for univariate and bivariate data
mleMaximum likelihood estimates
mlecovAsymptotic covariance of maximum likelihood estimators
evfitExtreme value parameter estimates
expfitExponential parameter estimates
gamfitGamma parameter estimates
lognfitLognormal parameter estimates
normfitNormal parameter estimates
wblfitWeibull parameter estimates
fitdistFit probability distribution object to data
distributionFitterOpen Distribution Fitter app
ecdfEmpirical cumulative distribution function
ecdfhistHistogram based on empirical cumulative distribution function
plotSurvivalPlot survival function of Cox proportional hazards model (Since R2021a)
probplotProbability plots
wblplotWeibull probability plot

Fit Cox Proportional Hazards Model

coxphfitCox proportional hazards regression

Fit CoxModel Object

fitcoxCreate Cox proportional hazards model (Since R2021a)

CoxModel Methods

coefciConfidence interval for Cox proportional hazards model coefficients (Since R2021a)
discardResidualsRemove residuals from Cox model (Since R2022b)
hazardratioEstimate Cox model hazard relative to baseline (Since R2021a)
linhyptestLinear hypothesis tests on Cox model coefficients (Since R2021a)
plotSurvivalPlot survival function of Cox proportional hazards model (Since R2021a)
survivalCalculate survival of Cox proportional hazards model (Since R2021a)


CoxModelCox proportional hazards model (Since R2021a)