Skip to main content

RhoPrior

Enum RhoPrior 

Source
pub enum RhoPrior {
    Flat,
    Normal {
        mean: f64,
        sd: f64,
    },
    GammaPrecision {
        shape: f64,
        rate: f64,
    },
    PenalizedComplexity {
        upper: f64,
        tail_prob: f64,
    },
    Independent(Vec<RhoPrior>),
}
Expand description

Fixed prior family for smoothing parameters in joint HMC refinement.

Variants§

§

Flat

§

Normal

Fields

§mean: f64
§sd: f64
§

GammaPrecision

Gamma(shape, rate) conjugate hyperprior on the precision lambda = exp(rho).

The deterministic REML/LAML objective uses the MAP-in-lambda convention and is minimized, so this contributes rate * exp(rho) - (shape - 1) * rho up to an additive constant. Samplers over rho include the +rho Jacobian from lambda = exp(rho), so their log-density contribution is shape * rho - rate * exp(rho). For a block with effective dimension n_p and centered quadratic (beta - mu)'S_p(beta - mu), the conditional posterior is Gamma(shape + n_p/2, rate + quadratic/2) and the closed-form MAP precision is (shape + n_p/2 - 1) / (rate + quadratic/2). Gamma(1, 0) is the explicit flat/default case and reproduces the current MacKay/Tipping fixed point.

Fields

§shape: f64
§rate: f64
§

PenalizedComplexity

Penalized-complexity (PC) prior on the smoothing parameter (Simpson, Rue, Riebler, Martins, Sørbye, Statistical Science 2017).

A PC prior fixes a base model (here the infinitely-smooth limit, where the penalized component collapses to its null space) and puts an exponential prior on the distance away from it. For a Gaussian smooth with precision λ = exp(ρ) the relevant distance is the marginal standard-deviation scale d = λ^{-1/2} = exp(-ρ/2), and a constant-rate penalization p(d) = θ exp(-θ d) induces the closed-form log-prior

log p(ρ) = ln(θ/2) − ρ/2 − θ exp(−ρ/2).

The rate θ is calibrated by the single interpretable tail statement P(d > upper) = tail_prob, i.e. θ = −ln(tail_prob) / upper. The prior is reparameterization-invariant and shrinks toward the simpler model (an exponential wall against under-smoothing, only a gentle linear pull toward over-smoothing), which is exactly the Occam behaviour wanted for high-variance flexible components. The REML/LAML objective is minimized, so this contributes ρ/2 + θ exp(−ρ/2) (up to an additive constant) to the cost, with gradient 1/2 − (θ/2) exp(−ρ/2) and (always positive) curvature (θ/4) exp(−ρ/2).

Fields

§upper: f64

Upper bound U on the distance scale d = exp(-ρ/2) (the marginal SD scale of the penalized component) in the tail statement P(d > U) = tail_prob. Must be finite and strictly positive.

§tail_prob: f64

Tail probability α in P(d > U) = α. Must satisfy 0 < α < 1.

§

Independent(Vec<RhoPrior>)

Coordinate-specific priors for models whose smoothing parameters do not share one prior family, such as nested coefficient groups.

Trait Implementations§

Source§

impl Clone for RhoPrior

Source§

fn clone(&self) -> RhoPrior

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RhoPrior

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RhoPrior

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RhoPrior

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for RhoPrior

Source§

fn eq(&self, other: &RhoPrior) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for RhoPrior

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RhoPrior

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.