nbren12 / mc2015_final

Final project for a monte carlo methods course

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Monte Carlo parameter estimation in the Lorenz 63 system

Codes

(require 'ob-dot)
(setq org-confirm-babel-evaluate nil)

Introduction

Introduction

  • The point of this final project is to learn parameters in Lorenz63 using monte carlo methods. The approach taken is to formulate a Hamiltonian using the dynamic residuals, and then sample from the corresponding Gibbs distribution.
  • Another similar idea is to estimate the state of the system given noisy observations (e.g. data assimilation).

Lorenz63 system

This system is one of the earliest examples of what would later become known as chaotic dynamical systems. It is obtained by projection of the Rayleigh-Benard equations for convection of a thin layer onto three orthogonal modes. The system is given by \begin{align} \dot{X} &= σ(Y-X)
\dot{Y} &= -XZ + rX - Y\ \dot{Z} &= XY - bZ. \end{align} The parameters used by Lorenz are $σ = 10$, $b=8/3$ and $r=28$.

lorenz63.pdf

Parameter Fitting procedure

Notation

  • Let $U$ be given by the dynamics \[ \dot{U} = F(U; θ) + ε \dot{W}\] where $θ$ is some set of parameters.
  • Let $Ψ_tθ$ be the propagator, defined by

\[Ψ_tθU(s) = U(t+s).\]

  • Temporal grid: Let $T > 0$, $N$, and define $τ = T / (N+1)$. Then, a temporal grid $t_j=j τ$ can be defined for $j=0…N$.

Dynamic Residuals

Given a set of point estimates $U_j$ and parameters, define the dynamic residual for a time $t_j$ to be \[ e_j(θ) := e(Uj-1, U_j, θ) := Ψτθ Uj-1 - U_j.\]

Then, a sensible way to choose the parameters is so that they minimize \[ ∑j=1N|e_j|^2.\]

Because $θ$ is a potentially high dimensional object, Monte Carlo techniques can be used to perform this optimization.

Sampling strategy

Equilibrium distribution

  • Vector of parameters $θ = [σ, r, b]$
  • Generate samples $θ_k$ from \[ f(θ) \propto exp \left( -\frac{β}{N}∑j=1N|e_j(θ)|^2 \right).\]
  • The mode of $f(θ)$ is the value that minimizes the dynamic residuals

Data assimilation

Note that $Uj$ is only in $e_j$ and $ej-1$, this can be used to simplify the optimization problem, and suggests some sort of resampling technique.

Proposal Distribution

  • Independent gaussian proposal function: \[P(θ0, θ_1) \propto exp \left( -\frac{1}{2} (θ_1 -θ_0)^T C-1 (θ_1 -θ_0) \right) \]
  • Covariance matrix: $C11 = .5^2$, $C22 = .1^2$, $C33=1.0^2$, $Cij = 0$ if $i≠ j$.

Acceptance Probability

Metropolis-Hastings acceptance probability: \[ A(θ_0, θ_1 ) = min \left\{1, \frac{f(θ_1) P(θ_1, θ_0)}{f(θ_0) P(θ_0, θ_1)} \right\} \]

Code Architecture

Languages and Libraries

  • Language: C++ for sampler, Python for plotting/analysis
  • C++ Libraries:

Code Architecture

  • The integrator for the dynamical system is defined in src/integrate.cpp.
    • Second order explicit predictor/corrector method for deterministic dynamics
    • Forward Euler for the stochastic terms
  • src/equil.cpp contains the equilibrium distribution
  • The basic proposal distribution and metropolis acceptance function are defined in src/mcmc.cpp.
  • src/param_search.cpp contains the parameter searching method.

Code Architecture

dependency.pdf

Results

$τ = .5$ Traces

{tau-.5-0}.pdf

$τ = .5$ Distributions

{tau-.5-1}.pdf

$τ = .5$ Autocorrelation functions

{tau-.5-2}.pdf

$τ = 1.0$ Traces

{tau-1.0-0}.pdf

$τ = 5.0$ Traces

{tau5.0-0}.pdf

$τ = 5.0$ Distributions

{tau5.0-1}.pdf

Reducing $β$ gives large drift and autocorrelations

lowbeta-0.pdf

Model Error can help

  • Let $ε = 5.0$

lorenz63_noisy.pdf

Model error can help a little

noisy-0.pdf

Model error can help a little

noisy-1.pdf

Conclusions

Conclusions

  • Using the dynamic residuals method to find parameters works well for short observations times $τ \leq .5$.
  • MCMC performance is very poor for larger $τ$.
  • Making a model error can help regularize the fit
  • $σ$ is the most difficult parameter to estimate

Future Directions

  • Use dynamic residuals might work better for the data assimilation problem
  • Parameter fitting might be better done by matching equilbrium statistics of the attractor rather than exact paths.

About

Final project for a monte carlo methods course


Languages

Language:C++ 70.3%Language:Python 15.7%Language:CMake 8.7%Language:C 4.4%Language:Makefile 0.9%