Skip to main content

Posterior

Struct Posterior 

Source
pub struct Posterior {
Show 14 fields pub delta_post: Vector9, pub lambda_post: Matrix9, pub beta_proj: Vector2, pub beta_proj_cov: Matrix2, pub beta_draws: Vec<Vector2>, pub leak_probability: f64, pub projection_mismatch_q: f64, pub n: usize, pub lambda_mean: Option<f64>, pub lambda_mixing_ok: Option<bool>, pub kappa_mean: Option<f64>, pub kappa_cv: Option<f64>, pub kappa_ess: Option<f64>, pub kappa_mixing_ok: Option<bool>,
}
Expand description

Posterior distribution parameters for the 9D effect vector δ.

The posterior is Gaussian: δ | Δ ~ N(δ_post, Λ_post) where each δ_k represents the timing difference at decile k.

The 2D projection β_proj = (μ, τ) provides shift/tail decomposition.

Uses Student’s t prior (ν=4) via Gibbs sampling for robust inference.

Fields§

§delta_post: Vector9

9D posterior mean δ_post in nanoseconds.

§lambda_post: Matrix9

9D posterior covariance Λ_post.

§beta_proj: Vector2

2D GLS projection β = (μ, τ) for interpretability.

  • β[0] = μ (uniform shift)
  • β[1] = τ (tail effect)
§beta_proj_cov: Matrix2

2D projection covariance (empirical, from draws).

§beta_draws: Vec<Vector2>

Retained β draws for dominance-based classification (spec §3.4.6). Each draw is β^(s) = A·δ^(s) where A is the GLS projection matrix.

§leak_probability: f64

Leak probability: P(max_k |δ_k| > θ | Δ). Computed via Monte Carlo integration over the 9D posterior.

§projection_mismatch_q: f64

Projection mismatch Q statistic. Q = r’Σ_n⁻¹r where r = δ_post - X β_proj. High values indicate the 2D summary is approximate.

§n: usize

Number of samples used in this posterior computation.

§lambda_mean: Option<f64>

Posterior mean of latent scale λ. None if using simple posterior (no Gibbs sampler).

§lambda_mixing_ok: Option<bool>

Whether the Gibbs sampler’s lambda chain mixed well. None if using simple posterior. When Some(false), indicates potential posterior unreliability.

§kappa_mean: Option<f64>

Posterior mean of likelihood precision κ. None if using simple posterior.

§kappa_cv: Option<f64>

Coefficient of variation of κ. None if using simple posterior.

§kappa_ess: Option<f64>

Effective sample size of κ chain. None if using simple posterior.

§kappa_mixing_ok: Option<bool>

Whether the Gibbs sampler’s kappa chain mixed well. None if using simple posterior.

Implementations§

Source§

impl Posterior

Source

pub fn new( delta_post: Vector9, lambda_post: Matrix9, beta_proj: Vector2, beta_proj_cov: Matrix2, beta_draws: Vec<Vector2>, leak_probability: f64, projection_mismatch_q: f64, n: usize, ) -> Self

Create a new posterior with given parameters.

Source

pub fn new_with_gibbs( delta_post: Vector9, lambda_post: Matrix9, beta_proj: Vector2, beta_proj_cov: Matrix2, beta_draws: Vec<Vector2>, leak_probability: f64, projection_mismatch_q: f64, n: usize, lambda_mean: f64, lambda_mixing_ok: bool, kappa_mean: f64, kappa_cv: f64, kappa_ess: f64, kappa_mixing_ok: bool, ) -> Self

Create a new posterior with Gibbs sampler diagnostics (v5.4, v5.6).

Source

pub fn shift_ns(&self) -> f64

Get the shift component (μ) from the 2D projection.

Source

pub fn tail_ns(&self) -> f64

Get the tail component (τ) from the 2D projection.

Source

pub fn shift_se(&self) -> f64

Get the standard error of the shift component.

Source

pub fn tail_se(&self) -> f64

Get the standard error of the tail component.

Source

pub fn max_effect_ns(&self) -> f64

Get the max absolute effect across all deciles.

Source

pub fn to_effect_estimate(&self) -> EffectEstimate

Build an EffectEstimate from this posterior.

This computes the credible interval and classifies the effect pattern using dominance-based classification from the β draws (spec §3.4.6).

Source

pub fn measurement_quality(&self) -> MeasurementQuality

Get measurement quality based on the effect standard error.

Quality is determined by the minimum detectable effect (MDE), which is approximately 2x the effect standard error.

Source

pub fn to_summary(&self) -> PosteriorSummary

Convert to an FFI-friendly summary containing only scalar fields.

This uses the canonical effect pattern classification from draws (spec §3.4.6) rather than the simpler heuristics that were previously duplicated in bindings.

Trait Implementations§

Source§

impl Clone for Posterior

Source§

fn clone(&self) -> Posterior

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Posterior

Source§

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

Formats the value using the given formatter. Read more

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.