Risk-Aware Utility: Gaussian Posterior Expressions

PyApprox Tutorial Library

Closed-form derivations of posterior mean distribution, entropic risk deviation, and AVaR deviation for Gaussian push-forwards in Bayesian linear regression.

Learning Objectives

After completing this tutorial, you will be able to:

  • Derive the joint distribution of the posterior mean as a Gaussian random variable
  • Show that the entropic risk deviation of the push-forward QoI is deterministic
  • Derive the AVaR deviation and its expected value for Gaussian posteriors
  • Explain why all risk deviation expressions are independent of the specific observation realization (for linear Gaussian models)

Prerequisites

Complete Goal-Oriented Bayesian OED before this tutorial.

Model and Notation

We work with the linear Gaussian model from Bayesian OED: The Double-Loop Estimator. The prior is \(\boldsymbol{\theta} \sim \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma})\), the likelihood is \(\mathbf{y} \mid \boldsymbol{\theta}, \mathbf{w} \sim \mathcal{N}(\boldsymbol{\Phi}\boldsymbol{\theta}, \boldsymbol{\Gamma})\) (with \(\boldsymbol{\Phi} \in \mathbb{R}^{K \times D}\) the Vandermonde matrix), and the QoI is \(Q = \boldsymbol{\psi}^\top \boldsymbol{\theta}\) for a row vector \(\boldsymbol{\psi} \in \mathbb{R}^{1 \times D}\).

Posterior Distribution

The posterior is \(\boldsymbol{\theta} \mid \mathbf{y}, \mathbf{w} \sim \mathcal{N}(\boldsymbol{\mu}_\star, \boldsymbol{\Sigma}_\star)\) where:

\[ \boldsymbol{\Sigma}_\star = \left(\boldsymbol{\Sigma}^{-1} + \boldsymbol{\Phi}^\top \boldsymbol{\Gamma}^{-1} \boldsymbol{\Phi}\right)^{-1}, \quad \boldsymbol{\mu}_\star = \boldsymbol{\Sigma}_\star \!\left(\boldsymbol{\Phi}^\top \boldsymbol{\Gamma}^{-1} \mathbf{y} + \boldsymbol{\Sigma}^{-1} \boldsymbol{\mu}\right). \]

The posterior covariance \(\boldsymbol{\Sigma}_\star\) is independent of the observation \(\mathbf{y}\). The posterior mean \(\boldsymbol{\mu}_\star\) is not.

Distribution of the Posterior Mean

Writing \(\boldsymbol{\mu}_\star\) explicitly in terms of \(\mathbf{y} = \boldsymbol{\Phi}\boldsymbol{\theta} + \boldsymbol{\epsilon}\):

\[ \boldsymbol{\mu}_\star \mid \boldsymbol{\theta}, \boldsymbol{\epsilon} = \mathbf{R}\boldsymbol{\Phi}\boldsymbol{\theta} + \mathbf{R}\boldsymbol{\epsilon} + \boldsymbol{\Sigma}_\star \boldsymbol{\Sigma}^{-1} \boldsymbol{\mu}, \quad \mathbf{R} = \boldsymbol{\Sigma}_\star \boldsymbol{\Phi}^\top \boldsymbol{\Gamma}^{-1}. \]

Since \(\boldsymbol{\theta}\) and \(\boldsymbol{\epsilon}\) are independent Gaussians, \(\boldsymbol{\mu}_\star\) is a Gaussian random variable:

\[ \boldsymbol{\mu}_\star \sim \mathcal{N}(\boldsymbol{\nu}, \mathbf{C}), \]

where:

\[ \boldsymbol{\nu} = \mathbf{R}\boldsymbol{\Phi}\boldsymbol{\mu} + \boldsymbol{\Sigma}_\star \boldsymbol{\Sigma}^{-1}\boldsymbol{\mu}, \quad \mathbf{C} = \mathbf{R}\boldsymbol{\Phi}\boldsymbol{\Sigma}(\mathbf{R}\boldsymbol{\Phi})^\top + \mathbf{R}\boldsymbol{\Gamma}\mathbf{R}^\top. \]

