Nonlinear State-Space Models

36-740

22 September 2026 (Lecture 9)

\[ \newcommand{\Prob}[1]{\mathbb{P}\left( #1 \right)} \newcommand{\Expect}[1]{\mathbb{E}\left[ #1 \right]} \newcommand{\Var}[1]{\mathrm{Var}\left[ #1 \right]} \newcommand{\SampleVar}[1]{\widehat{\mathrm{Var}}\left[ #1 \right]} \newcommand{\Cov}[1]{\mathrm{Cov}\left[ #1 \right]} \newcommand{\TrueRegFunc}{\mu} \newcommand{\EstRegFunc}{\widehat{\TrueRegFunc}} \DeclareMathOperator{\tr}{tr} \DeclareMathOperator*{\argmin}{argmin} \DeclareMathOperator*{\argmax}{argmax} \DeclareMathOperator{\det}{det} \DeclareMathOperator{\dim}{dim} \newcommand{\TrueNoise}{\epsilon} \newcommand{\EstNoise}{\widehat{\TrueNoise}} \newcommand{\Signal}{S} \newcommand{\SignalNoise}{N} \newcommand{\AutoCov}{\gamma} \newcommand{\NoiseAutoCov}{\xi} \newcommand{\LinearExpect}[1]{\mathbb{L}\left[ #1 \right]} \newcommand{\Periodicity}{\tau} \newcommand{\Loadings}{\mathbf{b}} \newcommand{\FactorNoise}{\epsilon} \newcommand{\Uniqueness}{\mathbf{\psi}} \newcommand{\AltLoadings}{\mathbf{c}} \newcommand{\AltFactorNoise}{\zeta} \newcommand{\AltUniqueness}{\mathbf{\rho}} \newcommand{\DynMatrix}{\mathbf{a}} \newcommand{\DynNoise}{\eta} \newcommand{\DynVar}{\xi} \newcommand{\KalmanGain}{\mathbf{K}} \newcommand{\indep}{\perp} \newcommand{\Neighborhood}{\partial} \]

Previously

As you know

Markov Property vs. Measurement Noise

A Concrete Example

The Current State “Screens Off” the Past from the Future

\(\Prob{X(t+1)=x(t+1)|S(t)=s, X(1:t)=x(1:t)}\) \[\begin{eqnarray} & = & \sum_{r}{\Prob{X(t+1)=x(t+1)|S(t+1)=r, S(t)=s, X(1:t)=x(1:t)}}\\ \nonumber & & {\Prob{S(t+1)=r|S(t)=s,X(1:t)=x(1:t)}}\\ & = & \sum_{r}{\Prob{X(t+1)|S(t+1)=r}\Prob{S(t+1)=r|S(t)=s}} \end{eqnarray}\]

Relating \(X(t)\) to Its Past through the State

\(\Prob{X(t+1)=x(t+1)|X(1:t)=x(1:t)}\) \[\begin{eqnarray} & = & \sum_{s}{\Prob{X(t+1)=x(t+1)|S(t)=s,X(1:t)=x(1:t)}\Prob{S(t)=s|X(1:t)=x(1:t)}}\\ & = & \sum_{s}{\left(\sum_{r}{\Prob{X(t+1)|S(t+1)=r}\Prob{S(t+1)=r|S(t)=s}}\right) \Prob{S(t)=s|X(1:t)=x(1:t)}} \end{eqnarray}\]

\(\Rightarrow\) The only way \(X(t-h)\) can matter for \(X(t+1)\) is by changing the conditional distribution of \(S(t)\)

Relating \(X(t)\) to \(S(t)\)

History Matters for \(X(t)\)

Hidden Markov Models / State-Space Models

(for continuous variables, replace PMFs by pdfs as needed)

Some Basic Calculations for HMMs

Why We Want the Probability of an Observation Sequence

\[ \Prob{X(1:n)=x(1:n)} = \sum_{s(1:n)}{ \Prob{S(1)=s(1)} \prod_{t=2}^{n}{q(s(t-1), s(t))}\prod_{t=1}^{n}{g(s(t), x(t))}} \]

A Recursion Trick (a.k.a. “The Forward Algorithm”) [1]

A Recursion Trick (a.k.a. “The Forward Algorithm”) [2]

A Recursion Trick (a.k.a. “The Forward Algorithm”) [3]

The Forward Algorithm

Back to the Likelihood

Actually Doing the Calculations

The Particle Filter: Words

The Particle Filter

  1. At \(t=1\), make \(m\) independent draws \(S^*_1, S^*_2, \ldots S^*_m\) from \(\Prob{S(1)}\)
    • These are the particles
  2. For each \(S^*_i\), calculate \(g(S^*_i, x(t)) \equiv w_{i}\)
    • \(\Prob{X(t)=x(t)|X(1:t-1)=x(1:t-1)} \approx m^{-1} \sum_{i=1}^{m}{w_i}\)
  3. Resample the particles: draw \(m\) of them, with replacement, from \(S^*\), with probabilities \(\propto w_i\); call these \(\tilde{S}_1, \tilde{S}_2, \ldots \tilde{S}_m\)
  4. Set \(\hat{F}_t\) to the sample distribution of the \(\tilde{S}\)
    • The distribution of the resampled particles approximates \(\Prob{S(t)|X(1:t)=x(1:t)}\)
  5. Increment \(t\) by 1, and evolve the particles forward in time: for each \(\tilde{S}_i\), draw \(S^*_i\) from \(q(\tilde{S}_i, S^*_i)\)
    • Distribution of the new \(S^*\) approximates \(\Prob{S(t+1)|X(1:t)=x(1:t)}\).
  6. Go to (2)

The Particle Filter: Code

particle.filter <- function(x, rinitial, rtransition, dobs, m) {
    n <- length(x)
    particles <- replicate(m, rinitial())
    particle.history <- matrix(0, nrow = m, ncol = n)
    for (t in 1:n) {
        weights <- dobs(state = particles, observation = x[t])
        particles <- sample(particles, size = m, replace = TRUE, prob = weights)
        particle.history[, t] <- particles
        particles <- sapply(particles, rtransition)
    }
    return(particle.history)
}

The Particle Filter: For Our Little Demo

sim.pf <- particle.filter(x=sim$x,
                          rinitial=function() { sample(-1,+1, size=1) },
                          rtransition=function (x) {
                              stay <- sample(c(TRUE, FALSE), size=1, prob=c(0.75, 0.25))
                              if (stay) { return(x) }
                              if (!stay) { return(-x) }
                          },
                          dobs=function(state, observation) {
                              dnorm(x=observation, mean=state, sd=1)
                          },
                          m=100)

The Particle Filter: Run on Our Little Demo

Issues with the Particle Filter

  1. Monte Carlo error: really want \(m\) to be as large as possible
    • But it costs computing time
    • Error is \(O(1/\sqrt{m})\) so diminishing returns
  2. “Particle collapse”: if one \(w_i \gg w_j\) for all the other \(j\), then (almost) all new particles are copies of \(S^*_i\) and the approximation is bad
    • Lots of hacks around this
  3. What if we don’t know transitions \(q\) or observation probabilities \(g\)?

Alternatives to the particle filter

Parameter Estimation

What About Space?

What About Space-Time?

State-Space Reconstruction / “Geometry from a Time Series”

State-Space Reconstruction (cont’d.)

Vectors $(X(t), X(t+1), X(t+2))$, color-coded by the value of the initial condition $S(t)$.

Vectors \((X(t), X(t+1), X(t+2))\), color-coded by the value of the initial condition \(S(t)\).

State-Space Reconstruction (cont’d.)

Whitney embedding theorem: Suppose \(\dim{\mathcal{M}} = d\), and each coordinate of \(h: \mathcal{M} \mapsto \mathbb{R}^{k}\) is \(\mathcal{C}^1\). Then once \(k \geq 2d+1\), the typical \(h\) is a diffeomorphism, a differentiable mapping with a differentiable inverse

Takens embedding theorem: Suppose \(S(t)\) is on a \(d\)-dimensional manifold, we observe \(X(t) = b(S(t))\), and for the time-delay vector \(Y(t) = (X(t), X(t-\tau), \ldots X(t-(k-1)\tau))\). Then for typical choices of \(b\) and \(\tau\), \(Y(t)\) is diffeomorphic to \(S(t)\), once \(k \geq 2d+1\).

State-Space Reconstruction (cont’d.)

State-Space Reconstruction (cont’d.)

Summing Up

Many more details in the handout on the website

Backup: The Gibbs Sampler

Backup: The Gibbs Sampler: History

Backup: Iterated Conditional Modes

Backup: Iterated Conditional Modes (cont’d.)

\[ \Prob{S(r)=s|X(r)=x, S(\Neighborhood(r)) = q} \propto g(x|s) p(s|q) \]

The algorithm

References

Besag, Julian. 1986. “On the Statistical Analysis of Dirty Pictures.” Journal of the Royal Statistical Society B 48:259–302. https://www.jstor.org/stable/2345426.

Geman, Stuart, and Donald Geman. 1984. “Stochastic Relaxation, Gibbs Distributions, and the Bayesian Restoration of Images.” IEEE Transactions on Pattern Analysis and Machine Intelligence 6:721–41. https://doi.org/10.1109/TPAMI.1984.4767596.

Griffeath, David. 1976. “Introduction to Markov Random Fields.” In Denumerable Markov Chains, edited by John G. Kemeny, J. Laurie Snell, and Anthony W. Knapp, Second, 425–57. Berlin: Springer-Verlag.

Kantz, Holger, and Thomas Schreiber. 2004. Nonlinear Time Series Analysis. Second. Cambridge, England: Cambridge University Press.

Kaplan, Andee, Mark S. Kaiser, Soumendra N. Lahiri, and Daniel J. Nordman. 2019. “Simulating Markov Random Fields with a Conclique-Based Gibbs Sampler.” Journal of Computational and Graphical Statistics 29. https://doi.org/10.1080/10618600.2019.1668800.

Koyama, Shinsuke, Lucia Castellanos Pérez-Bolde, Cosma Rohilla Shalizi, and Robert E. Kass. 2010. “Approximate Methods for State-Space Models.” Journal of the American Statistical Association 105:170–80. https://doi.org/10.1198/jasa.2009.tm08326.

Mandelbrot, Benoit. 1962. “The Role of Sufficiency and of Estimation in Thermodynamics.” Annals of Mathematical Statistics 33:1021–38. http://projecteuclid.org/euclid.aoms/1177704470.

Metropolis, Nicholas, Arianna W. Rosenbluth, Marshall N. Rosenbluth, Augusta H. Teller, and Edward Teller. 1953. “Equations of State Calculations by Fast Computing Machines.” Journal of Chemical Physics 21:1087–92. https://doi.org/10.1063/1.1699114.

Packard, Norman H., James P. Crutchfield, J. Doyne Farmer, and Robert S. Shaw. 1980. “Geometry from a Time Series.” Physical Review Letters 45:712–16. https://doi.org/10.1103/PhysRevLett.45.712.

Sauer, Tim, James A. Yorke, and Martin Casdagli. 1991. “Embedology.” Journal of Statistical Physics 65:579–616. https://doi.org/10.1007/BF01053745.

Takens, Floris. 1981. “Detecting Strange Attractors in Fluid Turbulence.” In Symposium on Dynamical Systems and Turbulence, edited by D. A. Rand and L. S. Young, 366–81. Berlin: Springer-Verlag. https://doi.org/10.1007/BFb0091924.

Whitney, Hassler. 1936. “Differentiable Manifolds.” Annals of Mathematics 37:645–80. https://doi.org/10.2307/1968482.