Learn R Programming

gsbDesign (version 1.0-3)

gsbBayesUpdate: Bayesian Update

Description

Bayesian update from prior and data to posterior for normally distributed data with known sigma.

Usage

gsbBayesUpdate(alpha, beta, meanData, precisionData, with.alpha = TRUE)

Value

alpha

posterior means. Only if with.alpha = TRUE.

beta

posterior precisions.

weight

weights of the priors relative to the whole information after updating.

Arguments

alpha

vector of prior means.

beta

vector of prior precisions.

meanData

vector of means from data.

precisionData

vector of precisions from data.

with.alpha

logical. If with.alpha = TRUE, alpha, beta, meanData and precisionData has to be specified and the posterior means, posterior precisions and weights are returned. Else only beta and precisionData has to be specified and the posterior precisions and weights are returned.

Author

Florian Gerber <florian.gerber@math.uzh.ch>, Thomas Gsponer

See Also

gsb

Examples

Run this code
## One dimensional case, with.alpha = FALSE
gsbBayesUpdate(beta=10,precisionData=20, with.alpha=FALSE)

## Two dimensional case, with.alpha = TRUE
gsbBayesUpdate(alpha=c(5,6),beta=c(10,11),meanData=c(10,11),
               precisionData=c(20,21),with.alpha=TRUE)

Run the code above in your browser using DataLab