使用考克斯比例风险模型量化相对风险
使用 CoxModelFit 比较50岁喉癌患者不同阶段的存活率.
larynx = ExampleData[{"Statistics", "LarynxCancer"}];
ξ = larynx[[All, {1, 3}]];
e = EventData[larynx[[All, 2]], larynx[[All, 5]]];
cox = CoxModelFit[{ξ, e}, {stage, age}, {stage, age}, NominalVariables -> stage];Labeled[Plot[Evaluate@Table[cox["SF"][{i, 50}][t], {i, 4}], {t, 0, 12}, Exclusions -> None, PlotRange -> {0, 1}, PlotStyle -> Thick, PlotLegends -> Placed[Table[Style[Row[{"Stage ", i}], Bold, FontFamily -> "Helvetica"], {i, 4}], Below], PlotPoints -> 500, ImageSize -> 450, GridLines -> Automatic, GridLinesStyle -> Directive[Gray, Dotted], Frame -> True], Column[{Style["Larynx Cancer Survival by Stage", Bold, FontSize -> 18, FontFamily -> "Helvetica"], Style["Males at Age 50", Bold, FontSize -> 14, FontColor -> Gray, FontFamily -> "Helvetica"]}], {{Top, Left}}]cox["ParameterTable"]