posteriorDiscard.LinearGaussianGaussian: Update a "LinearGaussianGaussian" object with sample...

Description Usage Arguments Value References See Also Examples

View source: R/Gaussian_Inference.r

Description

For following model structure:

x \sim Gaussian(A z + b, Sigma)

z \sim Gaussian(m,S)

Where Sigma is known. A is a dimx x dimz matrix, x is a dimx x 1 random vector, z is a dimz x 1 random vector, b is a dimm x 1 vector. Gaussian() is the Gaussian distribution. See ?dGaussian for the definition of Gaussian distribution.
Contrary to posterior(), this function will update (m,S) by removing the information of observed samples x. The model structure and prior parameters are stored in a "LinearGaussianGaussian" object, the prior parameters in this object will be updated after running this function.

Usage

1
2
## S3 method for class 'LinearGaussianGaussian'
posteriorDiscard(obj, ss, ...)

Arguments

obj

A "LinearGaussianGaussian" object.

ss

Sufficient statistics of x. In Gaussian-Gaussian case the sufficient statistic of sample x is a object of type "ssLinearGaussianGaussian", it can be generated by the function sufficientStatistics().

...

Additional arguments to be passed to other inherited types.

Value

None. the gamma stored in "obj" will be updated based on "ss".

References

Murphy, Kevin P. Machine learning: a probabilistic perspective. MIT press, 2012.

See Also

LinearGaussianGaussian,posterior.LinearGaussianGaussian,sufficientStatistics.LinearGaussianGaussian

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
obj <- LinearGaussianGaussian(gamma=list(Sigma=matrix(c(2,1,1,2),2,2),
                              m=c(0.2,0.5,0.6),S=diag(3)))
x <- rGaussian(100,mu = runif(2),Sigma = diag(2))
A <- matrix(runif(6),2,3)
b <- runif(2)
ss <- sufficientStatistics(obj,x=x,A=A,b=b)
obj
## update prior into posterior
posterior(obj=obj,ss=ss)
obj
## remove the information, back to prior
posteriorDiscard(obj = obj,ss = ss)
obj

bbricks documentation built on July 8, 2020, 7:29 p.m.