creates a survival model for event times ei.

Details and Options

  • SurvivalModelFit is used in survival, reliability, and duration analysis. It gives a nonparametric survival distribution as well as measures of confidence directly from incomplete data.
  • SurvivalModelFit returns a symbolic SurvivalModel object to represent the survival model it constructs. The properties and diagnostics of the model can be obtained from model["property"].
  • The form of events ei follows the form used in EventData.
  • Different functional forms of the survival model can be obtained by specifying the form h in model[h]. The following forms can be used:
  • "CDF"cumulative distribution function
    "CHF"cumulative hazard function
    "SF"survival function
  • The value of the fitted function h from SurvivalModelFit at a particular time t can be found from model[h][t]. model[t] is equivalent to model["SF"][t].
  • Specifying Normal[model] gives a pure function form of the estimated survival function.
  • A list of available model properties can be obtained using model["Properties"].
  • Properties of a fitted function h of the model can be obtained using model["property",h]. The expression model["property"] is equivalent to model["property","SF"].
  • Some properties related to the fitted function that can be obtained using model["property"]:
  • "EventTable"formatted table summarizing the fitted function
    "EventTableEntries"entries from the event table
    "FittedFunction"pure functional form of the fitted function
    "FullEventTable"extended event table
    "FullEventTableEntries"entries from the full event table
    "MeanSurvival"the mean survival time
    "MedianSurvival"the median survival time
    "StandardErrorFunction"functional form of standard errors of the fitted function
    "StandardErrors"a list of standard errors for each time point
    "SurvivalDistribution"the DataDistribution object used in the fitting
  • Confidence intervals about the fitted function are given as a list of paired values {{h1,min,h1,max},} corresponding to each time point given by model["EstimationPoints"].
  • Confidence bands are given as pure functions that are equivalent to confidence intervals when evaluated at all time points in model["EstimationPoints"].
  • Properties related to confidence intervals and bands include:
  • "PointwiseBands"pointwise confidence bands
    "PointwiseIntervals"pointwise confidence intervals
    "EqualPrecisionBands"simultaneous confidence bands
    "EqualPrecisionIntervals"simultaneous confidence intervals
    "HallWellnerBands"simultaneous HallWellner confidence bands
    "HallWellnerIntervals"simultaneous HallWellner confidence intervals
  • Properties related to the event data:
  • "EstimationPoints"time points used in the estimation
    "EventData"EventData object used in the estimation
    "EventMatrix"matrix indicating possible event locations
    "EventMatrixPlot"a custom matrix plot of the event matrix
    "TruncationMatrix"matrix indicating where units are observable
    "TruncationMatrixPlot"a custom matrix plot of the truncation matrix
  • Properties related to counts of different types of observations:
  • "AtRisk"number of individuals at risk at each time point
    "EventCounts"number of events for each time point
    "LeftCensoringCounts"number of left-censored events for each time point
    "ObservationCount"effective number of experimental units
    "RightCensoringCounts"number of right-censored events for each time point
  • SurvivalModelFit takes the following options:
  • ConfidenceLevel 95/100level to use for intervals and bands
    ConfidenceRange Allrange for simultaneous confidence bands
    ConfidenceTransform "LogLog"confidence transform to use
    Method Automaticmethod to use for model fitting
  • With ConfidenceLevel->p, probability-p confidence intervals and bands are computed for the various functional forms.
  • ConfidenceRange->{tmin,tmax} gives probability-p simultaneous confidence intervals and bands for the fitted function between tmin and tmax.
  • Possible settings for ConfidenceTransform include "Linear", "LogLog", "ArcSinSqrt", "Log", "Logit", or a pure function g.
  • SurvivalModelFit automatically chooses the method most appropriate to the data. The KaplanMeier estimator is used for right-censored data. For other types of censoring, the estimate is constructed using a self-consistency approach. Different methods may only support some types of censoring or truncation.
  • The setting Method->estimator specifies an estimator to use for distribution functions. Possible settings include:
  • "KaplanMeier"product limit estimator for right-censored data
    "NelsonAalen"based on the NelsonAalen cumulative hazard estimator
    "Turnbull"Turnbull algorithm for interval-censored data
    "Noncensored"censoring is ignored and interval midpoints are used
    "SelfConsistency"Turnbull algorithm for doubly censored data
  • Additional method settings can be found in the Options section of Examples. »


open allclose all

Basic Examples  (1)

Fit a survival model to some right-censored data:

Evaluate the model at a point:

Obtain a functional representation of the model:

