Learn R Programming

WALS (version 0.2.5)

computePosterior: Internal function: Compute posterior mean and variance of normal location problem

Description

Computes the posterior mean and variance of the normal location problem with fixed variance to 1, i.e. \(x | \gamma \sim N(\gamma, 1)\). The priors for \(\gamma\) are either weibull, subbotin or laplace. Their properties are briefly discussed in magnus2016wals;textualWALS. Default method of computePosterior uses numerical integration. This is used for the weibull and subbotin priors. For the laplace prior closed form expressions exist for the integrals. In the original MATLAB code, the Gauss-Kronrod quadrature was used for numerical integration. Here we use the default integrate which combines Gauss-Kronrod with Wynn's Epsilon algorithm for extrapolation.

Usage

computePosterior(object, ...)

# S3 method for familyPrior computePosterior(object, x, ...)

# S3 method for familyPrior_laplace computePosterior(object, x, ...)

Arguments

object

Object of class "familyPrior", e.g. from weibull, should contain all necessary parameters needed for the posterior.

...

Further arguments passed to methods.

x

vector. Observed values, i.e. in WALS these are the regression coefficients of the transformed regressor Z2 standardized by the standard deviation: \(\gamma_{2u} / s\).

Details

See section "Numerical integration in Bayesian estimation step" in the appendix of huynhwals;textualWALS for details.

computePosterior.familyPrior_laplace() is the specialized method for the S3 class "familyPrior_laplace" and computes the posterior first and second moments of the normal location problem with a Laplace prior using the analytical formula (without numerical integration). For more details, see deluca2020laplace;textualWALS and the original code of Magnus and De Luca.

References

Original MATLAB code on Jan Magnus' website. https://www.janmagnus.nl/items/WALS.pdf