Skip to main content

Posterior

Struct Posterior 

Source
pub struct Posterior {
    pub delta_post: Vector9,
    pub lambda_post: Matrix9,
    pub delta_draws: Vec<Vector9>,
    pub leak_probability: f64,
    pub theta: 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.

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.

§delta_draws: Vec<Vector9>

Retained δ draws from the Gibbs sampler. Used for effect estimation via compute_effect_estimate.

§leak_probability: f64

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

§theta: f64

Effect threshold used for leak probability computation.

§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, delta_draws: Vec<Vector9>, leak_probability: f64, theta: f64, n: usize, ) -> Self

Create a new posterior with given parameters.

Source

pub fn new_with_gibbs( delta_post: Vector9, lambda_post: Matrix9, delta_draws: Vec<Vector9>, leak_probability: f64, theta: 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 max_effect_ns(&self) -> f64

Get the max absolute effect across all deciles from posterior mean.

Source

pub fn to_effect_estimate(&self) -> EffectEstimate

Build an EffectEstimate from this posterior.

Uses delta draws if available, otherwise uses analytical approximation.

Source

pub fn measurement_quality(&self) -> MeasurementQuality

Get measurement quality based on the posterior uncertainty.

Quality is determined by the minimum detectable effect (MDE), which is approximately the maximum marginal standard deviation.

Source

pub fn to_summary(&self) -> PosteriorSummary

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

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.