Learn R Programming

bbricks (version 0.1.4)

rPosteriorPredictive.GaussianNIW: Generate random samples from the posterior predictive distribution of a "GaussianNIW" object

Description

Generate random samples from the posterior predictive 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 predictive is a distribution of x|m,k,v,S.

Usage

# S3 method for GaussianNIW
rPosteriorPredictive(obj, n, ...)

Arguments

obj

A "GaussianNIW" object.

n

integer, number of samples.

...

Additional arguments to be passed to other inherited types.

Value

A matrix of n rows, each row is a sample.

References

Murphy, Kevin P. "Conjugate Bayesian analysis of the Gaussian distribution." def 1.22 (2007): 16.

Gelman, Andrew, et al. "Bayesian Data Analysis Chapman & Hall." CRC Texts in Statistical Science (2004).

See Also

GaussianNIW, dPosteriorPredictive.GaussianNIW

Examples

Run this code
# NOT RUN {
obj <- GaussianNIW(gamma=list(m=c(0,0),k=1,v=2,S=diag(2)))
rPosteriorPredictive(obj=obj,20)
# }

Run the code above in your browser using DataLab