statsmodels.duration.survfunc.survdiff#

statsmodels.duration.survfunc.survdiff(time, status, group, weight_type=None, strata=None, entry=None, **kwargs)[source]#

Test for the equality of two survival distributions

Parameters:
timearray_like

The event or censoring times.

statusarray_like

The censoring status variable, status=1 indicates that the event occurred, status=0 indicates that the observation was censored.

grouparray_like

Indicators of the two groups

weight_typestr, optional

The following weight types are implemented:

  • None (default) : logrank test

  • “fh” : Fleming-Harrington, weights by S^(fh_p), requires exponent fh_p to be provided as keyword argument; the weights are derived from S defined at the previous event time, and the first weight is always 1.

  • gb : Gehan-Breslow, weights by the number at risk

  • tw : Tarone-Ware, weights by the square root of the number at risk

strataarray_like, optional

Optional stratum indicators for a stratified test

entryarray_like, optional

Entry times to handle left truncation. The subject is not in the risk set on or before the entry time.

Returns:
chisqfloat

The chi-square (1 degree of freedom) distributed test statistic value

pvaluefloat

The p-value for the chi^2 test