Learn R Programming

bbricks (version 0.1.4)

dPosteriorPredictive.GaussianGaussian: Posterior predictive density function of a "GaussianGaussian" object

Description

Generate the the density value of the posterior predictive 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 predictive density is p(x|m,S,Sigma).

Usage

# S3 method for GaussianGaussian
dPosteriorPredictive(obj, x, LOG = TRUE, ...)

Arguments

obj

A "GaussianGaussian" object.

x

matrix, or the ones that can be converted to matrix, each row of x is an observation.

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(x), the posterior predictive density.

References

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

See Also

GaussianGaussian, dPosteriorPredictive.GaussianGaussian, marginalLikelihood.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))
dPosteriorPredictive(obj = obj,x=x,LOG = TRUE)
dPosteriorPredictive(obj = obj,x=x,LOG = FALSE)
# }

Run the code above in your browser using DataLab