| marginalLikelihood.GaussianNIW | R Documentation |
Generate the marginal likelihood of the following model 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.
Marginal likelihood = p(x|m,k,v,S)
## S3 method for class 'GaussianNIW' marginalLikelihood(obj, x, LOG = TRUE, ...)
obj |
A "GaussianNIW" 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. |
numeric, the marginal likelihood.
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).
GaussianNIW, marginalLikelihood_bySufficientStatistics.GaussianNIW
x <- rGaussian(1000,mu = c(1,1),Sigma = matrix(c(1,0.5,0.5,3),2,2)) obj <- GaussianNIW(gamma=list(m=c(0,0),k=1,v=2,S=diag(2))) marginalLikelihood(obj = obj,x=x) ## or... ss <- sufficientStatistics(obj=obj,x=x,foreach = FALSE) marginalLikelihood_bySufficientStatistics(obj = obj,ss=ss)