[][src]Struct rv::dist::NormalInvWishart

pub struct NormalInvWishart { /* fields omitted */ }

Common conjugate prior on the μ and Σ parameters in the Multivariate Gaussian, Ν(μ, Σ)

Ν(μ, Σ) ~ NIW(μ0, κ0, ν, Ψ) implies μ ~ N(μ0, Σ/k0) and Σ ~ W-1(Ψ, ν)

Example

Draw a Multivariate Gaussian from GIW

use nalgebra::{DMatrix, DVector};
use rv::prelude::*;

let mu = DVector::zeros(3);
let k = 1.0;
let df = 3;
let scale = DMatrix::identity(3, 3);

let niw = NormalInvWishart::new(mu, k, df, scale).unwrap();

let mut rng = rand::thread_rng();

let mvg: MvGaussian = niw.draw(&mut rng);

Methods

impl NormalInvWishart[src]

pub fn set_k(&mut self, val: f64) -> &mut Self[src]

A scale factor on Σ, κ0

pub fn set_df(&mut self, val: usize) -> &mut Self[src]

The degrees of freedom, ν > |μ| - 1

impl NormalInvWishart[src]

pub fn new(
    mu: DVector<f64>,
    k: f64,
    df: usize,
    scale: DMatrix<f64>
) -> Result<Self, NormalInvWishartError>
[src]

Create a new NormalInvWishart distribution

Arguments

  • mu: The mean of μ, μ0
  • k: A scale factor on Σ, κ0
  • df: The degrees of freedom, ν > |μ| - 1
  • scale The positive-definite scale matrix, Ψ

pub fn new_unchecked(
    mu: DVector<f64>,
    k: f64,
    df: usize,
    scale: DMatrix<f64>
) -> Self
[src]

Creates a new NormalInvWishart without checking whether the parameters are valid.

pub fn dims(&self) -> usize[src]

Get the number of dimensions

pub fn mu(&self) -> &DVector<f64>[src]

Get a reference to the mu vector

pub fn k(&self) -> f64[src]

Get the k parameter

pub fn df(&self) -> usize[src]

Get the degrees of freedom, df

pub fn scale(&self) -> &DMatrix<f64>[src]

Get a reference to the scale matrix

pub fn set_scale(
    &mut self,
    scale: DMatrix<f64>
) -> Result<(), NormalInvWishartError>
[src]

Set the scale parameter

pub fn set_scale_unnchecked(&mut self, scale: DMatrix<f64>)[src]

pub fn set_mu(&mut self, mu: DVector<f64>) -> Result<(), NormalInvWishartError>[src]

Set the scale parameter

pub fn set_mu_unchecked(&mut self, mu: DVector<f64>)[src]

Trait Implementations

impl Clone for NormalInvWishart[src]

impl ConjugatePrior<Matrix<f64, Dynamic, U1, VecStorage<f64, Dynamic, U1>>, MvGaussian> for NormalInvWishart[src]

type Posterior = NormalInvWishart

impl ContinuousDistr<MvGaussian> for NormalInvWishart[src]

impl Debug for NormalInvWishart[src]

impl Display for NormalInvWishart[src]

impl<'_> From<&'_ NormalInvWishart> for String[src]

impl PartialEq<NormalInvWishart> for NormalInvWishart[src]

impl PartialOrd<NormalInvWishart> for NormalInvWishart[src]

impl Rv<MvGaussian> for NormalInvWishart[src]

impl StructuralPartialEq for NormalInvWishart[src]

impl Support<MvGaussian> for NormalInvWishart[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Fx, X> ContinuousDistr<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: ContinuousDistr<X>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Fx, X> Rv<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Rv<X>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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

impl<Fx, X> Support<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Support<X>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,