Push-Forward Through the QoI Map

The posterior push-forward of \(Q = \boldsymbol{\psi}^\top \boldsymbol{\theta}\) conditioned on \(\mathbf{y}\) is:

\[ Q \mid \mathbf{y} \sim \mathcal{N}\!\left( \boldsymbol{\psi}\boldsymbol{\mu}_\star,\; \boldsymbol{\psi}\boldsymbol{\Sigma}_\star\boldsymbol{\psi}^\top \right). \]

The variance \(\sigma_Q^2 := \boldsymbol{\psi}\boldsymbol{\Sigma}_\star\boldsymbol{\psi}^\top\) is constant (no dependence on \(\mathbf{y}\)). The mean \(\boldsymbol{\psi}\boldsymbol{\mu}_\star\) is Gaussian with mean \(\boldsymbol{\psi}\boldsymbol{\nu}\) and variance \(\boldsymbol{\psi}\mathbf{C}\boldsymbol{\psi}^\top\).

Entropic Risk Deviation

The entropic risk of \(Q \mid \mathbf{y}\) with risk-aversion \(\lambda > 0\) is:

\[ \mathcal{R}_\lambda(Q \mid \mathbf{y}) = \boldsymbol{\psi}\boldsymbol{\mu}_\star + \frac{\lambda}{2}\boldsymbol{\psi}\boldsymbol{\Sigma}_\star\boldsymbol{\psi}^\top. \]

The deviation \(\mathcal{D} = \mathcal{R} - \mathbb{E}[Q \mid \mathbf{y}]\) subtracts the posterior mean:

\[ \mathcal{D}_\lambda(Q \mid \mathbf{y}) = \frac{\lambda}{2}\boldsymbol{\psi}\boldsymbol{\Sigma}_\star\boldsymbol{\psi}^\top = \frac{\lambda}{2}\sigma_Q^2. \]

This is deterministic — independent of \(\mathbf{y}\) and hence of the specific observation realization. Therefore:

\[ \mathbb{E}\!\left[\mathcal{D}_\lambda(Q \mid \mathbf{y})\right] = \frac{\lambda}{2}\boldsymbol{\psi}\boldsymbol{\Sigma}_\star\boldsymbol{\psi}^\top. \]

NoteImplication for optimization

Because the entropic risk deviation is a deterministic function of the posterior covariance, optimizing over \(\mathbf{w}\) reduces to finding weights that minimize \(\boldsymbol{\psi}\boldsymbol{\Sigma}_\star(\mathbf{w})\boldsymbol{\psi}^\top\). No Monte Carlo approximation is needed for this specific risk measure.

AVaR Deviation

The Average Value at Risk (AVaR) at level \(p \in (0,1)\) of a \(\mathcal{N}(\mu, \sigma^2)\) random variable is:

\[ \mathrm{AVaR}_p(X) = \mu + \sigma \cdot \frac{\phi(\Phi^{-1}(p))}{1 - p}, \]

where \(\phi\) and \(\Phi^{-1}\) are the standard normal PDF and quantile function.

The AVaR deviation is:

\[ \mathcal{D}_p(Q \mid \mathbf{y}) = \mathrm{AVaR}_p(Q \mid \mathbf{y}) - \mathbb{E}[Q \mid \mathbf{y}] = \sqrt{\boldsymbol{\psi}\boldsymbol{\Sigma}_\star\boldsymbol{\psi}^\top} \cdot \frac{\phi(\Phi^{-1}(p))}{1 - p}. \]

This is again deterministic, depending on \(\mathbf{y}\) only through the fixed posterior variance \(\sigma_Q^2\). The expected AVaR deviation is:

\[ \mathbb{E}\!\left[\mathcal{D}_p(Q \mid \mathbf{y})\right] = \sqrt{\boldsymbol{\psi}\boldsymbol{\Sigma}_\star\boldsymbol{\psi}^\top} \cdot \frac{\phi(\Phi^{-1}(p))}{1 - p}. \]

Standard Deviation Deviation

For completeness, the standard deviation deviation (which corresponds to \(\mathcal{D}(X) = \mathrm{Std}(X)\) with no shift) is simply:

