rPosterior: Generate random samples from the posterior distribution

Description Usage Arguments Value See Also

View source: R/Bayesian_Bricks.r

Description

This is a generic function that will generate random samples from the posterior distribution. i.e. for the model structure:

theta|gamma \sim H(gamma)

x|theta \sim F(theta)

generate random sampels of theta from the distribution theta \sim H(gamma). For a given Bayesian bricks object obj, rPosterior() will generate random samples for different model structures:

class(obj)="LinearGaussianGaussian"

Where

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

z \sim Gaussian(m,S)

rPosterior() will generate random samples from Gaussian(m,S) See ?rPosterior.LinearGaussianGaussian for details.

class(obj)="GaussianGaussian"

Where

x \sim Gaussian(mu,Sigma)

mu \sim Gaussian(m,S)

Sigma is known. rPosterior() will generate random samples from Gaussian(m,S) See ?rPosterior.GaussianGaussian for details.

class(obj)="GaussianInvWishart"

Where

x \sim Gaussian(mu,Sigma)

Sigma \sim InvWishart(v,S)

mu is known. rPosterior() will generate random samples from InvWishart(v,S) See ?rPosterior.GaussianInvWishart for details.

class(obj)="GaussianNIW"

Where

x \sim Gaussian(mu,Sigma)

Sigma \sim InvWishart(v,S)

mu \sim Gaussian(m,Sigma/k)

rPosterior() will generate random samples from NIW(m,k,v,S) See ?rPosterior.GaussianNIW for details.

class(obj)="GaussianNIG"

Where

x \sim Gaussian(X beta,sigma^2)

sigma^2 \sim InvGamma(a,b)

beta \sim Gaussian(m,sigma^2 V)

X is a row vector, or a design matrix where each row is an obervation. rPosterior() will generate random samples from NIG(m,V,a,b) See ?rPosterior.GaussianNIG for details.

class(obj)="CatDirichlet"

Where

x \sim Categorical(pi)

pi \sim Dirichlet(alpha)

rPosterior() will generate random samples from Dirichlet(alpha) See ?rPosterior.CatDirichlet for details.

Usage

1

Arguments

obj

A "BayesianBrick" object used to select a method.

...

further arguments passed to or from other methods.

Value

numeric, the density value

See Also

rPosterior.LinearGaussianGaussian for Linear Gaussian and Gaussian conjugate structure, rPosterior.GaussianGaussian for Gaussian-Gaussian conjugate structure, rPosterior.GaussianInvWishart for Gaussian-Inverse-Wishart conjugate structure, rPosterior.GaussianNIW for Gaussian-NIW conjugate structure, rPosterior.GaussianNIG for Gaussian-NIG conjugate structure, rPosterior.CatDirichlet for Categorical-Dirichlet conjugate structure ...


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