({{, (RefLink[EventData, paclet:ref/EventData])[{(Subscript[e, 1]),(Subscript[e, 2]),…}] 
represents event data with explicitly specified censoring (Subscript[e, i]).}, {, (RefLink[EventData, paclet:ref/EventData])[{(Subscript[e, 1]),(Subscript[e, 2]),…},{(Subscript[ci, 1]),(Subscript[ci, 2]),…}]
represents event data (Subscript[e, i]) with censoring indicators (Subscript[ci, i]).}, {, (RefLink[EventData, paclet:ref/EventData])[{(Subscript[e, 1]),(Subscript[e, 2]),…},{(Subscript[cc, 1]),(Subscript[cc, 2]),…}]
represents event data (Subscript[e, i]) with censoring counts (Subscript[cc, i]).}, {, (RefLink[EventData, paclet:ref/EventData])[{(Subscript[e, 1]),(Subscript[e, 2]),…},cspec,{(Subscript[tr, 1]),(Subscript[tr, 2]),…}]
represents event data with censoring and truncation (Subscript[tr, i]). }})

OpenersNotesSection(Spacer1)Details

(RefLink[EventData, paclet:ref/EventData]) augments data with censoring and truncation information.

The following event specifications can be used for (Subscript[e, i]):

The following censoring indicators can be used for (Subscript[ci, i]):

The following count specifications can be used for (Subscript[cc, i]):

The following event specifications can be used for (Subscript[tr, i]):

(RefLink[EventData, paclet:ref/EventData]) can be used in statistics functions including:

Properties of (RefLink[EventData, paclet:ref/EventData]) can be obtained by specifying (RefLink[EventData, paclet:ref/EventData])[…]["property"].

A list of available properties can be obtained using (RefLink[EventData, paclet:ref/EventData])[…]["Properties"].

(RefLink[EventData, paclet:ref/EventData]) has the following properties:

OpenersPrimaryExamplesSection(Spacer1)Examples  (15)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Indicate right-censored data values:

e={1.0,2.1,3.2,4.5,5.7};
ci={0,0,0,1,0};

𝒜=EventData[e,ci]

Compute some descriptive statistics:

Median[𝒜]

InterquartileRange[𝒜]

OpenersExampleSection1(Spacer1)Scope  (12)

OpenersExampleSubsection0(Spacer1)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}}]//Grid

Fit 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 (RefLink[SurvivalModelFit, paclet:ref/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 (RefLink[CoxModelFit, paclet:ref/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}]

Parameter estimates:

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]

OpenersExampleSubsection1(Spacer1)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}}]

Left censoring:

𝒜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}}]

Interval censoring:

𝒜=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}}]

Specify left truncation:

𝒜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}}]

Specify right truncation:

𝒜=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"]}

OpenersExampleSection3(Spacer1)Applications  (1)

Mark right censoring on a plot of an estimated survival function:

𝒜=EventData[];

The estimated survival function:

sf[t_]:= SurvivalModelFit[𝒜][t]

Create the censoring markers:

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]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

Descriptive statistics are based on the underlying (RefLink[SurvivalDistribution, paclet:ref/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[𝒟]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[WeightedData, paclet:ref/WeightedData])  ▪  (RefLink[SurvivalModelFit, paclet:ref/SurvivalModelFit])  ▪  (RefLink[CoxModelFit, paclet:ref/CoxModelFit])  ▪  (RefLink[LogRankTest, paclet:ref/LogRankTest])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Probability & Statistics, paclet:guide/ProbabilityAndStatistics])}, {▪(RefLinkPlain[Survival Analysis, paclet:guide/SurvivalAnalysis])}, {▪(RefLinkPlain[Reliability, paclet:guide/Reliability])}, {▪(RefLinkPlain[Scientific Data Analysis, paclet:guide/ScientificDataAnalysis])}, {▪(RefLinkPlain[Descriptive Statistics, paclet:guide/DescriptiveStatistics])}, {▪(RefLinkPlain[Life Sciences & Medicine: Data & Computation, paclet:guide/LifeSciencesAndMedicineDataAndComputation])}})}})