EventData[{e1,e2,…}]
represents event data with explicitly specified censoring ei.
EventData[{e1,e2,…},{ci1,ci2,…}]
represents event data ei with censoring indicators cii.
EventData[{e1,e2,…},{cc1,cc2,…}]
represents event data ei with censoring counts cci.
EventData[{e1,e2,…},cspec,{tr1,tr2,…}]
represents event data with censoring and truncation tri.
EventData
EventData[{e1,e2,…}]
represents event data with explicitly specified censoring ei.
EventData[{e1,e2,…},{ci1,ci2,…}]
represents event data ei with censoring indicators cii.
EventData[{e1,e2,…},{cc1,cc2,…}]
represents event data ei with censoring counts cci.
EventData[{e1,e2,…},cspec,{tr1,tr2,…}]
represents event data with censoring and truncation tri.
Details
- EventData augments data with censoring and truncation information.
- The following event specifications can be used for ei:
-
ti no censoring; event happens at tti {ti,∞} right censoring; event happens at some t where ti≤t {-∞,ti} left censoring; event happens at some t where t<ti {ti,min,ti,max} interval censoring; event happens at some t where ti,min<t≤ti,max - The following censoring indicators can be used for cii:
-
0, None {t,t} no censoring 1, Right {t,∞} right censoring -1,Left {-∞,t} left censoring - The following count specifications can be used for cci:
-
{ ni} ni events at ei {ni,ri} ni events and ri right-censored events at ei {ni,ri,li} ni events, ri right-censored events, and li left-censored events at ei - The following event specifications can be used for tri:
-
ti,{ti,∞} left truncation; observable for 
{-∞,ti} right truncation; observable for 
{ti,min,ti,max} interval truncation; observable over ti,min≤t≤ti,max - EventData can be used in statistics functions including:
-
Mean,Variance,… descriptive statistics functions EmpiricalDistribution,… nonparametric distribution estimation EstimatedDistribution,… parametric distribution estimation SurvivalModelFit,… functions for survival analysis - Properties of EventData can be obtained by specifying EventData[…]["property"].
- A list of available properties can be obtained using EventData[…]["Properties"].
- EventData has the following properties:
-
"CensoringIndicators" censoring indicators {ci1,…} "CensoredData" censored event intervals in the form {{t1,∞},…} "EmpiricalPDF" event locations and corresponding estimated weights "InputData" input event specification {e1,…} "MetaInformation" list of meta information rules "TruncationIntervals" truncation intervals {tr1,…} "CensoringType" most general type of censoring present "TruncationType" most general type of truncation present
Examples
open all close allBasic Examples (1)
Scope (12)
Basic Uses (5)
Compute descriptive statistics for event data:
t = {8, 3, 5, 4, 9, 0, 4, 2, 2, 3};
c = {1, 0, 0, 0, 0, 0, 1, 1, 0, 0};𝒜 = EventData[t, c]Table[{i, i[𝒜]}, {i, {Mean, Median, Variance, StandardDeviation, Kurtosis, Skewness, InterquartileRange}}]//GridFit nonparametric distributions to event data:
data = RandomVariate[WeibullDistribution[3, 4], 50];
t = Table[If[i > 4, 4, i], {i, data}];
c = Table[Boole[i == 4], {i, t}];𝒜 = EventData[t, c]dists = Table[𝒟[𝒜], {𝒟, {EmpiricalDistribution, HistogramDistribution, SmoothKernelDistribution}}];Table[Plot[SurvivalFunction[i, x], {x, 0, 5}, PlotLabel -> Row[{"Median: ", Median[i]}], PlotRange -> {0, 1}], {i, dists}]Fit parametric distributions to event data:
data = BlockRandom[SeedRandom[10];RandomVariate[WeibullDistribution[3, 4], 50]];
t = Table[If[i > 4, 4, i], {i, data}];
c = Table[Boole[i == 4], {i, t}];𝒜 = EventData[t, c]𝒟1 = EstimatedDistribution[𝒜, WeibullDistribution[a, b]]Plot the distribution and the empirical estimate:
𝒟2 = EmpiricalDistribution[𝒜];Plot[{SurvivalFunction[𝒟1, x], SurvivalFunction[𝒟2, x]}, {x, 0, 5}]Fit a model using SurvivalModelFit:
t = {7, 23, 22, 6, 25, 20, 19, 6, 17, 6, 13};
c = {0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0};e = EventData[t, c]𝒮 = SurvivalModelFit[e];Empirical survival function with confidence bands:
Plot[{𝒮[x], 𝒮["PointwiseBands"][x]}, {x, 5, 30}]Fit a model with covariates using CoxModelFit:
y = EventData[{8, 22, 6, 4, 12, 11, 2, 34, 25, 15, 8, 6, 34, 6, 32, 1, 15, 9, 9, 6}, {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0}]x = {1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0};phMod = CoxModelFit[{x, y}, {g}, {g}]phMod["ParameterTable"]A comparison of the survival rates for the two groups:
Plot[Evaluate@Table[phMod["SF"][i][t], {i, {{0}, {1}}}], {t, 0, 35}, PlotPoints -> 75]Specifying Censoring and Truncation (7)
Specify right censoring in a number of ways:
𝒜1 = EventData[{2, 3, {4, ∞}, 5}];
𝒜2 = EventData[{2, 3, 4, 5}, {0, 0, 1, 0}];
𝒜3 = EventData[{2, 3, 4, 5}, {None, None, Right, None}];
𝒜4 = EventData[{2, 3, 4, 5}, {{1}, {1}, {0, 1}, {1}}];The objects all represent the same four observations where the third is right censored:
SurvivalModelFit[𝒜1]["EventMatrixPlot"]Equal@@Table[CDF[EmpiricalDistribution[𝒜], x], {𝒜, {𝒜1, 𝒜2, 𝒜3, 𝒜4}}]𝒜1 = EventData[{2, 3, {-∞, 4}, 5}];
𝒜2 = EventData[{2, 3, 4, 5}, {0, 0, -1, 0}];
𝒜3 = EventData[{2, 3, 4, 5}, {None, None, Left, None}];
𝒜4 = EventData[{2, 3, 4, 5}, {{1}, {1}, {0, 0, 1}, {1}}];The objects all represent the same four observations where the third is left censored:
SurvivalModelFit[𝒜1]["EventMatrixPlot"]Equal@@Table[CDF[EmpiricalDistribution[𝒜], x], {𝒜, {𝒜1, 𝒜2, 𝒜3, 𝒜4}}]𝒜 = EventData[{2, 3, {2, 4}, 5}];The object represents four observations where the third is interval censored:
SurvivalModelFit[𝒜]["EventMatrixPlot"]Use the count specifications to indicate multiple equivalent observations:
𝒜1 = EventData[{2, 3, 3, 3, 4, {4, ∞}, {4, ∞}, {-∞, 4}, 5}];
𝒜2 = EventData[{2, 3, 4, 5}, {{1}, {3}, {1, 2, 1}, {1}}];The objects each represent the same nine observations:
SurvivalModelFit[𝒜1]["EventMatrixPlot"]Equal@@Table[CDF[EmpiricalDistribution[𝒜], x], {𝒜, {𝒜1, 𝒜2}}]𝒜1 = EventData[{5, 6, 7, 8}, None, {{4, ∞}, {5, ∞}, {6, ∞}, {7, ∞}}];
𝒜2 = EventData[{5, 6, 7, 8}, None, {4, 5, 6, 7}];The objects are equivalent representations of left-truncated, non-censored data:
{SurvivalModelFit[𝒜1]["EventMatrixPlot"], SurvivalModelFit[𝒜1]["TruncationMatrixPlot"]}Equal@@Table[CDF[EmpiricalDistribution[𝒜], x], {𝒜, {𝒜1, 𝒜2}}]𝒜 = EventData[{5, 6, 7, 8}, None, {{-∞, 6}, {-∞, 7}, {-∞, 8}, {-∞, 9}}];The object represents right-truncated, non-censored data:
{SurvivalModelFit[𝒜]["EventMatrixPlot"], SurvivalModelFit[𝒜]["TruncationMatrixPlot"]}Data can be both censored and truncated:
𝒜 = EventData[{2, 3, 4, 5}, {0, 0, 1, 0}, {1, 2, 3, 4}];The object represents right-censored, left-truncated data:
{SurvivalModelFit[𝒜]["EventMatrixPlot"], SurvivalModelFit[𝒜]["TruncationMatrixPlot"]}Applications (1)
Mark right censoring on a plot of an estimated survival function:
𝒜 = EventData[Automatic, {{7, 23, 22, 6, 25, 20, 19, 6, 17, 6, 13}, {0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0},
None}];The estimated survival function:
sf[t_] := SurvivalModelFit[𝒜][t]rc = Cases[Transpose[{𝒜["CensoredData"], 𝒜["CensoringIndicators"]}], {_, 1}]cns = Graphics[Table[Line[{{i, sf[i] - .05}, {i, sf[i] + .05}}], {i, rc[[All, 1]]}]];Show the censoring markers with the plot of the estimated survival:
Show[Plot[sf[t], {t, 0, 30}, Exclusions -> None, PlotRange -> {0, 1}], cns]Properties & Relations (1)
Descriptive statistics are based on the underlying SurvivalDistribution:
𝒜 = EventData[{8, 22, 6, 4, 12, 11, 2, 34, 25, 15, 8, 6, 34, 6, 32, 1, 15, 9, 9, 6}, {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0}]𝒟 = SurvivalDistribution[𝒜];{{Mean[𝒜], Median[𝒜]}, {Mean[𝒟], Median[𝒟]}}Sample estimates are given when they differ from population estimates:
StandardDeviation[𝒜]StandardDeviation[𝒟]History
Text
Wolfram Research (2012), EventData, Wolfram Language function, https://reference.wolfram.com/language/ref/EventData.html.
CMS
Wolfram Language. 2012. "EventData." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/EventData.html.
APA
Wolfram Language. (2012). EventData. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EventData.html
BibTeX
@misc{reference.wolfram_2026_eventdata, author="Wolfram Research", title="{EventData}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/EventData.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_eventdata, organization={Wolfram Research}, title={EventData}, year={2012}, url={https://reference.wolfram.com/language/ref/EventData.html}, note=[Accessed: 12-June-2026]}