Learn PyINLA

Exponential Distribution

The exponential distribution is a continuous probability distribution often used to model the time between independent events that occur at a constant average rate. It is characterized by its memoryless property, meaning the probability of an event occurring in the future is independent of the past. This distribution is widely utilized in reliability analysis and queuing theory.

← Back to Likelihoods

pyINLA exposes two exponential families: exponential for plain regression on positive responses and exponentialsurv for survival models with censoring. Both share the same parameterization. exponential has no hyperparameters; exponentialsurv additionally exposes up to 10 cure-model regression coefficients (beta1, ..., beta10) which are only active when a cure structure is configured. The two families differ in the response object they expect and the link functions they accept.

Parametrization

The probability density function (PDF) for the exponential distribution, considering \(\pmb{y}\) as a vector of responses, is given by:

\[f(y_i \mid \lambda_i) = \lambda_i \exp(-\lambda_i y_i), \quad y_i > 0, \; \lambda_i > 0, \; i = 1, 2, \dots, n,\]

where:

  • \(\pmb{y} = (y_1, y_2, \ldots, y_n)\) represents the observed response times.

  • \(\pmb{\lambda} = (\lambda_1, \lambda_2, \ldots, \lambda_n)\) represents the rate parameters for each observation.

In survival analysis, models are often specified through the hazard function. For the exponential model, the baseline hazard is constant over time, and the hazard function is:

\[h(y_i) = \lambda_i, \quad i = 1, 2, \ldots, n.\]

Assume \(n\) = 1. To demonstrate the shape of the Exponential distribution for various rate parameters \(\lambda\), Figure 1 displays several Exponential PDFs.

Exponential PDFs for different rate parameters \(\lambda\). As \(\lambda\) increases, the distribution places more mass near \(y=0\). For smaller \(\lambda\), the distribution decays more slowly.

The rate parameter \(\lambda_i\) is linked to the linear predictor \(\eta_i\) using the default log link:

\[\lambda_i = \exp(\eta_i), \quad i = 1, 2, \ldots, n.\]

Available link functions depend on the model variant:

  • Regression (exponential): default, log
  • Survival (exponentialsurv): default, log, neglog

The neglog link, available in survival models, corresponds to the accelerated failure time (AFT) parameterization:

\[\lambda_i = \exp(-\eta_i),\]

where positive coefficients increase expected survival times.

Hyperparameters

The exponential likelihood has no hyperparameters: the rate parameter \(\lambda\) is fully determined by the linear predictor \(\eta\) through the link function. Supplying control['family']['hyper'] raises pyinla safety check: control['family']['hyper'] is only allowed for ....

The exponentialsurv likelihood additionally exposes up to 10 cure-model regression coefficients (beta1, ..., beta10; positional aliases theta1, ..., theta10). These default to \(\text{Normal}(-1, 100)\) on beta1 (initial \(-4\)) and \(\text{Normal}(0, 100)\) on the rest, and are only active when a cure structure is configured via R-INLA's cure control block. Most survival users do not need to override these.

Validation Rules

pyINLA enforces several validation rules for Exponential models to ensure correct specification:

No Hyper Configuration (regression form)

Plain exponential has no hyperparameters: providing control['family']['hyper'] raises PyINLAError. The exponentialsurv form does accept hyper entries for its cure-model betas (see Hyperparameters above), but most users leave the defaults in place.

Not Allowed Arguments

The following arguments are not allowed for exponential likelihoods and will raise PyINLAError:

  • E (exposure) - Only allowed for poisson/nbinomial

  • scale - Only allowed for gaussian/nbinomial/xbinomial/gamma/beta/logistic/t

  • Ntrials - Only allowed for binomial/xbinomial/betabinomial/nbinomial2

  • control['family']['variant'] - Not supported for exponential or exponentialsurv

Allowed Link Functions

Key: control['family']['link']

For exponential:

  • default

  • log

For exponentialsurv:

  • default

  • log

  • neglog

Response Values

For exponential, the response variable \(\pmb{y}\) must be strictly positive (\(y_i > 0\)). pyINLA raises PyINLAError if any response value is zero or negative.

Survival Response

When using exponentialsurv, the response must be created using inla_surv():

from pyinla import inla_surv

# Create survival response (event=1 observed, event=0 right-censored)
y_surv = inla_surv(time=df["time"], event=df["event"])
result = pyinla(model={'response': y_surv, 'fixed': ['1', 'x']},
                family="exponentialsurv", data=df)

inla_surv supports the following censoring types:

  • Right censoring: the event has not occurred by the end of observation; only a lower bound on the survival time is known.
  • Left censoring: the event occurred before observation began; only an upper bound is known.
  • Interval censoring: the event is known to have occurred within a known time interval.

Specification

  • family="exponential" for regression models
  • family="exponentialsurv" for survival models
  • Required arguments:
    • For exponential: \(\pmb{y}\) (response vector of strictly positive values)
    • For exponentialsurv: \(\pmb{y}\) provided via inla_surv(time, event)

Model Comparison

FormFamilyResponseLinks
Regressionexponentialplain y (strictly positive)default, log
Survivalexponentialsurvinla_surv(time, event)default, log, neglog