Description Usage Arguments Value References See Also Examples
View source: R/Gaussian_Inference.r
For following model structure:
x \sim Gaussian(mu,Sigma)
mu \sim Gaussian(m,S)
Where Sigma is known. Gaussian() is the Gaussian distribution. See ?dGaussian
for the definition of Gaussian distribution.
The sufficient statistics of a set of samples x (each row of x is a sample) are:
the effective number of samples N=nrow(x)
the sample sum xsum = colSums(x)
1 2 | ## S3 method for class 'GaussianGaussian'
sufficientStatistics(obj, x, foreach = FALSE, ...)
|
obj |
A "GaussianGaussian" 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. |
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.
GaussianGaussian
, sufficientStatistics_Weighted.GaussianGaussian
1 2 3 4 | obj <- GaussianGaussian(gamma=list(Sigma=matrix(c(2,1,1,2),2,2),m=c(0.2,0.5),S=diag(2)))
x <- rGaussian(100,c(0,0),Sigma = matrix(c(2,1,1,2),2,2))
sufficientStatistics(obj = obj,x=x)
sufficientStatistics(obj = obj,x=x,foreach=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.