Visualize a 95% pointwise confidence region about the survival function:

Scope  (29)

Basic Uses  (4)

Fit a survival model to some data:

The functional form of the fitted function:

The fitted function evaluated at 24:

Tabulate the fitted function:

Plot the estimated CDF of the model:

The CDF:

Obtain a list of available model properties:

Model Properties  (16)

Pointwise confidence intervals:

The 95% pointwise confidence intervals about the survival function at each time point:

Equal-precision intervals:

The 95% equal-precision intervals about the survival function at each time point:

HallWellner intervals:

The 95% HallWellner intervals about the survival function at each time point:

Pointwise confidence bands:

The 95% pointwise confidence bands about the survival function:

Confidence intervals are confidence bands evaluated at each time point:

Equal-precision bands:

The 95% equal-precision bands about the survival function:

Equal-precision intervals are equal-precision bands evaluated at each time point:

HallWellner bands:

The 95% HallWellner bands about the survival function:

Equal-precision intervals are equal-precision bands evaluated at each time point:

Standard errors for the fitted function:

Standard errors for the survival function at each time point:

Standard errors are the standard error function evaluated at each time point:

Tabulate a summary of the estimated SurvivalFunction:

Entries from the table:

Create event tables over custom time ranges:

An event table for times between 25 and 30:

An event table with event history data for times between 25 and 35 in steps of 5:

Entries from the table:

Some event history properties:

The number of events occurring at each time point:

Right-censored event counts:

Left-censored event counts:

Use the "EventMatrix" to show where events could have occurred:

Each row represents a distinct event type:

The maximum value in each row is the number of each event type present in the data:

Columns correspond to the following time points:

Use the "TruncationMatrix" to show where units were observable:

Each row represents a distinct event type:

Columns correspond to the following time points:

Visualize the "EventMatrix":

Visualize the "TruncationMatrix":

Obtain several model properties simultaneously:

A table of event history properties:

Extract properties for the estimated cumulative hazard function of the model:

An event table for the CHF:

Data Types  (9)

Censoring  (7)

Uncensored data can be represented on intervals (no censoring):

The survival functions are equivalent:

Estimate the distribution with right-censored data (right censoring):

The jump at 16 has been removed and the survival function has been rescaled beyond 16:

A single left-censored observation (left censoring):

The jump at 16 is removed and the probability is redistributed over the estimate:

Observations can be censored on an interval (interval censoring):

The third observation occurred somewhere on the interval :

Any combination of left- and right-censored observations is possible (double censoring):

The second observation is left censored and the fourth is right censored:

Any type of censoring can be present in the data simultaneously (mixed censoring):

The second, third, and fourth observations are left, interval, and right censored, respectively:

Use EventData with status indicators to indicate censored observations:

Create distributions for the different censoring schemes:

The survival functions:

Truncation  (2)

Use EventData to specify truncated observations:

The survival functions:

EventData can be used to mix censoring and truncation:

The survival function for some left-truncated and right-censored data:

Options  (10)

ConfidenceLevel  (3)

Set the confidence level used for computing confidence intervals and bands:

A set of 90% intervals corresponding to the time points in the model:

The confidence level can also be set after the model has been fitted:

By default the confidence level is set to 95/100:

Compute confidence intervals for the survival probability at a point:

Confidence intervals about the survival function at 16 for a range of confidence levels:

ConfidenceRange  (1)

Set the confidence range for simultaneous intervals and bands:

The bands are only defined over the confidence range:

By default the range is set to All:

Set the range to Full:

ConfidenceTransform  (3)

Apply transformations to confidence intervals and bands:

A collection of named transforms:

"LogLog" bands and intervals are used by default:

Transformations can ensure that intervals and bands are appropriately bounded:

Notice that the upper 95% limit is larger than 1.0 for some event times:

Using a "LogLog" transform corrects this issue:

Define custom transformations:

Explicit definitions for the various named transforms:

Verify that the definitions are equivalent to the named transforms:

Method  (3)

Here a single interval-censored observation causes the default estimator to be slow:

The KaplanMeier estimator is fast by comparison:

Since the proportion of interval-censored observations is low, little information is lost:

If the last observation is censored, the survival will be Indeterminate beyond that point:

The "TailModel" suboption can control this behavior:

Provide a particular distribution for the tail:

The suboption "StandardErrorMethod" can be used to control standard error computation:

The setting Automatic attempts to compute standard errors by plugin methods:

Standard errors can also be computed using bootstrapping:

Various suboptions can provide finer control over the bootstrap procedure:

