sksurv.compare.compare_survival¶

sksurv.compare.compare_survival(y, group_indicator, return_stats=False)

K-sample log-rank hypothesis test of identical survival functions.

Compares the pooled hazard rate with each group-specific hazard rate. The alternative hypothesis is that the hazard rate of at least one group differs from the others at some time.

See [1] for more details.

Parameters: y (structured array, shape = (n_samples,)) – A structured array containing the binary event indicator as first field, and time of event or time of censoring as second field. group_indicator (array-like, shape = (n_samples,)) – Group membership of each sample. return_stats (bool, optional, default: False) – Whether to return a data frame with statistics for each group and the covariance matrix of the test statistic. chisq (float) – Test statistic. pvalue (float) – Two-sided p-value with respect to the null hypothesis that the hazard rates across all groups are equal. stats (pandas.DataFrame) – Summary statistics for each group: number of samples, observed number of events, expected number of events, and test statistic. Only provided if return_stats is True. covariance (array, shape=(n_groups, n_groups)) – Covariance matrix of the test statistic. Only provided if return_stats is True.

References

 [1] Fleming, T. R. and Harrington, D. P. A Class of Hypothesis Tests for One and Two Samples of Censored Survival Data. Communications In Statistics 10 (1981): 763-794.