Description Usage Arguments Value References See Also Examples
View source: R/Gaussian_Inference.r
Generate the MAP estimate of (mu,Sigma) in following Gaussian-NIW structure:
mu,Sigma|m,k,v,S \sim NIW(m,k,v,S)
x|mu,Sigma \sim Gaussian(mu,Sigma)
Where NIW() is the Normal-Inverse-Wishart distribution, Gaussian() is the Gaussian distribution. See ?dNIW
and dGaussian
for the definitions of these distribution.
The model structure and prior parameters are stored in a "GaussianNIW" object.
The MAP estimates are:
(mu_MAP,Sigma_MAP) = argmax p(mu,Sigma|m,k,v,S,x)
1 2 |
obj |
A "GaussianNIW" object. |
... |
Additional arguments to be passed to other inherited types. |
A named list, the MAP estimate of mu and Sigma.
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).
1 2 3 4 5 6 7 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.