Parameter Priors
The parameter prior framework controls the distributions placed on real-valued model parameters: pairwise interactions, category thresholds, continuous-variable means, and the diagonal of the precision matrix. All priors inherit from BaseParameterPrior in src/priors/parameter_prior.h. The user-facing R-side constructors are documented on the Prior Constructors reference page.
BaseParameterPrior interface
class BaseParameterPrior {
virtual double logp(double x) const = 0;
virtual double grad(double x) const = 0;
virtual std::unique_ptr<BaseParameterPrior> clone() const = 0;
};Each prior provides a log-density logp(x) and gradient grad(x) evaluated at a single point \(x\); clone() produces an independent copy for parallel chain execution. The scale-family classes (Cauchy, Normal) additionally expose a scale() accessor, and GammaScalePrior exposes shape() and rate(). These accessors are what the samplers consult beyond plain density evaluation: the GGM’s Gibbs eligibility check and slab-variance formulas read scale(), the conjugate edge move and row-block Gibbs read the Gamma shape()/rate(), the Cauchy scale-mixture weights are refreshed against scale(), and the standardized eta frame resolves the diagonal rate from the slab’s scale().
Concrete classes
| Class | Family | Hyperparameters | R constructor |
|---|---|---|---|
CauchyPrior |
Cauchy(0, scale) | scale |
cauchy_prior() |
NormalPrior |
Normal(0, scale) | scale |
normal_prior() |
BetaPrimePrior |
logit-Beta(\(\alpha\), \(\beta\)) | alpha, beta |
beta_prime_prior() |
GammaScalePrior |
Gamma(shape, rate) on positive support | shape, rate |
gamma_prior(), exponential_prior() |
BetaPrimePrior is used only for thresholds and has no scale accessor. GammaScalePrior is used only for the precision-matrix diagonal.
Factory dispatch
Two inline factories at the bottom of parameter_prior.h map a (type, hyperparameters) triple to the concrete class:
| Factory | Type strings | Returns |
|---|---|---|
create_parameter_prior(type, scale, alpha, beta) |
"cauchy", "normal", "beta-prime" |
unique_ptr<BaseParameterPrior> |
create_scale_prior(type, shape, rate) |
"gamma", "exponential" |
unique_ptr<BaseParameterPrior> (GammaScalePrior) |
The R-side unpack_parameter_prior() and unpack_scale_prior() helpers flatten each prior object into its (family, hyperparameters) representation; the C++ bridge then calls the matching factory.
Where the priors are used
Each model holds unique_ptr<BaseParameterPrior> members for the prior roles it needs:
| Role | Used by | Default |
|---|---|---|
| Pairwise interactions | GGM, OMRF, mixed MRF | normal_prior(scale = 1) |
| Baseline pairwise interactions | bgmCompare | normal_prior(scale = 1) |
| Category thresholds | OMRF, mixed MRF, bgmCompare | beta_prime_prior(0.5, 0.5) |
| Continuous means | mixed MRF | normal_prior(scale = 1) |
| Precision-matrix diagonal | GGM, mixed MRF | exponential_prior(eta = 1) |
The model’s logp_and_gradient() and Metropolis update functions call into the held priors at every iteration. This polymorphic dispatch is what allows the user to swap families without touching the C++ code.
The standardized eta frame
The diagonal’s Gamma-family rate can be given in two frames (the rate and eta arguments of gamma_prior()/exponential_prior()). In the raw frame the rate applies to \(\theta_{ii}/2\) as-is. In the standardized frame, eta is the rate in the coordinate system where the slab has unit scale: the R layer resolves the raw rate at fit time as eta / s, with s the slab’s scale(). Because graph and partial-correlation inference is invariant to a joint rescaling of slab and diagonal, fixing eta keeps the prior geometry — how far the prior mass sits from the positive-definite cone boundary — unchanged when the user widens or narrows the slab. This triple \((\delta, \eta, \alpha)\) at unit slab scale is what the engine pages call the standardized cell; it is the frame in which the Z-ratio constants and correction tables are built, which is why one table serves every slab scale.