Learn R Programming

bbricks (version 0.1.1)

MAP.GaussianNIW: Maximum A Posteriori(MAP) estimate of a "GaussianNIW" object

Description

Generate the MAP estimate of "theta" in following Gaussian-NIW structure: theta|gamma ~ NIW(gamma) x|theta ~ Gaussian(theta) where theta = (mu,Sigma) is the Gaussian parameter, gamma = (m,k,v,S) is the Normal-Inverse-Wishart(NIW) parameter. The model structure and prior parameters are stored in a "GaussianNIW" object. MAP is theta_MAP = argmax_theta p(theta|gamma,x).

Usage

# S3 method for GaussianNIW
MAP(obj, ...)

Arguments

obj

A "GaussianNIW" object.

...

Additional arguments to be passed to other inherited types.

Value

A named list, the MAP estimate of "theta".

References

Murphy, Kevin P. "Conjugate Bayesian analysis of the Gaussian distribution." def 1.22 (2007): 16.

Gelman, Andrew, et al. "Bayesian Data Analysis Chapman & Hall." CRC Texts in Statistical Science (2004).

See Also

GaussianNIW

Examples

Run this code
# NOT RUN {
## update the piror with new observations then calculate the MAP estimate
x <- rGaussian(1000,mu = c(1,1),Sigma = matrix(c(1,0.5,0.5,3),2,2))
w <- runif(1000)
obj <- GaussianNIW(gamma=list(m=c(0,0),k=1,v=2,S=diag(2)))
ss <- sufficientStatistics_Weighted(obj = obj,x=x,w=w,foreach = TRUE)
for(i in 1L:length(ss)) posterior(obj = obj,ss=ss[[i]])
MAP(obj)
# }

Run the code above in your browser using DataLab