Learn R Programming

bbricks (version 0.1.4)

dPosterior.GaussianGaussian: Density function of the posterior distribution of a "GaussianGaussian" object

Description

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

Usage

# S3 method for GaussianGaussian
dPosterior(obj, mu, LOG = TRUE, ...)

Arguments

obj

A "GaussianGaussian" object.

mu

matrix, or the ones that can be converted to matrix. Each row of mu is an sample.

LOG

Return the log density if set to "TRUE".

...

Additional arguments to be passed to other inherited types.

Value

A numeric vector of the same length as nrow(mu), the posterior density.

See Also

GaussianGaussian, rPosterior.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)))
mu <- rGaussian(10,mu=c(0,0),Sigma = diag(2))
dPosterior(obj=obj,mu=mu)
# }

Run the code above in your browser using DataLab