Let’s say I have a state space model, whose parameter/model posteriors are relative to the current time step T.
Now, let’s say I receive a new observation at T+1. How do I update the model/posteriors relative to this new observation, without running the whole thing again?
I know if certain conditions hold (linearity, normal errors), then we have something akin to a Kalman filter, where we have an “update” step we can complete simply via some matrix algebra.
Here’s a toy example below:
data {
int<lower=1> T; // Number of time points
real y[T]; // Observations (T observations)
real A; // State transition coefficient
real B; // Observation model coefficient
}
parameters {
real x0; // Initial state
real<lower=0> sigma_state; // State noise standard deviation
real<lower=0> sigma_obs; // Observation noise standard deviation
real x[T]; // Latent states (T states)
}
model {
// Prior distributions
x0 ~ normal(0, 1); // Prior for the initial state
sigma_state ~ normal(0, 1); // Prior for state noise
sigma_obs ~ normal(0, 1); // Prior for observation noise
// State transition model
x[1] ~ normal(A * x0, sigma_state); // Transition from x0 to x1
for (t in 2:T) {
x[t] ~ normal(A * x[t - 1], sigma_state); // State evolution over time
}
// Observation model
for (t in 1:T) {
y[t] ~ normal(B * x[t], sigma_obs); // Observation based on latent state
}
}
How would one handle a new piece of information at y_{T+1}, in order to update our state variables x_{T+1}?
What if there is no clear “update” step?