'Estimate the baseline cumulative hazard and survival
functions.
Parameters
params : ndarray
The model parameters.
Returns
A list of triples (time, hazard, survival) containing the time
values and corresponding cumulative hazard and survival
function values for each stratum.
Notes
Uses the Nelson-Aalen estimator.'

def baseline_cumulative_hazard(self, params):

    surv = self.surv
    rslt = []
    for stx in range(surv.nstrat):
        uft = surv.ufailt[stx]
        uft_ix = surv.ufailt_ix[stx]
        exog_s = surv.exog_s[stx]
        nuft = len(uft_ix)
        linpred = np.dot(exog_s, params)
        if (surv.offset_s is not None):
            linpred += surv.offset_s[stx]
        e_linpred = np.exp(linpred)
        xp0 = 0.0
        h0 = np.zeros(nuft, dtype=np.float64)
        for i in range(nuft)[::(-1)]:
            ix = surv.risk_enter[stx][i]
            xp0 += e_linpred[ix].sum()
            ix = uft_ix[i]
            h0[i] = (len(ix) / xp0)
            ix = surv.risk_exit[stx][i]
            xp0 -= e_linpred[ix].sum()
        cumhaz = (np.cumsum(h0) - h0)
        current_strata_surv = np.exp((- cumhaz))
        rslt.append([uft, cumhaz, current_strata_surv])
    return rslt
