Description Usage Arguments Value References See Also Examples
View source: R/Gaussian_Inference.r
Generate the the density value of the posterior predictive distribution of the following structure:
x \sim Gaussian(mu,Sigma)
Sigma \sim InvWishart(v,S)
mu is known. Gaussian() is the Gaussian distribution. See ?dGaussian
and ?dInvWishart
for the definition of the distributions.
The model structure and prior parameters are stored in a "GaussianInvWishart" object.
Posterior predictive density is p(x|v,S,mu).
1 2 | ## S3 method for class 'GaussianInvWishart'
dPosteriorPredictive(obj, x, LOG = TRUE, ...)
|
obj |
A "GaussianInvWishart" 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. |
A numeric vector of the same length as nrow(x), the posterior predictive density.
Gelman, Andrew, et al. Bayesian data analysis. CRC press, 2013.
MARolA, K. V., JT KBNT, and J. M. Bibly. Multivariate analysis. AcadeInic Press, Londres, 1979.
GaussianInvWishart
, dPosteriorPredictive.GaussianInvWishart
, marginalLikelihood.GaussianInvWishart
1 2 3 4 5 6 7 8 | obj <- GaussianInvWishart(gamma=list(mu=c(-1.5,1.5),v=3,S=diag(2)))
x <- rGaussian(100,mu = c(-1.5,1.5),Sigma = matrix(c(0.1,0.03,0.03,0.1),2,2))
xNew <- rGaussian(100,mu = c(-1.5,1.5),Sigma = matrix(c(0.1,0.03,0.03,0.1),2,2))
ss <- sufficientStatistics(obj=obj,x=x,foreach = FALSE)
## update piror with x
posterior(obj=obj,ss = ss)
## use the posterior to calculate the probability of observing each xNew
dPosteriorPredictive(obj = obj,x = xNew,LOG = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.