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
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.
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
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<'de> Deserialize<'de> for RhoPrior
impl<'de> Deserialize<'de> for RhoPrior
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RhoPrior, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RhoPrior, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for RhoPrior
impl Serialize for RhoPrior
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for RhoPrior
Auto Trait Implementations§
impl Freeze for RhoPrior
impl RefUnwindSafe for RhoPrior
impl Send for RhoPrior
impl Sync for RhoPrior
impl Unpin for RhoPrior
impl UnsafeUnpin for RhoPrior
impl UnwindSafe for RhoPrior
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.