fips.Posterior.leverage#

Posterior.leverage(x)[source]#

Return the leverage matrix of the state x: which observations weigh most on it.

\[L = h \left(h^T G^{-1} h\right)^{-1} h^T G^{-1}, \qquad h = H x + c, \quad G = H S_0 H^T + S_z / \gamma\]

This is the generalized-least-squares hat matrix of the one regressor \(h\), the observations that x models (predict(), which includes the offset \(c\)): the projection onto \(h\) in the metric \(G^{-1}\). It is idempotent and its trace is 1, so its diagonal shares one unit of leverage among the observations; with correlated errors an entry can be negative.

Parameters:

x (Vector) – A state, on the prior’s labels (in any order), such as estimate or the problem’s prior.

Returns:

m x m, dense, on the observations’ space.

Return type:

Operator

Raises:

ValueError – If x does not have exactly the state’s labels.