rPosteriorPredictive.LinearGaussianGaussian: Generate random samples from the posterior predictive...

Description Usage Arguments Value References See Also Examples

View source: R/Gaussian_Inference.r

Description

Generate random samples from the posterior predictive distribution of the following 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.
The model structure and prior parameters are stored in a "LinearGaussianGaussian" object.
Posterior predictive is a distribution of x|m,S,A,b,Sigma.

Usage

1
2
## S3 method for class 'LinearGaussianGaussian'
rPosteriorPredictive(obj, n = 1, A, b = NULL, ...)

Arguments

obj

A "LinearGaussianGaussian" object.

n

integer, number of samples.

A

matrix or list. when you want the random samples x to be a n x 1 matrix, A must be a matrix of n x dimz, dimz is the dimension of z; When you want the random samples x to be a N x dimx matrix, where dimx > 1, A can be either a list or a matrix. When A is a list, A = {A_1,A_2,...A_N} is a list of dimx x dimz matrices. If A is a single dimx x dimz matrix, it will be replicated N times into a length N list.

b

matrix, when you want the random samples x to be a N x 1 matrix, b must also be a N x 1 matrix or length N vector; When you want x to be a N x dimx matrix, where dimx > 1, b can be either a matrix or a vector. When b is a matrix, b={b_1^T,...,b_N^T} is a N x dimx matrix, each row is a transposed vector. When b is a length dimx vector, it will be transposed into a row vector and replicated N times into a N x dimx matrix. When b = NULL, it will be treated as a vector of zeros. Default NULL.

...

Additional arguments to be passed to other inherited types.

Value

A matrix of n rows, each row is a sample.

References

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

See Also

LinearGaussianGaussian, dPosteriorPredictive.LinearGaussianGaussian

Examples

1
2
3
4
5
obj <- LinearGaussianGaussian(gamma=list(Sigma=matrix(c(2,1,1,2),2,2),
                                         m=c(0.2,0.5,0.6),S=diag(3)))
A <- matrix(runif(6),2,3)
b <- runif(2)
rPosteriorPredictive(obj = obj,n=20,A=A,b=b)

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