gsbBayesUpdate: Bayesian Update

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/package.r

Description

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

Usage

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

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.

Value

alpha

posterior means. Only if with.alpha = TRUE.

beta

posterior precisions.

weight

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

Note

This function is used in the function gsb().

Author(s)

Florian Gerber <[email protected]>, Thomas Gsponer

See Also

gsb

Examples

1
2
3
4
5
6
## 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)

Example output

Loading required package: gsDesign
Loading required package: xtable
Loading required package: ggplot2
Loading required package: lattice
Loading required package: grid
$beta
[1] 30

$weight
[1] 0.3333333

$alpha
[1] 8.333333 9.281250

$beta
[1] 30 32

$weight
[1] 0.3333333 0.3437500

gsbDesign documentation built on Jan. 11, 2020, 9:28 a.m.