← Back to Priors
Likelihood Hyperparameters

Likelihood Hyperpriors

Configure priors for likelihood hyperparameters such as precision, overdispersion, and shape parameters via control['family']['hyper'].

Overview

Many likelihood families have hyperparameters that control dispersion, precision, or shape. These are configured via control['family']['hyper'] as a list of dictionaries, one per hyperparameter the user wants to override.

Routing: Each hyperparameter has a slot tag (e.g., prec, phi, rho) that identifies it. Entries are routed to the schema by their id field (case-insensitive, matching the slot's short_name). Position-based routing is not supported. The id may be omitted only when the family has exactly one hyperparameter; for families with two or more hypers, every entry must specify id.

General Syntax

control = {
    'family': {
        'hyper': [
            {
                'id': 'prec',             # slot tag (required for multi-hyper families)
                'prior': 'loggamma',      # prior distribution name
                'param': [1.0, 0.01],     # prior parameters
                'initial': 4.0,           # starting value for theta
                'fixed': False            # whether to estimate (False) or fix (True)
            }
        ]
    }
}
result = pyinla(model=model, data=df, family='gaussian', control=control)

Each entry uses exactly five keys: id, prior, param, initial, fixed. Any other key triggers a pyinla safety check: unsupported keys error. Omitted keys fall back to the schema default. A pinned entry (fixed: True) may omit prior and param.

Quick Reference Table

Family Key Parameter Internal Scale Default Prior Default Params
gaussianprecPrecision τθ = log(τ)loggamma[1, 5e-5]
gaussianprecoffsetPrecision offsetθ = log(κ)none (fixed)[]
gammaprecPrecision φθ = log(φ)loggamma[1, 0.01]
betaphiPrecision φθ = log(φ)loggamma[1, 0.1]
betabinomialrhoOverdispersion ρθ = logit(ρ)gaussian[0, 0.4]
nbinomialsizeSize nθ = log(n)pcmgamma[7]
tprecPrecision τθ1 = log(τ)loggamma[1, 5e-5]
tdofDegrees of freedom νθ2 = log(ν-2)pcdof[15, 0.5]
snprecPrecision τθ1 = log(τ)loggamma[1, 5e-5]
snskewSkewness γθ2 = logit-scaledpc.sn10 (scalar)
weibullalphaShape αθ = log(α)/0.1pc.alphaw[5]
logisticprecPrecision τθ = log(τ)loggamma[1, 5e-5]
loglogisticalphaShape αθ = log(α)loggamma[25, 25]
lognormalprecPrecision τθ = log(τ)loggamma[1, 5e-5]
exponentialsurvbeta1..beta10Stratum slopesθi on linear scalenormal[0, 100] (beta1: [-1, 100])
weibullsurvalpha + beta1..beta10Shape + stratum slopesθ = log(α)/0.1; θi linearpc.alphaw / normal[5] / [0, 100] (beta1: [-4, 100])
lognormalsurvprec + beta1..beta10Precision + stratum slopesθ = log(τ); θi linearloggamma / normal[1, 5e-5] / [0, 100] (beta1: [-4, 100])
loglogisticsurvalpha + beta1..beta10Shape + stratum slopesθ = log(α); θi linearloggamma / normal[25, 25] / [0, 100] (beta1: [-4, 100])
gammasurvprec + beta1..beta10Precision + stratum slopesθ = log(φ); θi linearloggamma / normal[1, 0.01] / [0, 100] (beta1: [-4, 100])
poissonNo hyperparameters
binomialNo hyperparameters
xbinomialNo hyperparameters
nbinomial2No hyperparameters
exponentialNo hyperparameters

Detailed Family Specifications

Gaussian (family="gaussian")

The Gaussian likelihood has two hyperparameters. The first (prec) controls the observation precision. The second (precoffset) is typically fixed and acts as a numerical safeguard.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0preclog precisionloggamma[1, 5e-5]4.0False
1precoffsetlog precision offsetnone[]72.087True
# Custom Gaussian precision prior (precoffset stays at its fixed default)
control = {
    'family': {
        'hyper': [
            {'id': 'prec', 'prior': 'pc.prec', 'param': [1, 0.01], 'initial': 4.0, 'fixed': False}
        ]
    }
}

Gamma (family="gamma")

The Gamma likelihood has one hyperparameter controlling the precision (shape parameter).

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0preclog precisionloggamma[1, 0.01]4.605False
# Custom Gamma precision prior
control = {
    'family': {
        'hyper': [
            {'id': 'prec', 'prior': 'loggamma', 'param': [1.0, 0.1], 'initial': 2.0, 'fixed': False}
        ]
    }
}

Beta (family="beta")

The Beta likelihood has one hyperparameter: the precision parameter φ. Note: The key is phi, not prec.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0phiprecision parameterloggamma[1, 0.1]2.303False
# Custom Beta precision prior
control = {
    'family': {
        'hyper': [
            {'id': 'phi', 'prior': 'loggamma', 'param': [1.0, 0.5], 'initial': 1.609, 'fixed': False}
        ]
    }
}  # initial 1.609 = log(5), so phi = 5

Beta-Binomial (family="betabinomial")

The Beta-Binomial likelihood has one hyperparameter: the overdispersion parameter ρ ∈ (0, 1). The internal scale uses the logit transformation.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0rhooverdispersiongaussian[0, 0.4]0False
# Custom Beta-Binomial overdispersion prior
control = {
    'family': {
        'hyper': [
            {'id': 'rho', 'prior': 'gaussian', 'param': [0, 1.0], 'initial': 0, 'fixed': False}
        ]
    }
}

Negative Binomial (family="nbinomial")

The Negative Binomial likelihood has one hyperparameter: the size (inverse overdispersion) parameter n. Large n means less overdispersion.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0sizesizepcmgamma[7]2.303False
# Custom Negative Binomial size prior
control = {
    'family': {
        'hyper': [
            {'id': 'size', 'prior': 'pcmgamma', 'param': [7], 'initial': 2.303, 'fixed': False}
        ]
    }
}

Student-t (family="t")

The Student-t likelihood has two hyperparameters: precision and degrees of freedom. The PC prior on dof penalizes deviation from Gaussian (ν=∞).

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0preclog precisionloggamma[1, 5e-5]0False
1doflog degrees of freedompcdof[15, 0.5]5False
# Custom Student-t priors
control = {
    'family': {
        'hyper': [
            {'id': 'prec', 'prior': 'loggamma', 'param': [1.0, 5e-5], 'initial': 4, 'fixed': False},
            {'id': 'dof',  'prior': 'pcdof',    'param': [10, 0.5],   'initial': 3, 'fixed': False}
        ]
    }
}

Skew-Normal (family="sn")

The Skew-Normal likelihood has two hyperparameters: precision and skewness. The PC prior on skewness penalizes deviation from Normal (γ=0).

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0preclog precisionloggamma[1, 5e-5]4False
1skewlogit skewpc.sn10 (scalar)0.00123False
# Custom Skew-Normal priors
control = {
    'family': {
        'hyper': [
            {'id': 'prec', 'prior': 'loggamma', 'param': [1, 5e-5], 'initial': 4, 'fixed': False},
            {'id': 'skew', 'prior': 'pc.sn',    'param': 10,        'initial': 0.00123, 'fixed': False}  # param is scalar!
        ]
    }
}

Weibull (family="weibull")

The plain Weibull likelihood has one hyperparameter: the shape parameter α. For right-censored / cure-rate models with stratum slopes, see weibullsurv below.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0alphalog alpha (scaled)pc.alphaw[5]-2False

Logistic (family="logistic")

The Logistic likelihood has one hyperparameter: the precision τ. It is a symmetric, heavy-tailed alternative to the Gaussian.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0preclog precisionloggamma[1, 5e-5]1False

Log-Logistic (family="loglogistic")

The plain Log-Logistic likelihood has one hyperparameter: the shape parameter α. For right-censored / cure-rate models with stratum slopes, see loglogisticsurv below.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0alphalog alphaloggamma[25, 25]1False

Log-Normal (family="lognormal")

The plain Log-Normal likelihood has one hyperparameter: the precision τ. For right-censored / cure-rate models with stratum slopes, see lognormalsurv below.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0preclog precisionloggamma[1, 5e-5]0False

Exponential Survival (family="exponentialsurv")

The exponential survival likelihood declares 10 stratum-slope hyperparameters beta1..beta10 for cure-rate / stratified models. There is no precision or shape slot; the rate is determined entirely by the linear predictor and the stratum slopes.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0beta1stratum slope 1normal[-1, 100]-4False
1-9beta2..beta10stratum slopes 2-10normal[0, 100]0False
# Override one stratum slope; the others stay at their defaults
control = {
    'family': {
        'hyper': [
            {'id': 'beta1', 'prior': 'normal', 'param': [-2, 50], 'initial': -3, 'fixed': False}
        ]
    }
}

Weibull Survival (family="weibullsurv")

The Weibull survival likelihood has an alpha shape slot plus 10 stratum slopes beta1..beta10.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0alphashape (log/0.1)pc.alphaw[5]-2False
1beta1stratum slope 1normal[-4, 100]-7False
2-10beta2..beta10stratum slopes 2-10normal[0, 100]0False

Log-Normal Survival (family="lognormalsurv")

The log-normal survival likelihood has a prec precision slot plus 10 stratum slopes beta1..beta10.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0preclog precisionloggamma[1, 5e-5]0False
1beta1stratum slope 1normal[-4, 100]-7False
2-10beta2..beta10stratum slopes 2-10normal[0, 100]0False

Log-Logistic Survival (family="loglogisticsurv")

The log-logistic survival likelihood has an alpha shape slot plus 10 stratum slopes beta1..beta10.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0alphalog alphaloggamma[25, 25]1False
1beta1stratum slope 1normal[-4, 100]-5False
2-10beta2..beta10stratum slopes 2-10normal[0, 100]0False

Gamma Survival (family="gammasurv")

The gamma survival likelihood has a prec precision slot plus 10 stratum slopes beta1..beta10.

IndexKeyNameDefault PriorDefault ParamsInitialFixed
0preclog precisionloggamma[1, 0.01]0False
1beta1stratum slope 1normal[-4, 100]-7False
2-10beta2..beta10stratum slopes 2-10normal[0, 100]0False

Families Without Hyperparameters

The following families have no likelihood hyperparameters to configure:

Common Prior Distributions

Prior NameDescriptionParameters
loggammaLog-gamma prior on θ[shape, rate]
gaussian / normalGaussian prior on θ[mean, precision]
pc.precPC prior for precision[u, α] where P(σ > u) = α
pcdofPC prior for degrees of freedom[u, α] where P(ν < u) = α
pc.snPC prior for skewnessλ (scalar, not list)
pcmgammaPC prior for size/overdispersion[λ]
pc.alphawPC prior for Weibull shape[λ]
logitbetaLogit-beta prior[a, b]
noneNo prior (typically for fixed parameters)[]

Notes