How to use pymc3 for survival analysis?

The example I see in the documentation is COX regression
https://docs.pymc.io/notebooks/survival_analysis.html

I want to estimate the survival function,like this:
https://lifelines.readthedocs.io/en/latest/Survival%20analysis%20with%20lifelines.html

1 Like

There is a session in https://docs.pymc.io/nb_examples/index.html

@junpenglao

with weibull_model:
    y_cens = pm.Potential(
        'y_cens', gumbel_sf(y_std[cens], η[cens_], s)
    )

What role does “Potential” play

It adds the log-likelihood of the observed into the model. For more information see:

and

In that example, the survival function for the gumbel distribution is implemented like this:

def gumbel_sf(y, μ, σ):
    return 1. - tt.exp(-tt.exp(-(y - μ) / σ))

Am I missing something, or doesn’t this need to be log-transformed to get the log-likelihood?

1 Like

I have the same question. I expected this to be the log complementary CDF (LCCDF) of the Gumbel distribution.

I know this is an old thread, but I’m hoping @AustinRochford can provide a resolution.

Thanks.

1 Like

@DanWeitzenfeld is right, i think. sorry for the very very very very very very slow response.

1 Like