computePosterior {WALS} | R Documentation |
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 Magnus and De Luca (2016).
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 class 'familyPrior'
computePosterior(object, x, ...)
## S3 method for class 'familyPrior_laplace'
computePosterior(object, x, ...)
Arguments
object |
Object of class |
... |
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: |
Details
See section "Numerical integration in Bayesian estimation step" in the appendix of Huynh (2024b) 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 De Luca et al. (2020) and the
original code of Magnus and De Luca.
References
De Luca G, Magnus JR, Peracchi F (2020).
“Posterior moments and quantiles for the normal location model with Laplace prior.”
Communications in Statistics - Theory and Methods, 0(0), 1-11.
doi:10.1080/03610926.2019.1710756.
Huynh K (2024b).
“WALS: Weighted-Average Least Squares Model Averaging in R.”
University of Basel.
Mimeo.
Magnus JR, De Luca G (2016).
“Weighted-average least squares (WALS): A survey.”
Journal of Economic Surveys, 30(1), 117-148.
doi:10.1111/joes.12094.
Original MATLAB code on Jan Magnus' website. https://www.janmagnus.nl/items/WALS.pdf