Learn R Programming

bbricks (version 0.1.1)

posterior.HDP2: Update a "HDP2" object with sample sufficient statistics

Description

For the model structure: G_m |eta ~ DP(eta,U), m = 1:M G_mj|gamma ~ DP(gamma,G_m), j = 1:J_m pi_mj|G_mj,alpha ~ DP(alpha,G_mj) z|pi_mj ~ Categorical(pi_mj) k|z,G_mj ~ Categorical(G_mj), if z is a sample from the base measure G_mj u|k,G_m ~ Categorical(G_m), if k is a sample from the base measure G_m theta_u|psi ~ H0(psi) x|theta_u,u ~ F(theta_u) where DP(eta,U) is a Dirichlet Process on positive integers, eta is the "concentration parameter", U is the "base measure" of this Dirichlet process, U is an uniform distribution on all positive integers. DP(gamma,G_m) is a Dirichlet Process on integers with concentration parameter gamma and base measure G_m. DP(alpha,G_mj) is a Dirichlet Process on integers with concentration parameter alpha and base measure G_mj. The choice of F() and H0() can be arbitrary, they are distributions of x and theta_u correspondingly. In the case of HDP2, u, z and k can only be positive integers. This function will update the prior knowledge by adding the information of newly observed samples x, z and k. The model structure and prior parameters are stored in a "HDP2" object, the prior parameters in this object will be updated after running this function.

Usage

# S3 method for HDP2
posterior(obj, ss, ss1, ss2, ss3, m, j, w = NULL, ...)

Arguments

obj

A "HDP2" object.

ss

Sufficient statistics of x of the "BasicBayesian" object, must be a list of sufficient statistics for each of the observations. Use sufficientStatistics(...,foreach=TRUE) to generate ss.

ss1

Sufficient statistics of u. In HDP2 case the sufficient statistic of sample u is u itself(if u is a integer vector with all positive values).

ss2

Sufficient statistics of k. In HDP2 case the sufficient statistic of sample k is k itself(if k is a integer vector with all positive values).

ss3

Sufficient statistics of z. In HDP2 case the sufficient statistic of sample z is z itself(if z is a integer vector with all positive values).

m

integer, group label.

j

integer, subgroup label.

w

Sample weights, default NULL.

...

Additional arguments to be passed to other inherited types.

Value

None. the model stored in "obj" will be updated based on "ss", "ss1", "ss2"and "ss3".

References

Teh, Yee W., et al. "Sharing clusters among related groups: Hierarchical Dirichlet processes." Advances in neural information processing systems. 2005.

See Also

HDP2,posteriorDiscard.HDP2,sufficientStatistics.HDP2