| posteriorDiscard.GaussianInvWishart | R Documentation |
For the model 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.
Contrary to posterior(), this function will update (v,S) by removing the information of observed samples x. The model structure and prior parameters are stored in a "GaussianInvWishart" object, the prior parameters in this object will be updated after running this function.
## S3 method for class 'GaussianInvWishart' posteriorDiscard(obj, ss, w = NULL, ...)
obj |
A "GaussianInvWishart" object. |
ss |
Sufficient statistics of x. In Gaussian and Inverse-Wishart case the sufficient statistic of sample x is a object of type "ssGaussianVar", it can be generated by the function sufficientStatistics(). |
w |
Sample weights, default NULL. |
... |
Additional arguments to be passed to other inherited types. |
None. the gamma stored in "obj" will be updated based on "ss".
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,posterior.GaussianInvWishart,sufficientStatistics.GaussianInvWishart
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)) ss <- sufficientStatistics(obj=obj,x=x,foreach = FALSE) obj posterior(obj=obj,ss = ss) obj posteriorDiscard(obj=obj,ss=ss) obj