sufficientStatistics_Weighted.GaussianInvWishart {bbricks} | R Documentation |

For following 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.

The sufficient statistics of a set of samples x (each row of x is a sample) and weights w are:

the effective number of samples N=sum(w)

the centered sample scatter matrix S = (w*(t(x)-mu))^T

## S3 method for class 'GaussianInvWishart' sufficientStatistics_Weighted(obj, x, w, foreach = FALSE, ...)

`obj` |
A "GaussianInvWishart" object. |

`x` |
matrix, Gaussian samples, when x is a matrix, each row is a sample of dimension ncol(x). when x is a vector, x is length(x) samples of dimension 1. |

`w` |
numeric, sample weights. |

`foreach` |
logical, specifying whether to return the sufficient statistics for each observation. Default FALSE. |

`...` |
Additional arguments to be passed to other inherited types. |

If foreach=TRUE, will return a list of sufficient statistics for each row of x, otherwise will return the sufficient statistics of x as a whole.

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`

, `sufficientStatistics.GaussianInvWishart`

obj <- GaussianInvWishart(gamma=list(mu=c(-1.5,1.5),v=4,S=diag(2))) x <- rGaussian(10,mu = c(-1.5,1.5),Sigma = matrix(c(0.1,0.03,0.03,0.1),2,2)) w <- runif(10) sufficientStatistics_Weighted(obj=obj,x=x,w=w,foreach = FALSE) sufficientStatistics_Weighted(obj=obj,x=x,w=w,foreach = TRUE)

[Package *bbricks* version 0.1.4 Index]