dPosterior.LinearGaussianGaussian {bbricks} | R Documentation |
Generate the the density value of the posterior distribution of the following 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.
Posterior density is the density function of Gaussian(z|m,S).
## S3 method for class 'LinearGaussianGaussian' dPosterior(obj, z, LOG = TRUE, ...)
obj |
A "LinearGaussianGaussian" object. |
z |
matrix, or the ones that can be converted to matrix. Each row of z is an sample. |
LOG |
Return the log density if set to "TRUE". |
... |
Additional arguments to be passed to other inherited types. |
A numeric vector of the same length as nrow(z), the posterior density.
LinearGaussianGaussian
, rPosterior.LinearGaussianGaussian
obj <- LinearGaussianGaussian(gamma=list(Sigma=matrix(c(2,1,1,2),2,2), m=c(0.2,0.5,0.6),S=diag(3))) z <- rGaussian(10,mu = runif(3),Sigma = diag(3)) dPosterior(obj = obj,z=z) dPosterior(obj = obj,z=z,LOG=FALSE)