comparison lifelines_tool/run_log.txt @ 0:dd49a7040643 draft

Initial commit
author fubar
date Wed, 09 Aug 2023 11:12:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:dd49a7040643
1 ## Lifelines tool starting.
2 Using data header = Index(['Unnamed: 0', 'week', 'arrest', 'fin', 'age', 'race', 'wexp', 'mar',
3 'paro', 'prio'],
4 dtype='object') time column = week status column = arrest
5 ### Lifelines test of Proportional Hazards results with prio, age, race, paro, mar, fin as covariates on test
6 <lifelines.CoxPHFitter: fitted with 432 total observations, 318 right-censored observations>
7 duration col = 'week'
8 event col = 'arrest'
9 baseline estimation = breslow
10 number of observations = 432
11 number of events observed = 114
12 partial log-likelihood = -659.00
13 time fit was run = 2023-08-09 00:18:43 UTC
14
15 ---
16 coef exp(coef) se(coef) coef lower 95% coef upper 95% exp(coef) lower 95% exp(coef) upper 95%
17 covariate
18 prio 0.10 1.10 0.03 0.04 0.15 1.04 1.16
19 age -0.06 0.94 0.02 -0.10 -0.02 0.90 0.98
20 race 0.32 1.38 0.31 -0.28 0.92 0.75 2.52
21 paro -0.09 0.91 0.20 -0.47 0.29 0.62 1.34
22 mar -0.48 0.62 0.38 -1.22 0.25 0.30 1.29
23 fin -0.38 0.68 0.19 -0.75 -0.00 0.47 1.00
24
25 cmp to z p -log2(p)
26 covariate
27 prio 0.00 3.53 <0.005 11.26
28 age 0.00 -2.95 <0.005 8.28
29 race 0.00 1.04 0.30 1.75
30 paro 0.00 -0.46 0.65 0.63
31 mar 0.00 -1.28 0.20 2.32
32 fin 0.00 -1.98 0.05 4.40
33 ---
34 Concordance = 0.63
35 Partial AIC = 1330.00
36 log-likelihood ratio test = 32.77 on 6 df
37 -log2(p) of ll-ratio test = 16.39
38
39
40 Bootstrapping lowess lines. May take a moment...
41
42
43 Bootstrapping lowess lines. May take a moment...
44
45 The ``p_value_threshold`` is set at 0.01. Even under the null hypothesis of no violations, some
46 covariates will be below the threshold by chance. This is compounded when there are many covariates.
47 Similarly, when there are lots of observations, even minor deviances from the proportional hazard
48 assumption will be flagged.
49
50 With that in mind, it's best to use a combination of statistical tests and visual tests to determine
51 the most serious violations. Produce visual plots using ``check_assumptions(..., show_plots=True)``
52 and looking for non-constant lines. See link [A] below for a full example.
53
54 <lifelines.StatisticalResult: proportional_hazard_test>
55 null_distribution = chi squared
56 degrees_of_freedom = 1
57 model = <lifelines.CoxPHFitter: fitted with 432 total observations, 318 right-censored observations>
58 test_name = proportional_hazard_test
59
60 ---
61 test_statistic p -log2(p)
62 age km 6.99 0.01 6.93
63 rank 7.40 0.01 7.26
64 fin km 0.02 0.90 0.15
65 rank 0.01 0.91 0.13
66 mar km 1.64 0.20 2.32
67 rank 1.80 0.18 2.48
68 paro km 0.06 0.81 0.31
69 rank 0.07 0.79 0.34
70 prio km 0.92 0.34 1.57
71 rank 0.88 0.35 1.52
72 race km 1.70 0.19 2.38
73 rank 1.68 0.19 2.36
74
75
76 1. Variable 'age' failed the non-proportional test: p-value is 0.0065.
77
78 Advice 1: the functional form of the variable 'age' might be incorrect. That is, there may be
79 non-linear terms missing. The proportional hazard test used is very sensitive to incorrect
80 functional forms. See documentation in link [D] below on how to specify a functional form.
81
82 Advice 2: try binning the variable 'age' using pd.cut, and then specify it in `strata=['age',
83 ...]` in the call in `.fit`. See documentation in link [B] below.
84
85 Advice 3: try adding an interaction term with your time variable. See documentation in link [C]
86 below.
87
88
89 Bootstrapping lowess lines. May take a moment...
90
91
92 Bootstrapping lowess lines. May take a moment...
93
94
95 Bootstrapping lowess lines. May take a moment...
96
97
98 Bootstrapping lowess lines. May take a moment...
99
100
101 ---
102 [A] https://lifelines.readthedocs.io/en/latest/jupyter_notebooks/Proportional%20hazard%20assumption.html
103 [B] https://lifelines.readthedocs.io/en/latest/jupyter_notebooks/Proportional%20hazard%20assumption.html#Bin-variable-and-stratify-on-it
104 [C] https://lifelines.readthedocs.io/en/latest/jupyter_notebooks/Proportional%20hazard%20assumption.html#Introduce-time-varying-covariates
105 [D] https://lifelines.readthedocs.io/en/latest/jupyter_notebooks/Proportional%20hazard%20assumption.html#Modify-the-functional-form
106 [E] https://lifelines.readthedocs.io/en/latest/jupyter_notebooks/Proportional%20hazard%20assumption.html#Stratification
107