Applications  (8)

A group of 26 psychiatric patients were followed until their deaths or the end of the study. Lifetimes of those patients alive at the end of the study are right censored. Compare nonparametric and parametric models for the survival of the patients:

The KaplanMeier estimate with 95% pointwise confidence bands and the GompertzMakeham model:

The estimated median survival for the two models is similar:

The following data consists of continuous running times (in hours) for 70 generator fans. Of interest is the average number of failures expected for various running times, given a minimal repair policy. Some fans did not fail over the observed period and are right censored:

A plot of the NelsonAalen estimate of the cumulative hazard function:

A tabular summary of the cumulative hazard function:

On average, about 0.337 failures are expected for 87,500 hours of operation:

Leukemia patients in remission were treated with 6-mercaptopurine or placebo in a clinical trial. Compare the survival of the two groups:

Fit the models:

The treatment group is heavily right censored, whereas the control group had no censoring:

Clearly, the treatment group survives longer than the control group:

The LogRankTest with TaroneWare weights agrees with the previous findings:

191 high school boys were asked at what age they first tried marijuana. Possible responses include, "I tried marijuana for the first time at age ", "I have never tried marijuana", or "I don't remember the age at which I first tried marijuana":

A summary of the survivor function:

Distribution functions with 95% confidence intervals at each event time:

With 90% confidence, the probability a boy will be older than 14 when he first tries marijuana:

A group of 38 individuals with acute lymphoblastic leukemia were given bone marrow transplants. Patients were followed until death, relapse, or the end of the study. The following data can be interpreted as disease-free survival times:

Define simultaneous bands over the interval 100 to 600 days:

A comparison of simultaneous and pointwise bands about the disease-free survival probability:

A hypothesis test for disease-free survival probabilities:

The probability of surviving, disease free, beyond 400 days:

At 400 days, the disease-free survival probability is not significantly different from 1/2:

Researchers interested in the sleeping habits of baboons recorded the elapsed time at which half of the baboon troop descended from their trees after sleeping. On some days, the observers arrived early enough to observe this time exactly. At other times they arrived after this median descent time, so the day's observation was left censored:

A 95% HallWellner survival confidence envelope over the interval 7 to 9 hours:

The probability that the median descent time falls in the interval 7 to 9 hours:

The median and mean descent times:

Patients with renal insufficiency were followed to the time to first catheter exit site infection. Each patient had one of two types of catheter placement (surgical or percutaneous). Of interest is which catheter placement is preferable to prevent infection:

It appears that in the long term, percutaneous placement prolongs time to infection:

Compare the nonparametric models to parametric Weibull models:

A group of 30 diabetic subjects were recruited at a clinic and followed until death or the end of the study. The subject's age at entry and age at the end of the study or death were recorded. Using this hypothetical data, compare the conditional survival of 60- and 65-year-old diabetics to the survival of diabetics, ignoring left-truncation:

An unconditional model:

Condition on surviving to at least 60 and 65 years of age:

Compare the survival curves:

The probability a 60-year-old diabetic survives beyond 70:

A 90% confidence interval about the probability that a 65-year-old diabetic survives beyond 70:

Properties & Relations  (7)

The KaplanMeier estimator is used by default for right-censored data:

The KaplanMeier product-limit estimator for right-censored data:

The NelsonAalen estimator is based on the cumulative hazard function:

The NelsonAalen estimator for right-censored data:

Transform to the survival function:

The width of confidence intervals increases with confidence level:

Confidence interval widths for three different event times over a range of confidence levels:

Confidence bands and intervals are specific to the form of the fitted function:

Truncation is considered when counting distinct events:

Use CoxModelFit to estimate survival probabilities in the presence of covariates:

Estimated parameters:

Test the overall significance of the model:

Plot survival estimates for the levels of with :

Use LogRankTest to compare hazard rates for multiple groups:

Visually compare survival estimates:

Compare hazard rates using LogRankTest:

Wolfram Research (2012), SurvivalModelFit, Wolfram Language function,


Wolfram Research (2012), SurvivalModelFit, Wolfram Language function,


Wolfram Language. 2012. "SurvivalModelFit." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2012). SurvivalModelFit. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_survivalmodelfit, author="Wolfram Research", title="{SurvivalModelFit}", year="2012", howpublished="\url{}", note=[Accessed: 24-May-2024 ]}


@online{reference.wolfram_2024_survivalmodelfit, organization={Wolfram Research}, title={SurvivalModelFit}, year={2012}, url={}, note=[Accessed: 24-May-2024 ]}