How to use pymc3 for survival analysis?

The example I see in the documentation is COX regression

I want to estimate the survival function,like this:

1 Like

There is a session in


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:


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.


1 Like

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

1 Like