Description Usage Arguments Value See Also Examples
View source: R/Bayesian_Bricks.r
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:
x \sim Gaussian(A z + b, Sigma)
z \sim Gaussian(m,S)
The sufficient statistics are:
SA = sum_{i=1:N} A_i^T Sigma^{-1} A_i
SAx = sum_{i=1:N} A_i^T Sigma^{-1} (x_i-b_i)
See ?sufficientStatistics.LinearGaussianGaussian
for details.
Where
x \sim Gaussian(mu,Sigma)
mu \sim Gaussian(m,S)
Sigma is known. The sufficient statistics are:
N: the effective number of samples.
xsum: the row sums of the samples.
See ?sufficientStatistics.GaussianGaussian
for details.
Where
x \sim Gaussian(mu,Sigma)
Sigma \sim InvWishart(v,S)
mu is known.
The sufficient statistics are:
N: the effective number of samples.
xsum: the sample scatter matrix centered on the mean vector.
See ?sufficientStatistics.GaussianInvWishart
for details.
Where
x \sim Gaussian(mu,Sigma)
Sigma \sim InvWishart(v,S)
mu \sim Gaussian(m,Sigma/k)
The sufficient statistics are:
N: the effective number of samples.
xsum: the row sums of the samples.
S: the uncentered sample scatter matrix.
See ?sufficientStatistics.GaussianNIW
for details.
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:
N: the effective number of samples.
SXx: covariance of X and x
SX: the uncentered sample scatter matrix.
Sx: the variance of x
See ?sufficientStatistics.GaussianNIG
for details.
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.
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.
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.
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.
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.
1 | sufficientStatistics(obj, x, ...)
|
obj |
a "BayesianBrick" object used to select a method. |
x |
a set of samples. |
... |
further arguments passed to or from other methods. |
An object of corresponding sufficient statistics class, such as "ssGaussian"
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 ...
1 2 3 | x <- rGaussian(10,mu = 1,Sigma = 1)
obj <- GaussianNIW() #an GaussianNIW object
sufficientStatistics(obj=obj,x=x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.