Bayesian Weighted Least Squares (Bayesian WLS)

Econometrics
Introduced by
Arnold Zellner (Bayesian econometrics framework)
Year
1971
Type
Bayesian weighted regression
Family
Econometrics / time series

What does it do?

Bayesian Weighted Least Squares (Bayesian WLS) places the classical WLS weighting scheme inside a Bayesian model.

Observations with larger error variance receive less weight, and prior distributions are placed on the regression coefficients and the error variance. The output is a posterior distribution over these parameters rather than a single fitted vector, so uncertainty is reported directly.

The intuition behind the method

Classical WLS rescales observations so that noisier data points count for less, then fits a regression. Bayesian WLS uses the same rescaling but treats estimation probabilistically: instead of a single point estimate, you obtain a distribution of plausible coefficient values. Priors allow external knowledge to enter the analysis and can shrink estimates toward a prior mean. As data accumulate, the posterior becomes more concentrated and, when the prior is diffuse, moves toward the classical WLS solution. The gain is most noticeable when samples are small. When the weights are not precisely known, they can be treated as unknown parameters with their own prior (see the howItWorks section on the prior).

History

The Bayesian treatment of the normal linear regression model is closely associated with Arnold Zellner's 1971 book, An Introduction to Bayesian Inference in Econometrics. Gary Koop's 2003 textbook, Bayesian Econometrics, is a later treatment of Bayesian econometric methods for applied researchers. The weighted (heteroscedastic) form is a standard extension of the Bayesian linear model rather than a result attributed to a particular publication; Bayesian heteroscedastic regression with estimated variance scales and Gibbs sampling is treated in the spatial econometrics literature, for example in LeSage's Introduction to Spatial Econometrics.

When to use it

Use Bayesian WLS when the error variance is known or reasonably approximated to differ across observations, and you want posterior distributions for the coefficients and error variance. It is useful when the sample is small enough that the prior can meaningfully stabilise estimates, or when credible prior information exists. Prefer it over Bayesian OLS when the heteroscedasticity is substantial and the weights can be justified. If the weights are unknown, a hierarchical model for the variance scales estimated by MCMC is an option, provided informative priors on them are justified. Do not use it when the weights cannot be specified or estimated with any credibility, since the posterior then rests on an unsupported variance structure. Do not use it for data with correlated errors (such as serial or spatial dependence), where a full covariance model is needed. When the sample is large and the prior is irrelevant, classical WLS with robust standard errors is often the simpler choice. Whatever prior is chosen, examine how sensitive the posterior is to the hyperparameters, especially in small samples.

Limitations and considerations

  • The method requires the observation weights (inverse variances) to be specified in advance or estimated; if they are wrong, both the posterior mean and the credible intervals are distorted.
  • Because the weights enter only through the likelihood, a misspecified variance structure is not detected by the estimation itself and must be checked separately.
  • Under small samples, the prior can dominate the likelihood, so the posterior partly reflects the prior choice rather than the data.
  • Posterior summaries need MCMC for non-conjugate or hierarchical weight models, which adds computation and convergence checking compared with classical WLS. Estimating the weights as parameters also depends on informative priors for them.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Yields full posterior distributions for the coefficients and error variance, giving credible intervals and posterior predictive distributions instead of point estimates alone.
  • When the weights are correctly specified, the diagonal weight matrix downweights noisier observations directly in the likelihood, which can be more efficient than unweighted Bayesian OLS under heteroscedasticity; misspecified weights can make it worse.
  • The prior precision term Sigma_0^-1 pulls coefficients toward the prior mean mu_0, which stabilises estimates when predictors are collinear or the sample is small.
  • Posterior predictive checks compare replicated outcomes with observed data, providing a model-criticism step within the same framework.

Applications

  • Regression of an outcome on covariates where each observation has a known or estimated sampling variance, such as study-level estimates in a meta-regression with known standard errors.
  • Models where the measurement precision of the outcome is known to differ across units, for example survey data where respondent-level reliability varies.
  • Panel or pooled cross-sectional analyses in which the error variance differs systematically across groups, and a prior is used to stabilise group-level coefficients.

How it works

How it works

1

The outcome y is assumed to follow a Normal distribution with mean X*beta and covariance sigma^2 times W^-1, where W is the diagonal matrix of observation weights. Observations with larger assumed error variance (smaller weight) contribute less to the likelihood, which is the only place the weights enter the model.

Formula
y \mid \beta, W \sim N(X\beta,\, \sigma^2 W^{-1})
2

The conjugate choice is a Normal-Inverse-Gamma prior: beta | sigma^2 ~ N(mu_0, sigma^2 Sigma_0) and sigma^2 ~ Inverse-Gamma. The scaling of the prior covariance by sigma^2 is what makes the closed-form results below valid. Flat or diffuse priors leave the likelihood to dominate and bring the procedure close to classical WLS, while informative priors encode external information. For hyperparameters, weakly informative settings are a sensible default: choose mu_0 and the scale of Sigma_0 in relation to the units of the data (a prior standard deviation of the order of the plausible coefficient range), and keep the Inverse-Gamma prior on sigma^2 vague unless external information exists. Report how results change under alternative reasonable hyperparameters. If the weights are unknown, the relative variances v_i can be treated as parameters with a hierarchical prior, for example r/v_i ~ chi-squared(r)/r with r ~ Gamma(m,k), estimated by MCMC such as Gibbs sampling. This requires an informative prior on the v_i, because otherwise n extra parameters would be estimated from n observations.

Formula
\beta \mid \sigma^2 \sim N(\mu_0,\, \sigma^2 \Sigma_0), \quad \sigma^2 \sim \text{Inverse-Gamma}(a_0, b_0)
3

