# MAP.LinearGaussianGaussian: Maximum A Posteriori (MAP) estimate of a... In bbricks: Bayesian Methods and Graphical Model Structures for Statistical Modeling

## Description

Generate the MAP estimate of mu in following model structure:

x \sim Gaussian(A z + b, Sigma)

z \sim Gaussian(m,S)

Where Sigma is known. A is a dimx x dimz matrix, x is a dimx x 1 random vector, z is a dimz x 1 random vector, b is a dimm x 1 vector. Gaussian() is the Gaussian distribution. See `?dGaussian` for the definition of Gaussian distribution.
The model structure and prior parameters are stored in a "LinearGaussianGaussian" object.
The MAP estimates are:

• z_MAP = argmax p(z|m,S,A,b,x,Sigma)

## Usage

 ```1 2``` ```## S3 method for class 'LinearGaussianGaussian' MAP(obj, ...) ```

## Arguments

 `obj` A "LinearGaussianGaussian" object. `...` Additional arguments to be passed to other inherited types.

## Value

numeric vector, the MAP estimate of "z".

## References

Murphy, Kevin P. Machine learning: a probabilistic perspective. MIT press, 2012.

`LinearGaussianGaussian`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```obj <- LinearGaussianGaussian(gamma=list(Sigma=matrix(c(2,1,1,2),2,2), m=c(0.2,0.5,0.6),S=diag(3))) x <- rGaussian(100,mu = runif(2),Sigma = diag(2)) A <- matrix(runif(6),2,3) b <- runif(2) ss <- sufficientStatistics(obj,x=x,A=A,b=b) ## update prior into posterior posterior(obj=obj,ss=ss) ## get the MAP estimate of z MAP(obj) ```