sufficientStatistics {bbricks}R Documentation

Get sample sufficient statistics

Description

This is a generic function that will generate the sufficient statistics of a given Bayesian bricks object. i.e.
for the model structure:

theta|gamma \sim H(gamma)

x|theta \sim F(theta)

get the sufficient statistics T(x).
For a given sample set x, each row of x is an observation, and a Bayesian bricks object obj. sufficientStatistics() return the sufficient statistics for different model structures:

class(obj)="LinearGaussianGaussian"

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

z \sim Gaussian(m,S)

The sufficient statistics are:

See ?sufficientStatistics.LinearGaussianGaussian for details.

class(obj)="GaussianGaussian"

Where

x \sim Gaussian(mu,Sigma)

mu \sim Gaussian(m,S)

Sigma is known. The sufficient statistics are:

See ?sufficientStatistics.GaussianGaussian for details.

class(obj)="GaussianInvWishart"

Where

x \sim Gaussian(mu,Sigma)

Sigma \sim InvWishart(v,S)

mu is known.
The sufficient statistics are:

See ?sufficientStatistics.GaussianInvWishart for details.

class(obj)="GaussianNIW"

Where

x \sim Gaussian(mu,Sigma)

Sigma \sim InvWishart(v,S)

mu \sim Gaussian(m,Sigma/k)

The sufficient statistics are:

See ?sufficientStatistics.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. The sufficient statistics are:

See ?sufficientStatistics.GaussianNIG for details.

class(obj)="CatDirichlet"

Where

x \sim Categorical(pi)

pi \sim Dirichlet(alpha)

The sufficient statistics of CatDirichlet object can either be x itself, or the counts of the unique labels in x.
See ?sufficientStatistics.CatDirichlet for details.

class(obj)="CatDP"

Where

x \sim Categorical(pi)

pi \sim DirichletProcess(alpha)

The sufficient statistics of CatDP object can either be x itself, or the counts of the unique labels in x.
See ?sufficientStatistics.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)

The sufficient statistics of "DP" object is the same sufficient statistics of the "BasicBayesian" inside the "DP". See ?sufficientStatistics.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)

The sufficient statistics of "HDP" object is the same sufficient statistics of the "BasicBayesian" inside the "HDP". See ?sufficientStatistics.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)

The sufficient statistics of "HDP2" object is the same sufficient statistics of the "BasicBayesian" inside the "HDP2". See ?sufficientStatistics.HDP2 for details.

Usage

sufficientStatistics(obj, x, ...)

Arguments

obj

a "BayesianBrick" object used to select a method.

x

a set of samples.

...

further arguments passed to or from other methods.

Value

An object of corresponding sufficient statistics class, such as "ssGaussian"

See Also

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

Examples

x <- rGaussian(10,mu = 1,Sigma = 1)
obj <- GaussianNIW()                    #an GaussianNIW object
sufficientStatistics(obj=obj,x=x)

[Package bbricks version 0.1.4 Index]