Compute Statistics from Censored and Truncated Data
Compute Statistics from Censored and Truncated Data
Create EventData representing censored event times:
𝒟 = EventData[{10, 7, 32, 23, 22, 6, 16, 34, 32, 25, 11, 20, 19, 6, 17, 35, 6, 13, 9, 6, 10}, {0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1}];SurvivalModelFit[𝒟]["EventMatrixPlot"]Median[𝒟]Probability[t < 20t ≥ 10, t𝒟]Some descriptive statistics computed directly from the same EventData:
fgrid[list_, {col1_, col2_}] := TraditionalForm@Grid[list, Dividers -> All, Spacings -> {{1, 1}, 4}, Alignment -> {Left, Center, {{1, 1} -> {Center}, {1, 2} -> {Center}}}, BaseStyle -> {FontFamily -> "Verdana"}, Background -> {None, {Lighter[Blend[{col1, col2}], .35], {Lighter[Blend[{col1, col2}], .7], GrayLevel[.8]}}},
FrameStyle -> Directive[Thick, White]]fgrid[Join[{{Style["Property", Bold], Style["Value", Bold]}}, Table[{Quiet[i[[1]][If[i[[2]] =!= {}, Sequence@@{"𝒟", i[[2]]}, "𝒟"]]], i[[1]][If[i[[2]] =!= {}, Sequence@@{𝒟, i[[2]]}, 𝒟]]//FullSimplify}, {i, {{Median, {}}, {Mean, {}}, {Variance, {}}, {StandardDeviation, {}}, {Skewness, {}}, {Kurtosis, {}}, {Quantile, .25}, {Quantile, .75}}}]], {Blue, Black}]