ehrapy.tools.test_kmf_logrank#
- ehrapy.tools.test_kmf_logrank(kmf_A, kmf_B, t_0=-1, weightings=None)[source]#
Calculates the p-value for the logrank test comparing the survival functions of two groups.
See https://lifelines.readthedocs.io/en/latest/lifelines.statistics.html
Measures and reports on whether two intensity processes are different. That is, given two event series, determines whether the data generating processes are statistically different. The test-statistic is chi-squared under the null hypothesis.
- Parameters:
kmf_A (
KaplanMeierFitter
) – The first KaplanMeierFitter object containing the durations and events.kmf_B (
KaplanMeierFitter
) – The second KaplanMeierFitter object containing the durations and events.t_0 (
Optional
[float
]) – The final time period under observation, and subjects who experience the event after this time are set to be censored. Specify -1 to use all time. Defaults to -1.weightings (
Optional
[Literal
['wilcoxon'
,'tarone-ware'
,'peto'
,'fleming-harrington'
]]) – Apply a weighted logrank test: options are “wilcoxon” for Wilcoxon (also known as Breslow), “tarone-ware” for Tarone-Ware, “peto” for Peto test and “fleming-harrington” for Fleming-Harrington test. These are useful for testing for early or late differences in the survival curve. For the Fleming-Harrington test, keyword arguments p and q must also be provided with non-negative values.
- Return type:
StatisticalResult
- Returns:
The p-value for the logrank test comparing the survival functions of the two groups.