← Back to Priors
Fixed Effects

Fixed-Effect Priors

Set priors for the intercept and for specific fixed-effect coefficients via control['fixed'] using label-specific keys (e.g., {'mean': {'z': ...}, 'prec': {'z': ...}}).

Overview

Set Global Priors

# Apply the same Gaussian prior to all non-intercept coefficients
prior_fixed = {
  'mean.intercept': 0.0,   # intercept prior mean
  'prec.intercept': 0.0,   # intercept prior precision (0.0 ~ flat)
  'mean': 0.0,             # prior mean for all non-intercepts
  'prec': 0.001            # prior precision for all non-intercepts
}
res = pyinla(formula=formula, data=df, family='gaussian', control={'fixed': prior_fixed})

Label-Specific Priors

Set priors for specific coefficients by name using dictionaries under mean and prec. Names must match the fixed-effect labels (e.g., 'x', 'z1', or expanded names like 'group_B').

# Different priors for 'x1' and 'x2'; others use the global defaults
control = {
  'fixed': {
    'mean': {'x1': 0.5},
    'prec': {'x1': 2.0, 'x2': 5.0},
    'mean.intercept': 0.0,
    'prec.intercept': 0.0,
    'mean': 0.0,
    'prec': 0.001,
  }
}
res = pyinla(formula=formula, data=df, family='gaussian', control=control)

Intercept-Only Priors

Set a prior for the intercept independently from other fixed effects.

control = {'fixed': {'mean.intercept': 1.0, 'prec.intercept': 1.0}}
res = pyinla(formula=formula, data=df, family='gaussian', control=control)

Matrix Inputs and Expanded Names

If you supply an n×p matrix via ('z', Z) inside model['fixed'], columns are named z1..zp. You can assign priors to these expanded labels individually:

# Suppose model['fixed'] includes ('z', Z) with p columns -> labels z1..zp
control = {'fixed': {'prec': {'z1': 10.0, 'z2': 5.0}}}

Notes