\[ \mathcal{D}_\mathrm{std}(Q \mid \mathbf{y}) = \sqrt{\boldsymbol{\psi}\boldsymbol{\Sigma}_\star\boldsymbol{\psi}^\top} = \sigma_Q. \]

This is the simplest deviation measure and is used as the benchmark in the verification tutorial.

Numerical Verification

We verify the analytical expressions against Monte Carlo estimates.

import numpy as np
from scipy.stats import norm
from pyapprox.util.backends.numpy import NumpyBkd
from pyapprox.expdesign.analytical import (
    ConjugateGaussianOEDExpectedStdDev,
    ConjugateGaussianOEDExpectedAVaRDev,
)

np.random.seed(42)
bkd = NumpyBkd()

# Build a small linear Gaussian problem
nobs, degree, noise_std, prior_std = 3, 2, 0.5, 0.5
from pyapprox.expdesign.benchmarks.linear_gaussian import _build_vandermonde

obs_locations = bkd.linspace(-1.0, 1.0, nobs)
A = _build_vandermonde(obs_locations, 0, degree, bkd)
nparams = A.shape[1]

prior_mean = bkd.zeros((nparams, 1))
prior_cov = bkd.eye(nparams) * prior_std ** 2
noise_cov = bkd.eye(nobs) * noise_std ** 2

# QoI matrix: single prediction point
qoi_location = bkd.asarray([0.5])
psi = _build_vandermonde(qoi_location, 0, degree, bkd)  # (1, nparams)

weights = bkd.ones((nobs, 1)) / nobs

# Compute effective noise covariance
w_flat = bkd.reshape(weights, (nobs,))
eff_noise_cov = bkd.diag(noise_std**2 / w_flat)

# Analytical std deviation
util_std = ConjugateGaussianOEDExpectedStdDev(prior_mean, prior_cov, psi, bkd)
util_std.set_observation_matrix(A)
util_std.set_noise_covariance(eff_noise_cov)
sigma_Q = util_std.value()
print(f"Analytical std deviation: {sigma_Q:.6f}")

# AVaR deviation at p=0.9
p = 0.9
util_avar = ConjugateGaussianOEDExpectedAVaRDev(
    prior_mean, prior_cov, psi, p, bkd,
)
util_avar.set_observation_matrix(A)
util_avar.set_noise_covariance(eff_noise_cov)
avar_dev_analytical = util_avar.value()
print(f"AVaR deviation (p={p}): {avar_dev_analytical:.6f}")

# Verify AVaR deviation formula
avar_formula = sigma_Q * norm.pdf(norm.ppf(p)) / (1 - p)
print(f"AVaR formula check:     {avar_formula:.6f}")
Analytical std deviation: 0.404601
AVaR deviation (p=0.9): 0.710068
AVaR formula check:     0.710068

Key Takeaways

  • The posterior mean \(\boldsymbol{\mu}_\star\) is a Gaussian random variable; its distribution is fully determined by \(\mathbf{R}\), the prior, and the noise.
  • For linear Gaussian models, entropic risk, AVaR, and standard deviation deviations of the push-forward are all deterministic — they depend on \(\mathbf{y}\) only through \(\boldsymbol{\Sigma}_\star\), which is observation-independent.
  • This means the expected deviation equals the deviation itself, simplifying the optimization problem.
  • Numerical verification against these closed forms is the basis of the usage tutorial.

Exercises

  1. Show that \(\mathbb{E}[\boldsymbol{\mu}_\star] = \boldsymbol{\mu}\) (the mean of the posterior mean equals the prior mean).

  2. Verify that \(\mathbb{V}[\boldsymbol{\psi}\boldsymbol{\mu}_\star] = \boldsymbol{\psi}\mathbf{C}\boldsymbol{\psi}^\top\) reduces to \(\boldsymbol{\psi}\boldsymbol{\Sigma}\boldsymbol{\psi}^\top\) as \(\boldsymbol{\Gamma} \to 0\) (noiseless observations).

  3. For \(p \to 1^-\), what happens to the AVaR deviation? Interpret this result.

Next Steps