Simple Averaging
Problem Formulation
Consider a simple averaging problem as shown in Figure 1. Let \(x \in \mathbb{R}\) be a constant hidden variable to be estimated and \(z_i\) be multiple measurements. Assume all measurements are perturbed by noise \(\mathcal{N}(0, \sigma = 1)\).
Solving with Factor Graph
Denote the measurement vector as \(\mathbf{z} \in \mathbb{R}^n\). Then the measurement equation is:
\[
\mathbf{z} = \mathbf{L} x + \boldsymbol{\epsilon}.
\]
The adjacency matrix \(\mathbf{L} \in \mathbb{R}^n\) will have a single column and \(n\) rows since no dynamics is involved and \(x\) is assumed to be a constant:
\[
\mathbf{L} =
\left[
\begin{array}{cccc}
1 & 1 & \cdots & 1
\end{array}
\right]^T.
\]
The pseudo-inverse of \(\mathbf{L}\) is:
\[
\begin{align}
\mathbf{L}^{\dagger} = \left(\mathbf{L}^T \mathbf{L} \right)^{-1} \mathbf{L}^T = \frac{1}{n}
\left[
\begin{array}{cccc}
1 & 1 & \cdots & 1
\end{array}
\right].
\end{align}
\]
Then we have an estimator:
\[
\hat{x} = \mathbf{L}^{\dagger} \mathbf{z}.
\]