# How to aggregate the normal distributions of two Kalman populations?

Suppose I have the following Bayesian Network: It's given by the following probability distributions:

\begin{aligned}X_1&\sim \mathcal N(\mu, \delta^2)\\ \forall i, 2\leq i\leq n: X_i|X_{i-1}&\sim \mathcal N(x_{i-1}, \lambda^2)\\ \forall i, 1\leq i\leq n: Z_i|X_i&\sim\mathcal N(x_{i}, \sigma_i^2) \end{aligned}

In the above, $$Z_i$$ is actually the mean of various observations drawn from $$X_i$$, such that the distribution of each draw is also normal and has mean $$x_i$$ and variance $$\sigma^2$$ (and therefore $$\sigma_i^2$$ is actually just $$\sigma^2 / I_i$$, where $$I_i$$ is the number of observations/draws made).

If I define:

\begin{aligned} \lambda_0^2 &= 0 \\ \delta_0^2 &= \delta^2 \\ \mu_0 &= \mu \\ \forall i, 1 \leq i \leq n : \lambda_i^2 &= \lambda^2 \\ \forall i, 1 \leq i \leq n : \delta_i^2 &= \left(\frac{I_i}{\sigma^2} + \frac {1}{\lambda_{i-1}^2 + \delta_{i-1}^2}\right)^{-1} \\ \forall i, 1 \leq i \leq n : \alpha_i &= \frac {I_i}{I_i + \sigma^2 / \left(\lambda_{i-1}^2 + \delta_{i-1}^2\right)} \\ \forall i, 1 \leq i \leq n : \mu_i &= \alpha_i * z_i + (1 - \alpha_i) * \mu_{i-1} \end{aligned}

Then it follows that:

$$\forall i, 1 \leq i \leq n : X_i | \pmb Z_{j \leq i} \sim \mathcal N (\mu_i, \delta_i^2)$$

Where $$\pmb Z_{j \leq i}$$ is the vector containing all the observations of the $$Z_j$$ up to and including $$Z_i$$. Therefore, if I want to reason about the hidden variable $$X_n$$ based on a vector of observations $$\pmb Z_{j \leq n}$$, my best point estimate for its value is the $$\mu_n$$ given by the above recursive relations.

What I want to estimate, however, is not $$X_n$$ but rather $$X_{n + 1}$$. The definition of the problem, in which the $$X_i$$ are performing a random walk, means that:

$$\mathbb E[X_{n+1}|\pmb Z_{j \leq n}] = \mathbb E[X_{n}|\pmb Z_{j \leq n}] = \mu_n$$

So this is sufficient for my purposes.

Now suppose that, for $$\Delta^2 = \delta^2$$, I have a similar Bayesian network for $$A_i$$ and $$B_i$$ with:

\begin{aligned}A_1&\sim \mathcal N(\nu, \Delta^2)\\ \forall i, 2\leq i\leq n: A_i|A_{i-1}&\sim \mathcal N(a_{i-1}, \lambda^2)\\ \forall i, 1\leq i\leq n: B_i|A_i&\sim\mathcal N(a_{i}, \sigma^2 / J_i) \end{aligned}

Then I can similarly define $$\nu_i$$ and $$\Delta_i$$ such that:

$$\forall i, 1 \leq i \leq n : A_i | \pmb B_{j \leq i} \sim \mathcal N (\nu_i, \Delta_i^2)$$

And once again, it is the case that:

$$\mathbb E[A_{n+1}|\pmb B_{j \leq n}] = \mathbb E[A_{n}|\pmb B_{j \leq n}] = \nu_n$$

If I were to combine the two populations $$Z_n$$ and $$B_n$$ to find their aggregate estimated mean, it would be given by:

$$\frac {I_n * \mu_n + J_n * \nu_n}{I_n + J_n}$$

What if, however, I want to estimate the mean of the next step of this chain, i.e. of the population of observations given by $$Z_{n+1}$$ and $$B_{n+1}$$? Is it the same? Do I have to also have a model for the evolution of the $$I_i$$ and $$J_i$$?