Learn R Programming

bbricks (version 0.1.4)

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

Description

Generate the MAP estimate of mu in following model structure: $$x \sim Gaussian(mu,Sigma)$$ $$mu \sim Gaussian(m,S)$$ Where Sigma is known. Gaussian() is the Gaussian distribution. See ?dGaussian for the definition of Gaussian distribution. The model structure and prior parameters are stored in a "GaussianGaussian" object. The MAP estimates are:

  • (mu_MAP) = argmax p(mu|m,S,x,Sigma)

Usage

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

Arguments

obj

A "GaussianGaussian" object.

...

Additional arguments to be passed to other inherited types.

Value

numeric vector, the MAP estimate of "mu".

References

Gelman, Andrew, et al. Bayesian data analysis. CRC press, 2013.

See Also

GaussianGaussian

Examples

Run this code
# NOT RUN {
obj <- GaussianGaussian(gamma=list(Sigma=matrix(c(2,1,1,2),2,2),m=c(0.2,0.5),S=diag(2)))
x <- rGaussian(100,c(0,0),Sigma = matrix(c(2,1,1,2),2,2))
ss <- sufficientStatistics(obj=obj,x=x,foreach = FALSE)
## update prior into posterior
posterior(obj = obj,ss = ss)
## get the MAP estimate of mu
MAP(obj)
# }

Run the code above in your browser using DataLab