Estimate Distribution Parameters from Survival Data
Estimate Distribution Parameters from Survival Data
Use maximum likelihood methods with EstimatedDistribution to obtain the best-fitting WeibullDistribution for some censored data and compare it to the Kaplan–Meier estimate.
x = 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}];Fit a WeibullDistribution to the censored data:
dist = EstimatedDistribution[x, WeibullDistribution[α, β]]model = SurvivalModelFit[x]Labeled[Plot[{model[t], SurvivalFunction[dist, t]}, {t, 0, 50}, Exclusions -> None, PlotStyle -> {{Thick, Darker@Blue}, {Thick, Darker@Red}}, Filling -> Axis, ImageSize -> 450, GridLines -> Automatic, GridLinesStyle -> Directive[Dotted], AxesOrigin -> {0, 0}, PlotPoints -> 250, PlotLegends -> Placed[Style[#, Bold, FontFamily -> "Helvetica"]& /@ {"Kaplan-Meier", "WeibullDistribution"}, Below]], Column[{Style["Survivor Curve Estimates", Bold, FontFamily -> "Helvetica", FontSize -> 18], Style["Parametric and Nonparametric", Bold, FontColor -> Gray, FontFamily -> "Helvetica", FontSize -> 14]}], {{Top, Left}}]