def cumulinc_at_times(cph, dfcox, at_times):
    """Generic way to compute the cumulative incidence at given time points"""
    surv_prob = cph.predict_survival_function(
        dfcox,
        times=at_times
    )
    cumulative_incidence = 1 - surv_prob

    # Compute the mean cumulative incidence for each age
    cumulative_incidence = cumulative_incidence.mean(axis="columns")

    df_out = cumulative_incidence.reset_index(name="cumulinc")
    df_out = df_out.rename(columns={"index": "age"})
    return df_out