posterior: update the prior distribution with sufficient statistics

Description Usage Arguments Value See Also

View source: R/Bayesian_Bricks.r

Description

This is a generic function that will update the prior distribution of a "BayesianBrick" object by adding information of the observation's sufficient statistics. i.e. for the model structure:

theta|gamma \sim H(gamma)

x|theta \sim F(theta)

update gamma to gamma_posterior by adding the information of x to gamma.
For a given sample set x or it's sufficient statistics ss, and a Bayesian bricks object obj, posterior() will update the posterior parameters in obj for different model structures:

class(obj)="LinearGaussianGaussian"

x \sim Gaussian(A z + b, Sigma)

z \sim Gaussian(m,S)

posterior() will update m and S in obj. See ?posterior.LinearGaussianGaussian for details.

class(obj)="GaussianGaussian"

Where

x \sim Gaussian(mu,Sigma)

mu \sim Gaussian(m,S)

Sigma is known. posterior() will update m and S in obj. See ?posterior.GaussianGaussian for details.

class(obj)="GaussianInvWishart"

Where

x \sim Gaussian(mu,Sigma)

Sigma \sim InvWishart(v,S)

mu is known. posterior() will update v and S in obj. See ?posterior.GaussianInvWishart for details.

class(obj)="GaussianNIW"

Where

x \sim Gaussian(mu,Sigma)

Sigma \sim InvWishart(v,S)

mu \sim Gaussian(m,Sigma/k)

posterior() will update m, k, v and S in obj. See ?posterior.GaussianNIW for details.

class(obj)="GaussianNIG"

Where

x \sim Gaussian(X beta,sigma^2)

sigma^2 \sim InvGamma(a,b)

beta \sim Gaussian(m,sigma^2 V)

X is a row vector, or a design matrix where each row is an obervation. posterior() will update m, V, a and b in obj. See ?posterior.GaussianNIG for details.

class(obj)="CatDirichlet"

Where

x \sim Categorical(pi)

pi \sim Dirichlet(alpha)

posterior() will update alpha in obj. See ?posterior.CatDirichlet for details.

class(obj)="CatDP"

Where

x \sim Categorical(pi)

pi \sim DirichletProcess(alpha)

posterior() will update alpha in obj. See ?posterior.CatDP for details.

class(obj)="DP"

Where

pi|alpha \sim DP(alpha,U)

z|pi \sim Categorical(pi)

theta_z|psi \sim H0(psi)

x|theta_z,z \sim F(theta_z)

posterior() will update alpha and psi in obj. See ?posterior.DP for details.

class(obj)="HDP"

Where

G|gamma \sim DP(gamma,U)

pi_j|G,alpha \sim DP(alpha,G), j = 1:J

z|pi_j \sim Categorical(pi_j)

k|z,G \sim Categorical(G),\textrm{ if z is a sample from the base measure G}

theta_k|psi \sim H0(psi)

posterior() will update gamma, alpha and psi in obj. See ?posterior.HDP for details.

class(obj)="HDP2"

Where

G |eta \sim DP(eta,U)

G_m|gamma,G \sim DP(gamma,G), m = 1:M

pi_{mj}|G_m,alpha \sim DP(alpha,G_m), j = 1:J_m

z|pi_{mj} \sim Categorical(pi_{mj})

k|z,G_m \sim Categorical(G_m),\textrm{ if z is a sample from the base measure } G_m

u|k,G \sim Categorical(G),\textrm{ if k is a sample from the base measure} G

theta_u|psi \sim H0(psi)

x|theta_u,u \sim F(theta_u)

posterior() will update eta, gamma, alpha and psi in obj. See ?posterior.HDP2 for details.

Usage

1
posterior(obj, ...)

Arguments

obj

A "BayesianBrick" object used to select a method.

...

further arguments passed to or from other methods.

Value

None, or an error message if the update fails.

See Also

posterior.LinearGaussianGaussian for Linear Gaussian and Gaussian conjugate structure, posterior.GaussianGaussian for Gaussian-Gaussian conjugate structure, posterior.GaussianInvWishart for Gaussian-Inverse-Wishart conjugate structure, posterior.GaussianNIW for Gaussian-NIW conjugate structure, posterior.GaussianNIG for Gaussian-NIG conjugate structure, posterior.CatDirichlet for Categorical-Dirichlet conjugate structure, posterior.CatDP for Categorical-DP conjugate structure ...


bbricks documentation built on July 8, 2020, 7:29 p.m.