# dPosterior.GaussianNIW: Density function of the posterior distribution of a... In bbricks: Bayesian Methods and Graphical Model Structures for Statistical Modeling

## Description

Generate the the density value of the posterior distribution of the following 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.
Posterior density is the density function of NIW(mu,Sigma|m,k,v,S).

## Usage

 ```1 2``` ```## S3 method for class 'GaussianNIW' dPosterior(obj, mu, Sigma, LOG = TRUE, ...) ```

## Arguments

 `obj` A "GaussianNIW" object. `mu` vector. `Sigma` matrix, nrow(Sigma) = length(mu). `LOG` Return the log density if set to "TRUE". `...` Additional arguments to be passed to other inherited types.

## Value

numeric, the posterior density of (mu,Sigma).

`GaussianNIW`, `rPosterior.GaussianNIW`
 ```1 2 3 4``` ```obj <- GaussianNIW(gamma=list(m=c(0,0),k=1,v=2,S=diag(2))) mu <- rnorm(2) Sigma <- rInvWishart(df = 3,scale = diag(2)) dPosterior(obj = obj,mu=mu,Sigma = Sigma) ```