By Bayes theorem, the posterior is proportional to the weighted likelihood multiplied by the prior. With the conjugate Normal-Inverse-Gamma prior and fixed weights, beta | sigma^2, y is Normal and the marginal posterior of sigma^2 is Inverse-Gamma, both with closed-form expressions (see the inference step).

Formula
p(\beta, \sigma^2 \mid y) \propto p(y \mid \beta, \sigma^2, W)\, p(\beta, \sigma^2)
4

Under the prior beta | sigma^2 ~ N(mu_0, sigma^2 Sigma_0), the posterior mean combines the WLS data term X'Wy with the prior mean mu_0, weighted by the prior precision Sigma_0^-1. The posterior mean is therefore a matrix-weighted average of the data-based and prior-based information. With a diffuse prior, the prior term becomes negligible and the expression approaches the classical WLS estimator.

Formula
\hat{\beta}_{BWLS} = (X^\top W X + \Sigma_0^{-1})^{-1}(X^\top W y + \Sigma_0^{-1}\mu_0)
5

Under the conjugate prior, beta | sigma^2, y ~ N(m_n, sigma^2 V_n) with V_n = (X'WX + Sigma_0^-1)^-1 and m_n equal to the posterior mean in the previous step. If sigma^2 ~ Inverse-Gamma(a_0, b_0) (shape a_0, scale b_0), then sigma^2 | y ~ Inverse-Gamma(a_n, b_n) with a_n = a_0 + n/2 and b_n = b_0 + (1/2)(y'Wy + mu_0'Sigma_0^-1 mu_0 - m_n'V_n^-1 m_n). The marginal posterior of beta is a multivariate Student-t. Means, credible intervals and posterior predictive distributions follow directly. For non-conjugate priors or models with unknown weights, summaries are typically obtained by Markov Chain Monte Carlo (MCMC) sampling, and convergence must be checked before the summaries are reported.

Formula
\beta \mid \sigma^2, y \sim N(m_n,\, \sigma^2 V_n),\; V_n=(X^\top W X+\Sigma_0^{-1})^{-1},\; \sigma^2 \mid y \sim \text{IG}(a_n, b_n),\; a_n=a_0+\tfrac{n}{2},\; b_n=b_0+\tfrac12\left(y^\top W y+\mu_0^\top\Sigma_0^{-1}\mu_0-m_n^\top V_n^{-1}m_n\right)

Common pitfalls

  • Using flat (improper) priors and reading the posterior mean as a frequentist estimator. Numerically it equals the WLS estimate, but the credible intervals do not carry frequentist coverage guarantees. The posterior is also proper only if X'WX has full rank (which requires n > k); check this before reporting credible intervals.
  • Fixing the weights at assumed values without sensitivity analysis. If the variance structure is misspecified, the estimates and the credible intervals will both be misleading.
  • Reporting posterior summaries from MCMC output without checking convergence diagnostics such as trace plots and the Gelman-Rubin R-hat statistic.
  • Confusing Bayesian WLS with Bayesian GLS. WLS uses a diagonal weight matrix and assumes uncorrelated errors, whereas GLS models a full error covariance matrix with off-diagonal terms, for example for spatial or serial correlation.
  • Applying Bayesian WLS to time-series data without modelling autocorrelation. In that setting, Bayesian GLS or an ARMA-type error structure is the appropriate extension.
  • Treating prior hyperparameters as innocuous defaults. Report results under alternative reasonable priors, particularly when the sample is small.

Frequently asked questions

How do I choose the weights in Bayesian WLS?

Weights should be the inverse of each observation's error variance. They may come from known sampling variances (as in meta-analysis), from a first-stage variance model, or from theoretical considerations. Because the weights are not usually known exactly, sensitivity analysis over plausible weight specifications is recommended. Alternatively, the variance scales can be treated as unknown parameters with a hierarchical prior and estimated by MCMC.

What is the difference between Bayesian WLS and Bayesian GLS?

WLS uses a diagonal weight matrix, assuming errors are uncorrelated across observations but may have different variances. GLS uses a full covariance matrix, which also allows for correlation such as autocorrelation or spatial dependence. If the errors are both heteroscedastic and correlated, Bayesian GLS is the more general choice.

Do I need MCMC or can I use an analytical posterior?

With conjugate Normal-Inverse-Gamma priors and fixed weights, the posterior has a closed form and MCMC is not required. Non-conjugate priors or extended variance models, such as a hierarchical weight model, generally require MCMC or variational methods.

How does Bayesian WLS differ from robust regression?

Robust regression, including Bayesian versions with heavy-tailed likelihoods, reduces the influence of outliers according to residual size. Bayesian WLS uses weights that reflect known or estimated heteroscedasticity and does not respond to residual magnitude. The two address different problems and can be combined.

When does the prior matter most?

The prior has the most influence when the sample is small, when there are many predictors relative to observations, or when the likelihood is weakly informative about the parameters. With large, information-rich datasets, the likelihood tends to dominate and the estimates move toward the classical WLS values regardless of the prior.

How should I choose prior hyperparameters?

Use weakly informative settings scaled to the data: centre mu_0 on a plausible value (often zero for standardised predictors), set Sigma_0 so that the prior spread covers plausible coefficient values in the units of the data, and keep the Inverse-Gamma prior on sigma^2 vague unless external information exists. Then report how the posterior changes under alternative reasonable choices.

Related methods

Sources

  1. Zellner, A. (1971). An Introduction to Bayesian Inference in Econometrics. Wiley, New York.

    ISBN: 978-0471169376
  2. Koop, G. (2003). Bayesian Econometrics. Wiley, Chichester.

    ISBN: 978-0470845677