Jekyll2017-09-09T14:50:12+00:00http://benlansdell.github.io/Ben LansdellComputational neuroscience and applied mathematicsBen Lansdellben dot lansdell at gmail dot comMathJax, Jekyll and github pages2016-06-27T00:00:00+00:002016-06-27T00:00:00+00:00http://benlansdell.github.io/computing/mathjax<p>Integrating MathJax with Jekyll is a very convenient way of typesetting mathematics in a blog hosted on github pages. There are a few guides online, which were (almost) helpful in acheiving this on a github hosted site. The steps, as of September 2016, are:</p>
<p>Ensure the markdown engine is set to <code class="highlighter-rouge">kramdown</code> in <code class="highlighter-rouge">_config.yml</code>. This is now the <a href="https://help.github.com/articles/updating-your-markdown-processor-to-kramdown/">only supported markdown processor</a> on github pages, so this should be set anyway.</p>
<p>Include a new file in <code class="highlighter-rouge">_includes</code> named <code class="highlighter-rouge">_mathjax_support.html</code> (a clever idea from <a href="http://haixing-hu.github.io/programming/2013/09/20/how-to-use-mathjax-in-jekyll-generated-github-pages/">here</a>):</p>
<div class="highlighter-rouge"><pre class="highlight"><code><script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
equationNumbers: {
autoNumber: "AMS"
}
},
tex2jax: {
inlineMath: [ ['$', '$'] ],
displayMath: [ ['$$', '$$'] ],
processEscapes: true,
}
});
MathJax.Hub.Register.MessageHook("Math Processing Error",function (message) {
alert("Math Processing Error: "+message[1]);
});
MathJax.Hub.Register.MessageHook("TeX Jax - parse error",function (message) {
alert("Math Processing Error: "+message[1]);
});
</script>
<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</code></pre>
</div>
<p>The bottom two hooks alert the user/writer about math and tex errors.</p>
<p>Importantly, in contrast to older guides online, note the https in the MathJax CDN. Unencrypted access to the CDN is a security risk and now will either not render in some browsers (didn’t work in Chrome for me), or will issue warnings in other browsers (Firefox). See the MathJax <a href="http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn">documentation</a> for more information.</p>
<p>Next, include in the <code class="highlighter-rouge"><head></code> of <code class="highlighter-rouge">_layouts/default.html</code>:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">if</span><span class="w"> </span><span class="err">page.use_math</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">include</span><span class="w"> </span><span class="err">mathjax_support.html</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span><span class="p">{</span><span class="err">%</span><span class="w"> </span><span class="err">endif</span><span class="w"> </span><span class="err">%</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
<p>Now to include $\LaTeX$ in a post you just need set the variable <code class="highlighter-rouge">use_math: true</code> in the YAML front-matter of the page/post! Enclose inline formulas in <code class="highlighter-rouge">$</code>s and display formulas in <code class="highlighter-rouge">$$</code>s. For instance,</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$$
K(a,b) = \int \mathcal{D}x(t) \exp(2\pi i S[x]/\hbar)
$$
</code></pre>
</div>
<p>produces:</p>
<script type="math/tex; mode=display">K(a,b) = \int \mathcal{D}x(t) \exp(2\pi i S[x]/\hbar)</script>
<h2 id="alignment">Alignment</h2>
<p>Note that any equations requiring alignment (use of ampersand &) need some care. The solution I found was to wrap any of these elements in <div>’s.</p>
<h2 id="changing-typeset-fontsize">Changing typeset fontsize</h2>
<p>Add the following to <code class="highlighter-rouge">MathJax.Hub.Config</code>:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>CommonHTML: {
scale: 85
}
</code></pre>
</div>
<h2 id="some-references">Some references:</h2>
<ul>
<li>http://cwoebker.com/posts/latex-math-magic – no longer seems to work</li>
<li>http://haixing-hu.github.io/programming/2013/09/20/how-to-use-mathjax-in-jekyll-generated-github-pages/</li>
<li>MathJax guide: http://docs.mathjax.org/en/latest/tex.html</li>
<li>MathJax details: http://docs.mathjax.org/en/latest/advanced/model.html</li>
</ul>Ben Lansdellben dot lansdell at gmail dot comIntegrating MathJax with Jekyll is a very convenient way of typesetting mathematics in a blog hosted on github pages. There are a few guides online, which were (almost) helpful in acheiving this on a github hosted site. The steps, as of September 2016, are:On the relation between maximum likelihood and KL divergence2016-06-26T00:00:00+00:002016-06-26T00:00:00+00:00http://benlansdell.github.io/statistics/likelihood<p>In this post I describe some of the theory of maximum likelihood estimation (MLE), highlighting its relation to information theory. In a later post I will develop the theory of maximum entropy models, also drawing connections to information theory, hoping to clarify the relation between MLE and MaxEnt.</p>
<p>Maximum likelihood was developed and advocated by many figures throughout the history of mathematics (see [1] for a nice overview). In a sense it was first considered in a significant way by Lagrange, but it was also considered by Bernoulli, Laplace, and Gauss, among others. Indeed, what was known as the ‘Gaussian method’ involved maximum aposteriori estimation of a model with normal distributed errors and a uniform prior, resulting in what is now known as the method of least squares. However, its theory and use was advanced most strongly by Fisher in the 1920s and 30s. Fisher worked for many years to demonstrate conditions needed for both the consistency of MLE and efficiency. While his later results have stood up to scrutiny, the theory, as it stands, does not possess the quite generality he sought after. Nonetheless, it remains a cornerstone of contemporary statistics.</p>
<h2 id="maximum-likelihood-estimation">Maximum likelihood estimation</h2>
<p>Much of statistics relies on identifying models of data that are, in some sense, close to our observations. Indeed, in many cases it seems sensible that we seek models that are the closest to our observations. Maximum likelihood provides one principle by which we may identify theseclosest distributions. It has many appealing properties that make it an appropriate measure, and is a broadly applicable method. As we will see its simplicity is somewhat deceiving.</p>
<p>The theory is easiest to describe in a discrete setting, which we will address first. Let</p>
<script type="math/tex; mode=display">x = (x_1, x_2, \cdots, x_N)</script>
<p>describe $N$ observations drawn from a discrete probability distribution. Each draw $x_n\in\mathcal{X}$ is taken from an alphabet of $M$ characters, $\mathcal{X}=(a_1, \dots, a_M)$. Let $p_m$ denote the probability of drawing character $m$ in any one draw, and let $f_m$ denote the frequency of character $m$ is observed in the $N$ draws. Note that we’re just describing a multinomial distribution having $M$ parameters $p_m$.</p>
<p>Given our observations, how should we estimate the multinomial parameters $\mathbf{p}$? The principle of maximum likelihood states simply that we take parameters that result in our observations having highest probability, when compared with all other possible choices of parameters. If we assume that each draw is independently and identically distributed (i.i.d.) then this is</p>
<div>
$$
\begin{align}
\hat{\mathbf{p}}_{MLE} & = \text{argmax}_{p\in \mathcal{P}} \prod_{n=1}^Np_{x_n}\\
& = \text{argmax}_{p\in\mathcal{P}}\log\left(\prod_{n=1}^Np_{x_n} \right) \\
& =\text{argmax}_{p\in\mathcal{P}}\sum_{n=1}^N\log \left( p_{x_n} \right) \\
& =\text{argmax}_{p\in\mathcal{P}}\sum_{m=1}^M f_m \log \left( p_m \right)
\end{align}
$$
</div>
<p>For many reasons, some of which will become clear here, expressing the maximization problem in terms of logarithms is the natural choice, so the last line above is one we will be optimizing. (As a brief aside, note the step taken to reach the last line appears a trivial manipulation, but if we were to write out what was happening in a general probability space, it is roughly analogous to the pushforward change of variables:</p>
<script type="math/tex; mode=display">\begin{align*}
\int_\mathbb{R} \log (p(x)) dF(x) = \int_\Omega \log(p(X(\omega)) d\mu(\omega)\end{align*}</script>
<p>we make when shifting between expectations in terms of a measure $\mu$ and a distribution function $F$. The LHS being given by a Lebesgue-Stieltjes integral, the RHS by a Lebesgue integral.)</p>
<p>The problem is constrained by the fact that $\sum q_m = 1$ and $q_m\ge 0 \forall m$. This constrained optimization problem can be solved using Lagrange multipliers. Recall this involves augmenting our objective function with our constraints</p>
<script type="math/tex; mode=display">\text{argmax}_{p\in\mathcal{P}} \sum_{m=1}^M f_m \log \left(p_{x_n}\right) - \lambda (\sum_{m=1}^Mq_m - 1) + \sum_{m=1}^M\mu_m p_m = \text{argmax}_{p\in\mathcal{P}} \mathcal{\tilde{L}}(\mathbf{p}, \mathbf{f})</script>
<p>We set the partial derivative of the Lagrangian $\mathcal{\tilde{L}}$ taken with respect to $p_m$ to zero to obtain</p>
<script type="math/tex; mode=display">p_m = \frac{1}{\lambda + \mu_m} f_m</script>
<p>We find that the optimal occurs at, not surprisingly, the empirical estimates for the mean. Thus we have that the MLE estimates for our multinomial distribution are maximized at the empirical distribution.</p>
<h2 id="kl-divergence">KL-divergence</h2>
<p>I mentioned earlier that we would like some measure of closeness, and would like to find distributions that are ‘close’ our observations. What measure of closeness have we just minimized? In the discrete case, we have just minimized the relative entropy, or Kullback-Liebler divergence between the empirical distribution and the model.</p>
<p>Recall the empirical distribution is</p>
<script type="math/tex; mode=display">\hat{q}_m = \frac{\sum_{n=1}^N\mathbf{I}}{\|\mathbf{f}\|_1} = \frac{f_m}{N}</script>
<p>so that:</p>
<div>
$$
\begin{align*}
\hat{\mathbf{p}}_{MLE}
& = \text{argmax}_{\mathbf{p}\in\mathcal{P}} \sum_{m=1}^M f_m \log \left( {p_m} \right) \\
& = \text{argmin}_{\mathbf{p}\in\mathcal{P}} \sum_{m=1}^M \hat{q}_m \log \left( \hat{q}_m \right) - \hat{q}_m \log \left( {p_m} \right) \\
& = \text{argmin}_{\mathbf{p}\in\mathcal{P}} \sum_{m=1}^M \hat{q}_m \log \left( \frac{\hat{q}_m}{p_m} \right) \\
& = \text{argmin}_{\mathbf{p}\in\mathcal{P}} D_{KL}( \mathbf{q} | \mathbf{p}) \\
\end{align*}
$$
</div>
<p>where we have taken as convention $0\log(0) = 0$. <em>Thus in the discrete case, at least, maximizing likelihood corresponds to minimizing the KL divergence.</em></p>
<p>We have discussed only the case where $\mathbf{p}$ is estimated non-parameterically. What if we instead have some probability model described by a parameter $\theta$? The optimization problem now becomes</p>
<div>
$$
\begin{align}\hat{\theta}_{MLE} & = \text{argmax}_{\theta\in\Theta}\mathcal{L}(\theta|\mathbf{f})\\
& = \text{argmax}_{\theta\in\Theta}\sum_{m=1}^M f_m \log \left(p_m(\theta)\right)\\\end{align}
$$
</div>
<p>which is typically found by solving $\frac{\partial}{\partial \theta}\mathcal{L}(\theta|\mathbf{f}) = 0$. The result is the same however – we minimize the difference between the empirical distribution and the parametric model.</p>
<p>In the continuous case things are not so straightforward. We try the same argument for a real-valued random variable, $N$ observations $X^n = {x_1, \dots, x_N }$, and a parametric model $f(x; \theta)$. If we denote by</p>
<script type="math/tex; mode=display">p_D(x) = \frac{1}{N}\sum_{i=1}^{N}\delta(x-x_i)</script>
<p>the ‘empirical density’, then trying the same argument gives:</p>
<div>
$$
\begin{align*}
\hat{\theta}_{MLE}
& = \text{argmax}_{\theta} \sum_{i=1}^N \log \left( f(x_i;\theta) \right) \\
\text{(??)} \qquad & = \text{argmax}_{\theta} \int p_D(x) \log \left( {f(x;\theta)} \right) \,dx\\
\text{(??)} \qquad & = \text{argmin}_{\theta} \int p_D(x) \log \left( \frac{p_D(x)}{f(x;\theta)} \right) \,dx\\
& = \text{argmin}_{\theta} D_{KL}( p_D | f(\dot; \theta)) \\
\end{align*}
$$
</div>
<p>However, the question marked lines don’t quite make sense – it’s unclear what the $log p_D(x)$ is in a continuous setting. For such a line to make sense the empirical distribution would have to be absolutely continuous so that $p_D$ was actually a density.</p>
<h2 id="consistency">Consistency</h2>
<p>That said, the intuition about MLE and min. $D_{KL}$ does carry through to the continuous setting in the following sense. Let the data be generated by a model given by $f(x; \theta^*)$ and let</p>
<script type="math/tex; mode=display">M_N(\theta) = \frac{1}{N}\sum_{i=1}^N \log(f(x_i;\theta))</script>
<p>denote the quantity we maximize under MLE. We note that this is an approximation to the expectation</p>
<script type="math/tex; mode=display">M_N(\theta) \approx \mathbb{E}_{\theta^*} \log(f(X;\theta))</script>
<p>and that, through the law of large numbers, this indeed converges to</p>
<script type="math/tex; mode=display">\lim_{N\to\infty} M_N(\theta) =M(\theta) = \mathbb{E}_{\theta^*} \log(f(X;\theta)).</script>
<p>But maximizing $M(\theta)$ is the same as minimizing $D_{KL}(f(\theta^*)|f(\theta))$ since:</p>
<div>
$$
\max_{\theta} M(\theta) = \max_{\theta} \mathbb{E}_{\theta^*} \log \left(\frac{f(X;\theta)}{f(X;\theta^*)}\right) = \min_{\theta} D_{KL}(f(\theta^*)\|f(\theta))
$$
</div>
<p>Note that since $D_{KL} \ge 0$ and $D_{KL}(f|g) = 0 \iff f = g$ then, under regularity conditions not specified here, this result implies the consistency of the MLE – that $\theta_N \to^{P} \theta^*$ as $N\to\infty$.</p>
<h2 id="a-reference">A reference</h2>
<ol>
<li>“The Epic Story of Maximum Likelihood” Stephen M. Stigler. 2007.</li>
</ol>Ben Lansdellben dot lansdell at gmail dot comIn this post I describe some of the theory of maximum likelihood estimation (MLE), highlighting its relation to information theory. In a later post I will develop the theory of maximum entropy models, also drawing connections to information theory, hoping to clarify the relation between MLE and MaxEnt.Installing NEURON with python and Neuronvisio2016-06-17T00:00:00+00:002016-06-17T00:00:00+00:00http://benlansdell.github.io/computing/neurovisio<p>Since it took some time, I’m going to describe the steps I took to install NEURON with support for python and the 3D visualization tool neuronvisio. I’m running Ubuntu 14.04, python 2.7.</p>
<p>First, I installed the neuron python package found at http://neuralensemble.org/people/eilifmuller/software.html. Note that this installs NEURON 7.1, which is not the latest version.
I had to install also libreadline-dev to get nrnivmodl (the hoc compiler) working:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sudo apt-get install libreadline-dev
</code></pre>
</div>
<p>Then install the prerequisites for neuronvisio:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sudo apt-get install python-qt4 python-matplotlib python-setuptools python-tables mayavi2 python-pip
</code></pre>
</div>
<p>Install neuronvisio</p>
<div class="highlighter-rouge"><pre class="highlight"><code>cd ~/python/
git clone git://github.com/mattions/neuronvisio.git
python setup.py install
</code></pre>
</div>
<p>Add ~/python to your $PYTHONPATH, add ~/python/neuronvisio/bin/neuronvisio (or links thereto) to path
The final change (the most strange, and the that’s making me write this down) is as follows. Following steps 1-5 should get NEURON and neuronvisio working in python. I could run simulations, plot the 3D structures, etc. The one thing I was unable to do was to select segments in the 3D visualization window. I would receive the error:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>Pick() takes exactly 4 arguments (2 given)
</code></pre>
</div>
<p>The workaround I found was to edit the following file in mayavi:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>sudo vim /usr/lib/python2.7/dist-packages/mayavi/core/mouse_pick_dispatcher.py
</code></pre>
</div>
<p>So that the line changes from and to:
- 168: picker.pick((x, y, 0), self.scene.scene.renderer)
+ 168: picker.pick(x, y, 0, self.scene.scene.renderer)</p>
<p>It’s annoying that such a strange workaround was necessary. However, a similar fix was suggested here (https://github.com/enthought/mayavi/issues/21), so perhaps I wasn’t alone.</p>Ben Lansdellben dot lansdell at gmail dot comSince it took some time, I’m going to describe the steps I took to install NEURON with support for python and the 3D visualization tool neuronvisio. I’m running Ubuntu 14.04, python 2.7.Path integrals and SDEs in neuroscience – part two2016-01-30T00:00:00+00:002016-01-30T00:00:00+00:00http://benlansdell.github.io/statistics/sdesII<p>In the <a href="http://benlansdell.github.io/statistics/sdes/">previous post</a> we defined path integrals through a simple ‘time-slicing’ approach. And used them to compute moments of simple stochastic DEs. In this follow-up post we will examine how expansions can be used to approximate moments, how we can use the moment generating functional to compute probability densities, and how these methods may be helpful in some cases in neuroscience.</p>
<h3 id="sub:perturbation">Perturbative approaches</h3>
<p>For a general, non-linear, SDE the series will not terminate and must be
truncated at some point. It is then necessary to determine which terms
will contribute the sum, and to include these terms up to a given order.
We mention briefly three such possibilities, though do not discuss them
in any detail. One way of doing this is if some terms in $S_{I}$
($v_{mn}\int x^{n}\tilde{x}^{m},m\ge2$) are small. Then we can simply
let each such vertex contribute a small parameter $\alpha$ and perform
an expansion in orders of $\alpha$ (known as a ‘weak coupling expansion’
<sup id="fnref:3"><a href="#fn:3" class="footnote">1</a></sup>).</p>
<p>Another option is to perform a weak noise, or loop, expansion. Here we
scale the entire exponent in the MGF by some factor $h$</p>
<script type="math/tex; mode=display">Z=\int\mathcal{D}x(t)\mathcal{D}\tilde{x}(t)e^{-\frac{1}{h}(S-\int\tilde{J}x-\int J\tilde{x})}</script>
<p>Then each vertex of $S_{I}$ gains a factor of $1/h$ and each edge of
$S_{F}$ gains a factor $h$ which implies we can expand in powers of $h$.
In performing this expansion, if we let $E$ denote the number of
external edges of a diagram, $I$ the number of internal edges and $V$
the number of vertices then each connected graph has a factor of
<script type="math/tex">h^{I+E-V}</script> and, in fact, it can be shown by induction that:
<script type="math/tex">L=I-V+1</script> where $L$ is the number of *loops *the diagram contains.
Thus, each graph collects a factor of $h^{E-L+1}$. This allows us to
order the expansion in terms of the number of loops in each diagram.
Diagrams which contain no loops are trees, or classical diagrams. Such
diagrams form the basis of the *semi-classical *approximation.</p>
<p>This expansion is of course only valid when the contribution of the
higher loop number diagrams is smaller than that of the lower loop
number diagrams. The <em>Ginzburg</em> *criterion *says when this expansion is
indeed valid.</p>
<h2 id="some-other-examples">Some other examples</h2>
<p>We present two further examples which demonstrate how these methods are
used.</p>
<h3 id="example-1">Example 1</h3>
<p>A simple extension of the OU process so that it is now <em>mean-reverting</em>
(to something not zero, as in the previous case) is the SDE</p>
<script type="math/tex; mode=display">\dot{x}(t)+a(b+x(t))-\sqrt{D}\eta(t)=0.</script>
<p>This problem is obviously very similar to the above problem and is of
course solved almost identically. This time the action of the process is</p>
<script type="math/tex; mode=display">S=\int\left[\tilde{x}(t)(\dot{x}(t)+a(b+x(t)))+\tilde{x}(t)y\delta(t-t_{0})-\frac{D}{2}\tilde{x}^{2}(t)\right]\, dt</script>
<p>such that the free action is as before:</p>
<script type="math/tex; mode=display">S_{F}=\int\tilde{x}(t)\left[\dot{x}(t)+ax(t))\right]\, dt</script>
<p>(the
linear, homogenous part, for which a Green’s function can be calculated)
and the interacting action is:</p>
<script type="math/tex; mode=display">S_{I}=\int\left[\tilde{x}(t)\left(y\delta(t-t_{0})+ba\right)-\frac{D}{2}\tilde{x}^{2}(t)\right]\, dt.</script>
<p>The only details that change are thus that the vertex linear in
$\tilde{x}(t)$ changes from</p>
<script type="math/tex; mode=display">\int\tilde{x}(t)y\delta(t-t_{0})dt\to\int\tilde{x}(t)\left(y\delta(t-t_{0})+ba\right)dt,</script>
<p>which adds an extra term to the expression for the mean:</p>
<script type="math/tex; mode=display">\langle x(t)\rangle=H(t-t_{0})\left(ye^{-a(t-t_{0})}+b(1-ye^{-a(t-t_{0})})\right).</script>
<p>Since only this internal vertex is affected, and the second order vertex
($D\tilde{x}(t)^{2}/2$) is unaffected, the solution for the second-order
cumulant will in fact be the same as our original example:</p>
<script type="math/tex; mode=display">\langle x(t)x(s)\rangle_{C}=D\frac{e^{2a(t-s)}-e^{2a(t+s-2t_{0})}}{2a}</script>
<h3 id="example-2">Example 2</h3>
<p>Consider the harmonic oscillator with noise:</p>
<script type="math/tex; mode=display">\ddot{x}+2\gamma\dot{x}+\omega^{2}x=\sqrt{D}\eta(t)</script>
<p>where $\eta$ is
a white noise process. Subject to initial conditions $x(0)=x_{0}$ and
$\dot{x}(0)=v_{0}$ ($t_{0}=0$). The action for this process is</p>
<script type="math/tex; mode=display">S=\int dt\,\left(\tilde{x}\left[\ddot{x}+2\gamma\dot{x}+\omega^{2}x+v_{0}\delta(t)+x_{0}\delta'(t)\right]+\frac{D}{2}\tilde{x}^{2}\right)</script>
<p>which we will split into free and interacting components:</p>
<div>
$$\begin{aligned}
S_{F} & = \int dt\,\left(\tilde{x}\left[\ddot{x}+2\gamma\dot{x}+\omega^{2}x\right]\right)\\
S_{I} & = \int dt\,\left(\tilde{x}\left[v_{0}\delta(t)+x_{0}\delta'(t)\right]+\frac{D}{2}\tilde{x}^{2}\right)\end{aligned}$$
</div>
<p>The free action gives the propagator as the Green’s function:</p>
<script type="math/tex; mode=display">\left(\frac{d^{2}}{dt^{2}}+2\gamma\frac{d}{dt}+\omega^{2}\right)G(t,t')=\delta(t-t')</script>
<p>which can be shown to be</p>
<script type="math/tex; mode=display">G(t,t')=\frac{1}{\omega_{1}}H(t-t')e^{-\gamma(t-t')}\sin[\omega_{1}(t-t')],</script>
<p>for $\omega_{1}=\sqrt{\omega^{2}-\gamma^{2}}$. Once $G$ is determined
the mean and covariance can be immediately calculated through the
diagrams and calculations of the Figure 1.</p>
<figure class="center" style="width:500px">
<img src="../../images/feynman3.png" alt="img txt" />
<figcaption>Figure 1. Computation of first and second cumulant of Brownian motion process
with Gaussian white noise. Diagrams (with internal vertices labeled
adjacent to diagram), and the equivalent integral to evaluate to obtain
each cumulant.
</figcaption>
</figure>
<p>We find, as expected, the following mean and covariance:</p>
<div>
$$\begin{aligned}
\langle x(t)\rangle & = \int[\delta(t')v_{0}+\delta'(t')x_{0}]G(t,t')dt'\\
& = v_{0}G(t,0)+x_{0}G'(t,0)\\
& = e^{-\gamma t}\left(\frac{\gamma x_{0}+v_{0}}{\omega_{1}}\sin[\omega_{1}t]+\cos[\omega_{1}t]\right)\end{aligned}$$
</div>
<p>and (assuming $t_{1}<t_{2}$)</p>
<div>
$$\begin{aligned}
\langle x(t_{1})x(t_{2})\rangle_{C} & = D\int G(t_{1},t)G(t_{2},t)dt\\
& = \frac{D}{\omega_{1}^{2}}\int_{0}^{\infty}e^{-\gamma(t_{1}+t_{2}-2t)}H(t_{1}-t)H(t_{2}-t)\sin[\omega_{1}(t_{1}-t)]\sin[\omega_{1}(t_{2}-t)]dt\\
& = \frac{D{\rm e}^{-\gamma\,{\it t_{1}}-\gamma\,{\it t_{2}}}}{4\omega_{1}^{2}\omega^{2}\gamma}\left({\rm e}^{2\,\gamma\,{\it t1}}\left[\cos\left(\omega_{1}\,{\it t_{1}}\right)\cos\left(\omega\,{\it t_{2}}\right)\omega_{1}^{2}+\cos\left(\omega_{1}\,{\it t_{1}}\right)\sin\left(\omega_{1}\,{\it t_{2}}\right)\gamma\,\omega_{1}-\cos\left(\omega_{1}\,{\it t_{2}}\right)\sin\left(\omega_{1}\,{\it t_{1}}\right)\gamma\,\omega_{1}\right]\right.\\
& + {\rm e}^{2\,\gamma\,{\it t_{1}}}\sin\left(\omega_{1}\,{\it t_{1}}\right)\sin\left(\omega_{1}\,{\it t_{2}}\right)\omega_{1}^{2}-\cos\left(\omega_{1}\,{\it t_{1}}\right)\cos\left(\omega_{1}\,{\it t_{2}}\right)\omega_{1}^{2}-\omega_{1}\,\cos\left(\omega_{1}\,{\it t_{1}}\right)\sin\left(\omega_{1}\,{\it t_{2}}\right)\gamma\\
& + \left.\omega_{1}\,\sin\left(\omega_{1}\,{\it t_{1}}\right)\cos\left(\omega_{1}\,{\it t_{2}}\right)\gamma-2\,\gamma^{2}\sin\left(\omega_{1}\,{\it t_{1}}\right)\sin\left(\omega_{1}\,{\it t_{2}}\right)-\sin\left(\omega_{1}\,{\it t_{1}}\right)\sin\left(\omega_{1}\,{\it t_{2}}\right)\omega^{2}\right)\end{aligned}$$
</div>
<p>which, with some rearrangement, simplifies to the variance<sup id="fnref:4"><a href="#fn:4" class="footnote">2</a></sup>:</p>
<script type="math/tex; mode=display">\langle x(t)^{2}\rangle_{C}=\frac{D}{4\gamma\omega^{2}}\left[1-\exp(-2\gamma t)\left\{ 1+\frac{\gamma}{\omega_{1}}\left(\sin(2\omega_{1}t)+\frac{2\gamma}{\omega_{1}}\sin^{2}(\omega_{1}t)\right)\right\} \right].</script>
<h2 id="connection-to-fokker-planck-equation">Connection to Fokker-Planck Equation</h2>
<p>So far we have considered the moment generating functional, and the
probability density functional $P[x(t)]$, however often of interest is
the probability density $p(x,t)$. This can be computed from the above
framework with the following derivation.</p>
<p>Let $U(x_{1},t_{1}|x_{0},t_{0})$ be the transition probability between a
start point $x_{0},t_{0}$ to $x_{1},t_{1}$, then</p>
<div>
$$\begin{aligned}
U(x_{1},t_{1}|x_{0},t_{0}) & = \int\mathcal{D}x(t)\delta(x(t_{1})-x_{1})P[x(t)]\\
& = \frac{1}{2\pi i}\int d\lambda\int\mathcal{D}x(t)e^{-\lambda(x(t_{1})-x_{1})}P[x(t)]\\
& = \frac{1}{2\pi i}\int d\lambda e^{-\lambda(x_{1}-x_{0})}Z_{CM}(\lambda)\end{aligned}$$
</div>
<p>where $Z_{CM}$ gives the moments of $x(t_{1})-x_{0}$ given
$x(t_{0})=x_{0}$</p>
<script type="math/tex; mode=display">Z_{CM}=\int\mathcal{D}xe^{\lambda(x(t_{1})-x_{0})}P[x(t)]</script>
<p>Using the
following two relations:</p>
<div>
$$\begin{aligned}
Z_{CM}(\lambda) & = 1+\sum_{n=1}^{\infty}\frac{1}{n!}\langle(x(t_{1})-x_{0})^{n}\rangle_{x(t_{0})=x_{0}}\\
\frac{1}{2\pi i}\int d\lambda\, e^{-\lambda(x_{1}-x_{0})}\lambda^{n} & = \left(-\frac{\partial}{\partial x_{1}}\right)^{n}\delta(x_{1}-x_{0})\end{aligned}$$
</div>
<p>then $U$ becomes</p>
<script type="math/tex; mode=display">U(x_{1},t_{1}|x_{0},t_{0})=\left(1+\sum_{n=1}^{\infty}\frac{1}{n!}\left(-\frac{\partial}{\partial x_{1}}\right)^{n}\langle(x(t_{1})-x_{0})^{n}\rangle_{x(t_{0})=x_{0}}\right)\delta(x_{1}-x_{0}).</script>
<p>From here we can derive a relation for $p(x,t)$:</p>
<div>
$$\begin{aligned}
p(y,t+\Delta t) & = \int U(x,t+\Delta t|y',t)p(y',t)\, dy'\\
& = \int\left(1+\sum_{n=1}^{\infty}\frac{1}{n!}\left(-\frac{\partial}{\partial y}\right)^{n}\langle(x(t_{1})-y')^{n}\rangle_{x(t)=y'}\right)\delta(y-y')p(y',t)\, dy'\\
& = \left(1+\sum_{n=1}^{\infty}\frac{1}{n!}\left(-\frac{\partial}{\partial y}\right)^{n}\langle(x(t_{1})-y)^{n}\rangle_{x(t)=y}\right)p(y,t)\end{aligned}$$
</div>
<p>and thus a PDE for $p(x,t)$:</p>
<div>
$$\begin{aligned}
\frac{\partial p(y,t)}{\partial t}\Delta t & = \sum_{n=1}^{\infty}\frac{1}{n!}\left(-\frac{\partial}{\partial y}\right)^{n}\langle(x(t_{1})-y)^{n}\rangle_{x(t)=y}p(y,t)+O(\Delta t^{2})\\
\frac{\partial p(y,t)}{\partial t} & = \sum_{n=1}^{\infty}\frac{1}{n!}\left(-\frac{\partial}{\partial y}\right)^{n}D_{n}(y,t)p(y,t)\end{aligned}$$
</div>
<p>as $\Delta t\to0$. This is the Kramers-Moyal expansion where
the $D_{n}$are</p>
<p><script type="math/tex">D_{n}(y,t)=\lim_{\Delta t\to0}\left.\frac{\langle(x(t+\Delta t)-y)^{n}\rangle}{\Delta t}\right|_{x(t)=y}</script>
and are computed from the SDE. For example, for the Ito process</p>
<p><script type="math/tex">dx=f(x,t)dt+g(x,t)dB_{t}</script> we can compute $D_{1}(y,t)=f(y,t)$ and
$D_{2}(y,t)=g(y,t)^{2}$, $D_{n}=0$ for $n>2$. Hence the PDE becomes a
Fokker-Planck equation</p>
<p><script type="math/tex">\frac{\partial p(y,t)}{\partial t}=\left(\frac{\partial}{\partial y}D_{1}(y,t)+\frac{1}{2}\frac{\partial^{2}}{\partial y^{2}}D_{2}(y,t)\right)p(y,t)</script>
Compute $p(x,t)=U(x,t|0,0)$ as</p>
<div>
$$\begin{aligned}
p(x,t) & = \frac{1}{2\pi i}\int d\lambda\, e^{-\lambda x}Z_{CM}(\lambda)\\
& = \frac{1}{2\pi i}\int d\lambda\, e^{-\lambda x}\exp\left[\sum_{n=1}\frac{1}{n!}\lambda^{n}\langle x(t)^{n}\rangle_{C}\right]\end{aligned}$$
</div>
<p>For OU, we know the cumulants hence</p>
<script type="math/tex; mode=display">p(x,t)=\sqrt{\frac{a}{\pi D(1-e^{-2a(t-t_{0})})}}\exp\left(\frac{-a(x-ye^{-a(t-t_{0})})^{2}}{D(1-e^{-2a(t-t_{0})})}\right)</script>
<h1 id="statistical-mechanics-of-the-neocortex">Statistical mechanics of the neocortex</h1>
<p>Having spent some time on how path integrals can be used as
calculation devices for studying stochastic DEs, we now turn to some
specific examples of their use in neuroscience.</p>
<h2 id="neural-field-models">Neural field models</h2>
<p>A neural field model represents a continuum approximation to neural
activity (particularly in models of cortex). They are often expressed as
integro-differential equations:</p>
<script type="math/tex; mode=display">dU=\left[-U+\int_{-\infty}^{\infty}w(x-y)F(U(y,t))dy\right]dt</script>
<p>where
$U=U(x,t)$ may be either the mean firing rate or a measure of synaptic
input at position $x$ and time $t$. The function $w(x,y)=w(|x-y|)$ is a
weighting function often taken to represent the synaptic weight as a
function of distance from $x$. $F(U)$ is a measure of the firing rate as
a function of inputs. For tractability, $F$ may often be taken to be a
heaviside function, or a sigmoid curve. It is called a field because
each continuous point $x$ is assigned a value $U$, instead of modelling
the activity of individual neurons. A number of spatio-temporal pattern
forming systems may be studied in the context of these models. The
formation of ocular-dominance columns, geometric hallucinations,
persistent ‘bump models’ of activity associated with working memory, and
perceptual switching in optical illusions are all examples of pattern
formation that can be modelled by such a theory. Refer to Bressloff 2012
@Bressloff2012a for a comprehensive review.</p>
<p>The addition of additive noise to the above model:</p>
<script type="math/tex; mode=display">dU=\left[-U+\int_{-\infty}^{\infty}w(x-y)F(U(y,t))dy\right]dt+g(U)dW(x,t)\label{eq:neuralfield}</script>
<p>for $dW(x,t)$ a white noise process has been studied by Bressloff
from both a path integral approach, and by studying a
perturbation expansion of the resulting master equation more directly.
We describe briefly how the path integral approach is formulated, and
the results that can be computed as a result. More details are found in
Bressloff 2009.</p>
<p>As in the derivations of Section 2, Equation [eq:neuralfield] is
discretized in both time and space to give:</p>
<script type="math/tex; mode=display">U_{i+1,m}-U_{i,m}=\left[-U_{i,m}+\Delta d\sum_{n}w_{mn}F(U_{i,n})\right]\Delta t+\frac{\sqrt{\Delta t}}{\sqrt{\Delta d}}g(U_{i,m})dW_{i,m}+\Phi_{m}\delta_{i,0}</script>
<p>for initial condition function $\Phi(x)=U(x,0).$ Where each noise
process is a zero-mean, delta correlated process:</p>
<script type="math/tex; mode=display">\langle dW_{i,m}\rangle=0,\quad\langle dW_{i,m}dW_{j,n}\rangle=\delta_{i,j}\delta_{m,n}.</script>
<p>Let $U$ and $W$ represent vectors with components $U_{i,m}$ and
$W_{i,m}$ such that we can write down the probability density function
conditioned on a particular realization of $W$:</p>
<script type="math/tex; mode=display">P(U|W)=\prod_{n}\prod_{i=1}^{N}\delta\left(U_{i+1,m}-U_{i,m}+\left[U_{i,m}-\Delta d\sum_{n}w_{mn}F(U_{i,n})\right]\Delta t-\frac{\sqrt{\Delta t}}{\sqrt{\Delta d}}g(U_{i,m})dW_{i,m}-\Phi_{m}\delta_{i,0}\right)</script>
<p>where we again use the Fourier representation of the delta function:</p>
<script type="math/tex; mode=display">P(U|W)=\int\prod_{n}\prod_{i=1}^{N}\frac{d\tilde{U}_{j,n}}{2\pi}\exp\tilde{-iU_{i,m}}\left(U_{i+1,m}-U_{i,m}+\left[U_{i,m}-\Delta d\sum_{n}w_{mn}F(U_{i,n})\right]\Delta t-\frac{\sqrt{\Delta t}}{\sqrt{\Delta d}}g(U_{i,m})dW_{i,m}-\Phi_{m}\delta_{i,0}\right).</script>
<p>Knowing the density for the random vector $W$ we can write the
probability of a vector $U$:</p>
<script type="math/tex; mode=display">P(U)=\int\prod_{n}\prod_{i=1}^{N}\frac{d\tilde{U}_{j,n}}{2\pi}\exp\tilde{-iU_{i,m}}\left(U_{i+1,m}-U_{i,m}+\left[U_{i,m}-\Delta d\sum_{n}w_{mn}F(U_{i,n})\right]\Delta t+\frac{\Delta t}{2\Delta d}g^{2}(U_{i,m})\tilde{U}_{i,m}-\Phi_{m}\delta_{i,0}\right).</script>
<p>Taking the continuum limit gives the density:</p>
<script type="math/tex; mode=display">P[U]=\int\mathcal{D}\tilde{U}e^{-S[U,\tilde{U}]},</script>
<p>for action</p>
<script type="math/tex; mode=display">S[U,\tilde{U}]=\int dx\int_{0}^{T}dt\tilde{U}\left[U_{t}(x,t)+U(x,t)-\int w(x-y)F(U(y,t))dy-\Phi(x)\delta(t)-\frac{1}{2}\tilde{U}^{2}g^{2}(U(x,t))\right].</script>
<p>Given the action, the moment generating functional and propagator can be
defined as previously. In linear cases the moments can be computed
exactly.</p>
<h3 id="the-weak-noise-expansion">The weak-noise expansion</h3>
<p>If the noise term is scaled by a small parameter, $g(U)\to\sigma g(U)$
for $\sigma\ll1.$ (For instance, in the case of a Langevin approximation
to the master equation, it is the case that $\sigma\approx1/N$ for $N$
the number of neurons.) Rescaling variables
$\tilde{U}\to\tilde{U}/\sigma^{2}$ and
$\tilde{J}\to\tilde{J}/\sigma^{2}$ then the generating functional
becomes:</p>
<script type="math/tex; mode=display">Z=\int\mathcal{D}U\mathcal{D}\tilde{U}e^{-\frac{1}{\sigma^{2}}S[U,\tilde{U}]}e^{\frac{1}{\sigma^{2}}\int dx\int_{0}^{T}dt[\tilde{U}J+\tilde{J}U]},</script>
<p>which can be thought of in terms of a loop expansion described in
Section [sub:perturbation]. Performing the expansion in orders of
$\sigma$ allows for a ‘semi-classical’ expansion to be performed. The
corrections to the deterministic equations take the form</p>
<script type="math/tex; mode=display">\frac{\partial v}{\partial t}=-v(x,t)+\int w(x-y)F(v(y,t))dy+\frac{\sigma^{2}}{2}\int w(x-y)C(x,y,t)F''(v(y,t))dy+O(\sigma^{4})</script>
<p>for $C(x,y,t)$ the second-order cumulant (covariance) function. The
expression for $C(x,y,t)$ is derived and studied in more detail in Buice
<em>et al</em> 2010.</p>
<h2 id="mean-field-wilson-cowan-equations-and-corrections">Mean-field Wilson-Cowan equations and corrections</h2>
<p>Another approach using path integrals has been extensively studied by
Buice and Cowan (Buice2007, see also Bresslof
2009). Here, we envision a network of neurons which exist
in one of either two or three states, depending on the time scales of
interest relative to the time scales of the neurons being studied. Each
neuron in the network is modeled as a Markov process which transitions
between active and quiescent states (and refractory, if it’s relevant).</p>
<p>For the two state model, assume that each neuron in the network creates
spikes and that these spikes have an impact on the network dynamics for
an exponentially distributed time given by a decay rate $\alpha.$ Let
$n_{i}$ denote the number of ‘active’ spikes at a given time for neuron
$i$ and let $\mathbf{n}$ denote the state of all neurons at a given
time. We assume that the effect of neuron $j$ on neuron $i$ is given by
the function</p>
<script type="math/tex; mode=display">f(\sum_{ij}w_{ij}n_{j}+I)</script>
<p>for some firing rate function
$f$ and some external input $I$. Then the master equation for the state
of the system is:</p>
<script type="math/tex; mode=display">\frac{dP(\mathbf{n},t)}{dt}=\sum_{i}\alpha(n_{i}+1)P(\mathbf{n}_{i+},t)-\alpha n_{i}P(\mathbf{n},t)+f\left(\sum_{ij}w_{ij}n_{j}+I\right)[P(\mathbf{n}_{i-},t)-P(\mathbf{n},t)]</script>
<p>where we denote by $\mathbf{n}<em>{i\pm}$the state of the network
$\mathbf{n}$ with one more or less active spike in neuron $i$. The
assumption is made that each neuron is identical and that the weight
function $w</em>{ij}=w_{|i-j|}$, that is, it only depends on the distance
between the two neurons. Of interest is the mean activity of neuron $i$:</p>
<script type="math/tex; mode=display">a_{i}(t)=\langle n_{i}(t)\rangle.</script>
<p>Using an operator representation it is possible to derive a stochastic
field theory in the continuum limit ($N\to\infty$ and
$n_{i}(t)\to n(x,t)$) to give moments of $n_{i}(t)$ in terms of the the
interaction between two fields $\varphi(x,t)$ and
$\tilde{\varphi}(x,t)$. The details of the derivation are contained in
the Appendices of Buice and Cowan 2007. These fields can be
related to quantities of interest through</p>
<script type="math/tex; mode=display">a(x,t)=\langle n(x,t)\rangle=\langle\varphi(x,t)\rangle</script>
<p>and</p>
<script type="math/tex; mode=display">\langle n(x_{1},t_{1})n(x_{2},t_{2})\rangle=\langle\varphi(x_{1},t_{1})\varphi(x_{2},t_{2})\rangle+\langle\varphi(x_{1},t_{1})\tilde{\varphi}(x_{2},t_{2})\rangle a(x_{2},t_{2})</script>
<p>for $t_{1}>t_{2}$. The propagator, as before, is</p>
<script type="math/tex; mode=display">G(x_{1},t_{1};x_{2},t_{2})=\langle\varphi(x_{1},t_{1})\tilde{\varphi}(x_{2},t_{2})\rangle</script>
<p>and the generating function is given by</p>
<script type="math/tex; mode=display">Z[J,\tilde{J}]=\int\mathcal{D}\varphi\mathcal{D}\tilde{\varphi}e^{-S[\varphi,\tilde{\varphi}]+J\tilde{\varphi}+\tilde{J}\varphi}.</script>
<p>For the master equation above the action is given by:</p>
<script type="math/tex; mode=display">S[\varphi,\tilde{\varphi}]=\int dx\left(\int_{0}^{t}dt\tilde{\varphi}\partial_{t}\varphi+\alpha\tilde{\varphi}\varphi-\tilde{\varphi}f\left(w\star[\tilde{\varphi}\varphi+\varphi]+I\right)\right)-\int dx\,\bar{n}(x)\tilde{\varphi}(x,0),</script>
<p>for convolution $\star$ and initial condition vector $\bar{n}(x).$ This
now allows the action to be divided into a free and interacting action
and for perturbation expansions to be performed.</p>
<p>The loop expansion provides a useful expansion and, as described in
Section 2, amounts to ordering Feynman diagrams by the number of loops
contained in them. The zeroth order, mean field theory, corresponds to
Feyman diagrams containing zero loops. Such diagrams are called tree
diagrams. It can be shown that the dynamics of this expansion obey:
<script type="math/tex">\partial_{t}a_{0}(x,t)+\alpha a_{0}(x,t)-f(w\star a_{0}(x,t)+I)=0</script>
which are also a simple form of the well known Wilson-Cowan equations.
That these equations are recovered as the zeroth order expansion of the
continuum limit of the master equation gives confidence that the
higher-order terms of the expansion will indeed correspond to relevant
dynamics. The ‘one-loop’ correction is given by:</p>
<script type="math/tex; mode=display">\partial_{t}a_{1}(x,t)+\alpha a_{1}(x,t)-f(w\star a_{1}(x,t)+I)+h\mathcal{N}(a_{1},\Delta)=0</script>
<p>for</p>
<script type="math/tex; mode=display">\mathcal{N}(a,\Delta)=\int dx_{1}dx_{2}dx'dt'dx''f^{(2)}(x,t)w(x-x_{1})w(x-x_{2})f^{(1)}(x',t')w(x'-x'')\Delta(x_{1}-x',t-t')\Delta(x_{2}-x'',t-t')a(x'',t')</script>
<p>and the ‘tree-level’ propagator</p>
<h1 id="summary">Summary</h1>
<p>We have described how path integrals can be used to compute moments and
densities of a stochastic differential equation, and how they can be
used to perform perturbation expansions around ‘mean-field’, or
classical, solutions.</p>
<p>Path integral methods, once one is accustomed to their use, can provide
a quick and intuitive way of solving particular problems. However, it is
worth highlighting that there are few examples of problems which can be
solved with path integral methods but not with other, perhaps more
standard, methods. Thus, while they are a powerful and general tool,
their utility is often countered by the fact that, for many problems,
simpler solution techniques exist.</p>
<p>Further, it should be highlighted that the path integral as it was
defined here – as a limit of finite-dimensional integration
($\int\prod_{i}^{N}dx_{i}\to\int\mathcal{D}x(t)$) – does not result in a
valid measure. In some cases the Weiner measure may equivalently be
used, but in other cases the path integral as formulated by Feynman
remains a mathematically unjustified entity.</p>
<p>With these caveats in mind, their principle benefit, then, may instead
come from the intuition that they bring to novel mathematical and
physical problems. When unsure how to proceed, having as many different
ways of approaching a problem can only be beneficial. Indeed, in 1965
Feynman said in his Nobel acceptance lecture: “Theories of the known,
which are described by different physical ideas may be equivalent in all
their predictions and are hence scientifically indistinguishable.
However, they are not psychologically identical when trying to move from
that base into the unknown. For different views suggest different kinds
of modifications which might be made and hence are not equivalent in the
hypotheses one generates from them in one’s attempt to understand what
is not yet understood.”</p>
<div class="footnotes">
<ol>
<li id="fn:3">
<p><em>e.g.</em> in QED this coupling is related to change of electron
($e$): $\alpha\approx1/137=\text{fine structure constant}$ <a href="#fnref:3" class="reversefootnote">↩</a></p>
</li>
<li id="fn:4">
<p>The expression for the mean and variance I was able to verify (pp.
83-85 @Gitterman2005). The expression for the covariance I was
unable to locate in another source to verify; that it reduces to the
correct variance is encouraging, however. <a href="#fnref:4" class="reversefootnote">↩</a></p>
</li>
</ol>
</div>Ben Lansdellben dot lansdell at gmail dot comIn the previous post we defined path integrals through a simple ‘time-slicing’ approach. And used them to compute moments of simple stochastic DEs. In this follow-up post we will examine how expansions can be used to approximate moments, how we can use the moment generating functional to compute probability densities, and how these methods may be helpful in some cases in neuroscience.Path integrals and SDEs in neuroscience2016-01-30T00:00:00+00:002016-01-30T00:00:00+00:00http://benlansdell.github.io/statistics/sdes<h2 id="introduction">Introduction</h2>
<p>The path integral was first considered by Wiener in the 1930s in his study of diffusion and Brownian motion. It was later co-opted by Dirac and by Richard Feynman in Lagrangian formulations of quantum mechanics. They provide a quite general and powerful approach to tackling problems not just in quantum field theory but in stochastic differential equations more generally. There is an associated learning curve to being able to make use of path integral methods, however, and for many problems simpler solution techniques exist.</p>
<p>Nonetheless, it is interesting to think about their application to neuroscience. In the following two posts I will describe how path integrals can be defined and used to solve simple SDEs, and why such ‘statistical mechanics’ tools may be useful in studying the brain. The following largely follows material from the paper “Path Integral Methods for Stochastic Differential Equations”, by Carson Chow and Michael Buice, 2012. This post will assume some familiarity with probability and stochastic processes.</p>
<h2 id="statistical-mechanics-in-the-brain">Statistical mechanics in the brain</h2>
<p>The cerebral cortex is the outer-most layer of the mammalian brain. In a human brain the *neocortex *consists of approximately 30 billion neurons. Of all parts of the human brain, its neural actvity is the most correlated with our *high-order *behaviour: language, self-control, learning, attention, memory, planning. Lesion and stroke studies make clear that the cortex has signficant functional localization, however, despite this localization, individual neurons from different regions of cortex in general require expert training to distinguish – these differences in functionality appear to arise largely from differences in connectivity.</p>
<p>The interplay between structural homogeniety and functional heterogeneity of different cortical regions poses definitive challenges to obtaining quantitative models of the large-scale activity of the cortex. Since structured neural activity is observed on spatial scales involving thousands to billions of neurons, and given that this activity is associated with particular functions and pathologies, dynamical models of large-scale cortical networks are definitely necessary to an understanding of these functions and dysfunctions. Examples of large-scale activities include wave-like activity during development, bump models of working memory, avalanches in awake and sleeping states, and pathological oscillations responsible for epileptic seizure.</p>
<p>A particular challenge to building such models is noise: it is well known that significant neural variability at both the individual and population level exists in response to repeated stimuli. The spike trains of individual cortical neurons are in general very noisy, such that their firing is often well approximated by a Poisson process. The primary source of cell intrinsic noise is fluctuations in ion channel activity, which arises from a finite number of ion channels opening and closing. While the primary source of extrinsic noise is from uncorrelated synaptic inputs – a neuron may contain thousands of synapses whose inputs often do not contain meaningful, correlated input. Population responses similarly exhibit highly variable responses. Models of cortical networks must account for this variability, or demonstrate that it is irrelevant to the particular questions being asked.</p>
<p>Methods from statistical mechanics lend themselves well to modelling both of these factors – statistical, but meaningful, connectivity, and noisy, but meaningful, neural responses to stimulus – in networks with large numbers of neurons. With these thoughts in mind, let’s see how path integrals may be used to study SDEs relevant to tackling the above issues.</p>
<h2 id="a-path-integral-representation-of-stochastic-differential-equations">A path integral representation of stochastic differential equations</h2>
<p>We will begin by describing in some detail how they are constructed and manipulated. In general, we would like to study SDEs that may be of the form:</p>
<script type="math/tex; mode=display">\frac{d\mathbf{x}}{dt}=\mathbf{f}(\mathbf{x})+\mathbf{g}(\mathbf{x})\mathbf{\eta}(t)</script>
<p>for some noise process $\eta(t).$ Such a process may be characterized by either its probability density function (pdf, $p(x,t)$) or, equivalently, by its <em>moment heirarchy</em></p>
<script type="math/tex; mode=display">\langle x(t)\rangle,\quad\langle x(t)x(t')\rangle,\dots</script>
<p>A generic SDE in the above form may be studied as either a Langevin equation, or can be written as a Fokker-Planck equation, but perturbation methods in either of these forms may be difficult to apply. The path integral approach is able to provide more mechanical methods for performing particular types of perturbation expansions. In the following sections we will derive a path integral formulation of a moment generating funcational of an SDE, using the Ornstein-Uhlenbeck process as an example. This will be used to demonstrate the use of perturbation techinques using Feynman diagrams. We will also derive the pdf $p(x,t)$ of such a process.</p>
<h2 id="path-integrals">Path integrals</h2>
<p>A path integral, loosely, is an integral in which the domain of
integration is not a subset of a finite dimensional space (say
$\mathbb{R}^{n}$) but instead an infinite dimensional function space.
For instance, if we can define the probability density associated with a
particular realization of a random trajectory according to a given SDE,
then the probability that a particle travels from a point $\mathbf{a}$
to a point $\mathbf{b}$ can be computed by marginalizing (summing) over
all paths connecting these two points, subject to a suitable
normalization. Before taking this further it is useful to review some relevant concepts.</p>
<h3 id="moment-generating-functions">Moment generating functions</h3>
<p>The moment generating function (MGF) forms a crucial component to this
framework. Recall that for a single random variable $X$, the <em>moments</em>
($\langle X\rangle=\int x^{n}P(x)\, dx$) are obtained from the MGF</p>
<script type="math/tex; mode=display">Z(\lambda)=\langle e^{\lambda x}\rangle=\int e^{\lambda x}P(x)\, dx</script>
<p>by taking derivatives</p>
<script type="math/tex; mode=display">\langle X^{n}\rangle=\left.\frac{1}{Z(0)}\frac{d^{n}}{d\lambda^{n}}Z(\lambda)\right|_{\lambda=0},</script>
<p>and that the MGF contains all information about RV $X$, as an alternative to studying the pdf directly.</p>
<p>In a similar fashion we can define <script type="math/tex">W(\lambda)=\log Z(\lambda),</script> so that</p>
<script type="math/tex; mode=display">\langle X^{n}\rangle_{C}=\frac{d^{n}}{d\lambda^{n}}\left.W(\lambda)\right|_{\lambda=0}</script>
<p>are the <em>cumulants</em> of RV $X$.</p>
<p>For an $n$-dimensional random variable $\mathbf{x}=(x_{1},\dots,x_{n})$, the generating function is</p>
<script type="math/tex; mode=display">Z(\mathbf{\lambda})=\langle e^{\mathbf{\lambda}\cdot\mathbf{x}}\rangle=\int\prod_{i=1}^{n}dx_{i}e^{\mathbf{\lambda}\cdot\mathbf{x}}P(\mathbf{x})</script>
<p>for $\lambda=(\lambda_{1},\dots,\lambda_{n})$. Here, the $k$-th order moments are obtained via</p>
<script type="math/tex; mode=display">\left\langle \prod_{i=1}^{k}x_{(i)}\right\rangle =\left.\frac{1}{Z(0)}\prod_{i=1}^{k}\frac{\partial^{n}}{\partial\lambda_{(i)}}Z(\lambda)\right|_{\lambda=0}.</script>
<p>And, as before, the cumulant generating function is $W(\lambda)=\log Z(\lambda)$.</p>
<h3 id="stochastic-processes">Stochastic processes</h3>
<p>Instead of considering random variables in $n$ dimensions, we can
consider ‘infinite dimensional’ random variables through a time-slicing
limiting process. That is, we identify with each $x_{i}$ in $\mathbf{x}$
a time $t=ih$ such that $x_{i}=x(ih)$, and we let total time $T=nh$,
thereby splitting the interval $[0,T]$ into $n$ segments of length $h.$
From here, leaving any questions of convergence, etc, aside for the time
being, we can take the limit $n\to\infty$ (with $h=T/n$) such that
$x_{i}\to x(ih)=x(t)$, $\lambda_{i}\to\lambda(t)$ and
$P(\mathbf{x})\to P[x(t)]=\exp(-S[x(t)])$ for some functional $S[x]$
that we will call the <em>action</em>. Thus we envision that to compute the
MGF, instead of summing over all points in $\mathbb{R}^{n}$
$\left(\int\prod_{i=1}^{n}dx_{i}\right)$, we are instead summing over
all paths using a differential denoted $\int\mathcal{D}x(t)$:</p>
<script type="math/tex; mode=display">Z[\lambda]=\int\mathcal{D}x(t)\, e^{-S[x]+\int\lambda(t)x(t)\, dt}.</script>
<p>From this formula, moments can now be obtained via</p>
<script type="math/tex; mode=display">\left\langle \prod_{i=1}^{k}x(t_{(i)})\right\rangle =\frac{1}{Z[0]}\left.\prod_{i=1}^{k}\frac{\delta}{\delta\lambda(t_{(i)})}Z[\lambda]\right|_{\lambda(t)=0},</script>
<p>with the cumulant generating functional again being</p>
<script type="math/tex; mode=display">W[\lambda]=\log(Z[\lambda]).</script>
<h3 id="generic-gaussian-processes">Generic Gaussian processes</h3>
<p>The most important random process we consider is the Gaussian. Recall
that in one dimension the RV $X\sim N(a,\sigma^{2})$ has MGF</p>
<script type="math/tex; mode=display">Z(\lambda)=\int_{-\infty}^{\infty}\exp\left[\frac{-(x-a)^{2}}{2\sigma^{2}}+\lambda x\right]\, dx=\sqrt{2\pi}\sigma\exp(\lambda a+\lambda^{2}\sigma^{2}/2),</script>
<p>which is obtained by a ‘completing the square’ manipulation, and has cumulant GF</p>
<script type="math/tex; mode=display">W(\lambda)=\lambda a+\frac{1}{2}\lambda^{2}\sigma^{2}+\log(Z(0)),</script>
<p>so that the cumulants are
$\langle x\rangle_{C}=a,\langle x^{2}\rangle_{C}=\text{var}{X}=\sigma^{2}$ and
$\langle x^{k}\rangle_{C}=0$ for all $k>2$.</p>
<p>The $n$ dimensional Gaussian RV $X\sim N(0,K)$, with covariance matrix $K$, has MGF</p>
<script type="math/tex; mode=display">Z(\lambda)=\int_{-\infty}^{\infty}e^{-\frac{1}{2}\sum_{jk}x_{j}K_{jk}^{-1}x_{k}+\sum_{j}\lambda_{j}x_{j}}\, dx</script>
<p>This integral can also be integrated exactly. Indeed, since $K$ is
symmetric positive definite (and so is $K^{-1}$), we can diagonalise in
orthonormal coordinates, making each dimension independent, and allowing
the integration to be performed one dimension at a time. This provides
<script type="math/tex">Z(\lambda)=[2\pi\det(K)]^{n/2}e^{\frac{1}{2}\sum_{jk}\lambda_{j}K_{jk}\lambda_{k}}.</script>
In an analogous fashion, through the same limiting process described
above, the infinite dimensional case is</p>
<script type="math/tex; mode=display">Z[\lambda]=\int\mathcal{D}x(t)e^{-\frac{1}{2}\int x(s)K^{-1}(s,t)x(t)dsdt+\int\lambda(t)x(t)dt}=Z[0]e^{\frac{1}{2}\int\lambda(s)K(s,t)\lambda(t)dsdt}.</script>
<p>Importantly for perturbation techniques, higher order (centered) moments
of multivariate Gaussian random variables can be expressed simply as a
sum of products of their second moments. This result is known as Wick’s
theorem:</p>
<div>
$$
\left\langle \prod_{i=1}^{k} x_{(i)} \right\rangle = \begin{cases} 0, & k\text{ odd}\\
\sum_{\sigma\in A}K_{\sigma(1)\sigma(2)}K_{\sigma(3)\sigma(4)}\cdots K_{\sigma(k-1)\sigma(k)}, & k\text{ even}\end{cases}
$$
</div>
<p>for $A={\text{all pairings of }x_{(i)}}$. Only even
moments are non-zero. Note that this means that the covariance matrix
$K$ is the key to determining all higher order moments. Wick’s theorem lies at the heart of calculations utilizing Feynman diagrams.</p>
<h2 id="applications-to-sdes">Applications to SDEs</h2>
<p>The previous construction for generic Gaussian processes can be adapted to construct a moment generating functional for generic SDEs of the form</p>
<script type="math/tex; mode=display">\frac{dx}{dt}=f(x,t)+g(x)\eta(t)+y\delta(t-t_{0}),</script>
<p>for $t\in[0,T]$. The process involves the same time-slicing approach, in which the above SDE is discretized in time steps $h$</p>
<script type="math/tex; mode=display">x_{i+1}-x_{i}=f_{i}(x_{i})h+g_{i}(x_{i})w_{i}\sqrt{h}+y\delta_{i,0}</script>
<p>under the Ito interpretation. We assume that each $w_{i}$ is a Guassian with $\langle w_{i}\rangle=0$ and
$\langle w_{i}w_{j}\rangle=\delta_{ij}$ such that $w_{i}$ describes a
Guassian white noise process. Then the PDF of $\mathbf{x}$ given a
particuar instantiation of a random walk ${w_{i}}$ is</p>
<script type="math/tex; mode=display">P[x|w;y]=\prod_{i=0}^{n}\delta[x_{i+1}-x_{i}+f_{i}(x_{i})h-g_{i}(x_{i})w_{i}\sqrt{h}-y\delta_{i,0}].</script>
<p>If we take the Fourier transform of the PDF:</p>
<script type="math/tex; mode=display">P[x|w;y]=\int\prod_{j=0}^{N}\frac{dk_{j}}{2\pi}e^{-i\sum_{j}k_{j}(x_{j+1}-x_{j}-f_{j}(x_{j})h-g_{j}(x_{j})w_{j}\sqrt{h}-y\delta_{j,0})}</script>
<p>where we’ve made use of the fact that the Dirac delta function has
Fourier transform:</p>
<script type="math/tex; mode=display">\mathcal{F}\{\delta(x-x_{0});x\to k\}=\frac{1}{2\pi}e^{-ix_{0}k}.</script>
<p>Marginalizing over all random trajectories ${w}$ and evaluating the
resulting Gaussian integral gives:</p>
<script type="math/tex; mode=display">P[x|y]=\int\prod_{j=0}^{N}\frac{dk_{j}}{2\pi}e^{-\sum_{j}(ik_{j})\left(\frac{x_{j+1}-x_{j}}{h}-f_{j}(x_{j})-y\delta_{j,0}/h\right)h+\sum_{j}\frac{1}{2}g_{j}^{2}(x_{j})(ik_{j})^{2}h}</script>
<p>Again we take the continuum limit by letting $h\to0$ with $N=T/h$, and
by replacing $ik_{j}$ with $\tilde{x}(t)$ and
${\displaystyle \frac{x_{j+1}-x_{j}}{h}}$ with $\dot{x}(t)$:</p>
<script type="math/tex; mode=display">P[x(t)|y,t_{0}]=\int\mathcal{D}\tilde{x}(t)e^{-\int[\tilde{x}(t)(\dot{x}(t)-f(x(t),t)-y\delta(t-t_{0}))-\frac{1}{2}\tilde{x}^{2}g^{2}(x(t),t)]dt}.</script>
<p>The function $\tilde{x}(t)$ represents a function of the wave numbers
$k_{j}$, thus we can write down a moment generating functional for both
its position and its conjugate space:</p>
<script type="math/tex; mode=display">Z[J,\tilde{J}]=\int\mathcal{D}x(t)\mathcal{D}\dot{x}(t)e^{-S[x,\tilde{x}]+\int\tilde{J}x\, dt+\int J\tilde{x}\, dt}</script>
<p>More generally, instead of $g(x)\eta(t)$ with $\eta(t)$ a white noise
process, an SDE having a noise process with cumulant $W[\lambda(t)]$
will have the PDF:</p>
<div>
$$\begin{aligned}
P[x(t)|y,t_{0}] & = \int\mathcal{D}\eta(t)\delta[\dot{x}(t)-f(x,t)-\eta(t)-y\delta(t-t_{0})]e^{-S[\eta(t)]}\\
& = \int\mathcal{D}\eta(t)\mathcal{D}\tilde{x}(t)e^{-\int\tilde{x}(t)(\dot{x}(t)-f(x,t)-y\delta(t-t_{o}))\, dt+W[\tilde{x}(t)]}\end{aligned}$$
</div>
<p>If $\eta(t)$ is delta correlated
($\langle\eta(t)\eta(t’)\rangle=\delta(t-t’)$) then $W[\tilde{x}(t)]$
can be Taylor expanded in both $x(t)$ and $\tilde{x}(t)$:</p>
<script type="math/tex; mode=display">W[\tilde{x}(t)]=\sum_{n=1,m=0}^{\infty}\frac{v_{nm}}{n!}\int\tilde{x}^{n}(t)x^{m}(t)\, dt.</script>
<p>Note that the summation over $n$ starts at one because
$W[0]=\log(Z[0])=0$.</p>
<h2 id="the-ornstein-uhlenbeck-process">The Ornstein-Uhlenbeck process</h2>
<p>As an example, consider the Orstein-Uhlenbeck process</p>
<script type="math/tex; mode=display">\dot{x}(t)+ax(t)-\sqrt{D}\eta(t)=0</script>
<p>which has the action</p>
<script type="math/tex; mode=display">S[x,\tilde{x}]=\int\left[\tilde{x}(t)(\dot{x}(t)+ax(t)-y\delta(t-t_{0}))-\frac{D}{2}\tilde{x}^{2}(t)\right]\, dt.</script>
<p>The moments could found immedately, since action is quadratic in
$\tilde{x}(t)$[^1], however we instead demonstrate how to study the
problem through a perturbation expansion. In this case the perturbation
will truncate to the exact, and already known, solution. The idea is to
break the action into a ‘free’ and ‘interacting’ component. The
terminology comes from quantum field theory in which free terms
typically represent a particle without any interaction with a field or
potential, and would have a quadratic action. The free action can
therefore be evaluated exactly, and the interaction term can be
expressed as an ‘asymptotic series’ around this solution. Let the action
be written</p>
<div>
$$\begin{aligned}
S & = S_{F}+S_{I}\\
& = \int\tilde{x}(t)\left[\dot{x}(t)+ax(t)\right]\, dt+\int\tilde{x}(t)y\delta(t-t_{0})-\frac{D}{2}\tilde{x}^{2}(t)\, dt\end{aligned}$$
</div>
<p>We define the function $G$, known as the the linear response function or
correlator or propagator, to be the Green’s function of the linear
differential operator corresponding to the free action:</p>
<script type="math/tex; mode=display">\left(\frac{d}{dt}+a\right)G(t,t')=\delta(t-t')</script>
<p>Note that $G(t,t’)$
is in fact exactly equivalent to $K(t,t’)$ from the generic Gaussian
stochastic process derived previously. Note also that, in general, the
‘inverse’ of a Green’s function$G(t,t’)$ is an integral operator
satisfying:</p>
<script type="math/tex; mode=display">\mathcal{L}G=\int dt''G^{-1}(t,t'')G(t'',t')=\delta(t-t')=\left(\frac{d}{dt}+a\right)G(t,t'),</script>
<p>for some $G^{-1}(t,t’)$. The operator $\mathcal{L}$ would indeed be such
an inverse for the following choice of $G^{-1}$:</p>
<script type="math/tex; mode=display">G^{-1}(t,t')=\left(\frac{d}{dt}+a\right)\delta(t-t').</script>
<p>The free
generating functional, then, is</p>
<script type="math/tex; mode=display">Z_{F}[J,\tilde{J}]=\int\mathcal{D}x(t)\mathcal{D}\tilde{x}(t)e^{-\int dtdt'\tilde{x}(t)G^{-1}(t,t')x(t)+\int\tilde{x}(t)J(t)\, dt+\int x(t)\tilde{J}(t)\, dt}.</script>
<p>So, analogous to the multivariate Gaussian case, we can evaluate this
integral exactly to obtain:</p>
<script type="math/tex; mode=display">Z_{F}[J,\tilde{J}]=e^{\int\tilde{J}G(t,t')J\, dtdt'}.</script>
<p>For the OU process we can in fact solve the linear differential equation
for Green’s function $G$: <script type="math/tex">G(t,t')=H(t-t')e^{-a(t-t')}.</script> The <em>free</em>
<em>moments</em> are then given by</p>
<script type="math/tex; mode=display">\left\langle \prod_{ij}x(t_{i})\tilde{x}(t_{j})\right\rangle _{F}=\left.\prod_{ij}\frac{\delta}{\delta\tilde{J}(t_{i})}\frac{\delta}{\delta J(t_{j})}e^{\int\tilde{J}(t)G(t,t')J(t')\, dtdt'}\right|_{J=\tilde{J}=0}.</script>
<p>Importantly, note that</p>
<script type="math/tex; mode=display">\left\langle x(t_{1})\tilde{x}(t_{2})\right\rangle _{F}=\left.\frac{\delta}{\delta\tilde{J}(t_{1})}\frac{\delta}{\delta J(t_{2})}e^{\int\tilde{J}(t)G(t,t')J(t')\, dtdt'}\right|_{J=\tilde{J}=0}=G(t_{1},t_{2})</script>
<p>and
$\langle\tilde{x}(t_{1})\tilde{x}(t_{2})\rangle_{F}=\langle x(t_{1})x(t_{2})\rangle_{F}=0$.</p>
<p>Since the only non-zero second order moments are those in which an
$x(t)$ is paired with an $\tilde{x}(t’)$ then Wick’s theorem means that
all non-zero higher order <em>free moments</em> must have equal numbers of
$x$’s as $\tilde{x}$’s. This is important in performing the expansions
below.</p>
<h3 id="using-feynman-diagrams">Using Feynman diagrams</h3>
<p>We have split the action into, loosely, linear and non-linear parts[^2]
$S=S_{F}+S_{I}$ so that the MGF can be written:</p>
<div>
$$\begin{aligned}
Z[J,\tilde{J}] & = \int\mathcal{D}x(t)\mathcal{D}\tilde{x}(t)e^{-S_{F}-S_{I}+\int\tilde{J}x+\int J\tilde{x}}\\
& = \int\mathcal{D}x(t)\mathcal{D}\tilde{x}(t)P_{F}[x(t),\tilde{x(t)}]e^{-S_{I}+\int\tilde{J}x+\int J\tilde{x}}\\
& = \int\mathcal{D}x(t)\mathcal{D}\tilde{x}(t)P_{F}[x(t),\tilde{x(t)}]\sum_{n=0}^{\infty}\frac{1}{n!}(-S_{I}+\int\tilde{J}x+\int J\tilde{x})^{n}\\
& = \sum_{n=0}^{\infty}\frac{1}{n!}\left\langle \mu^{n}\right\rangle _{F}\end{aligned}$$
</div>
<p>with $\mu=S_{I}+\int\tilde{J}x\, dt+\int J\tilde{x}\, dt$.</p>
<p>We have now expressed the MGF in terms of a sum of free moments, which
we know how to evaluate. To proceed, expand $S_{I}$:</p>
<script type="math/tex; mode=display">S_{I}=\sum_{m\ge0,n\ge0}V_{mn}=\sum_{m\ge0,m\ge n}v_{mn}\int x^{m}\tilde{x}^{n}\, dt.</script>
<p>In evaluating the expression for $Z$, there exists a diagrammatic way to
visualize each term that we need to consider for a desired moment.
Recall that the only free moments that are going to be non-zero are the
ones containing equal numbers of $x(t)$ and $\tilde{x(t)}$ terms. Wick’s
theorem then expresses these moments as the sum of the product of all
possible pairings between the $x(t)$ and $\tilde{x}(t)$ terms. Thus each
term of the multinomial expansion</p>
<script type="math/tex; mode=display">\left\langle \left(\sum_{n\ge0,m\ge0}v_{mn}\int x^{m}\tilde{x}^{n}\, dt+\int\tilde{J}xdt+\int J\tilde{x}dt\right)^{n}\right\rangle _{F}</script>
<p>can be thought of in terms of these pairings. The idea is that with each
$V_{mn}$ in $S_{I}$ we associate an <em>internal vertex</em> having $m$
entering edges and $n$ exiting edges. The $\int{J}\tilde{x}$ and
$\int\tilde{J}{x}$ terms contribute, respectively, entering and exiting
<em>external vertices.</em> Edges connecting vertices then correspond to a
pairing between an $x(t)$ and $\tilde{x}(t)$. Finally, since</p>
<script type="math/tex; mode=display">\left\langle \prod_{i=1}^{N}\prod_{j=1}^{M}x(t_{i})\tilde{x}(t_{j})\right\rangle =\frac{1}{Z[0,0]}\left.\frac{\delta}{\delta J(t_{i})}\frac{\delta}{\delta\tilde{J}(t_{j})}Z\right|_{J=\tilde{J}=0}</script>
<p>then only the terms in the expansion for $Z$ having $N$ entering and $M$
exiting external vertices (and thus $N$ and $M$ auxillary terms) will
contribute to that moment. These terms are represented by *Feynman
diagrams, *which is a graph composed of a combination of these vertices
and in which each of the $N$ external vertices is connected (paired
with) $M$ external vertices, possibly through a number of the internal
vertices. Moments can be simply computed by writing down all possible
diagrams with the requiste number of external vertices.</p>
<p>As an example, the coupling between external vertex
$\int\tilde{J}x\, dt$ and internal vertex
$\int\delta(t-t_{0})y\tilde{x}(t)\, dt$ in $Z$ can be evaluated as:</p>
<div>
$$\begin{aligned}
Z & = \left\langle \int dtdt'\,\tilde{J}(t)x(t)y\delta(t'-t_{0})\tilde{x}(t')\right\rangle _{F}+\text{all other terms}\\
& = \int dtdt'\,\tilde{J}(t)y\delta(t'-t_{0})\left\langle x(t)\tilde{x}(t')\right\rangle _{F}+\text{all other terms}\\
& = \int dt\, y\tilde{J}(t)G(t,t_{0})+\text{all other terms}.\end{aligned}$$
</div>
<p>But this is best explained diagrammatically. In our case we have:</p>
<script type="math/tex; mode=display">S_{I}=\int dt\, y\delta(t-t_{0})\tilde{x}(t)+\int dt\,\frac{D}{2}\tilde{x}^{2}(t),</script>
<p>and the relevant vertices are illustrated in Figure 1. The process for
then computing the first and second moment for the OU process is
illustrated in Figure 2. We can see that each term will be written as an
integral involving the auxillary functions $J$, $\tilde{J}$ and the
propagator $G$. In general, each vertex in each diagram is assigned
temporal index $t_{k}$.</p>
<figure class="center" style="width:300px">
<img src="../../images/feynman1.png" alt="img txt" />
<figcaption>Figure 1. Vertices involved in evaluating moments of example OU process. First
two vertices are internal vertices and are a part of the interacting
action $S_{I}$, the next two vertices are external vertices associated
with an auxillary variable $J$, $\tilde{J.}$ Each edge of a Feynman
diagram contributes a propagator $G(t,t')$.
</figcaption>
</figure>
<figure class="center" style="width:500px">
<img src="../../images/feynman2.png" alt="img txt" />
<figcaption>Figure 2. Computation of first and second cumulant using Feynman diagrams. Mean
is given by functional derivative with respect to one auxillary function
$\tilde{J}$, evaluated at zero. The only term non-zero term is
represented by a diagram containing one exiting vertex, and no entering
vertex. In this case the only diagram possible is composed of the
internal vertex representing the initial condition paired with the
exiting vertex. Evaluating the free moment and taking the functional
derivative of this term gives the mean in terms of $G(t,t')$. In a
similar fashion, the second cumulant is also calculated.
</figcaption>
</figure>
<p>In OU, in fact only a finite number of diagrams can be considered and
the exact mean and covariance can be determined. This is a result of the
linearity of the SDE: a linear SDE can be written to have no $x$ terms
in $S_{I}$, which means all internal vertices have no entering edges and
that all moments in $x$ must correspond to a finite number of diagrams
(in contrast to internal vertices with both entering and exiting edges
which can then be combined in an infinite number of ways). In this case,
from Figure 2, the mean and covariance are given by:</p>
<script type="math/tex; mode=display">\langle x(t)\rangle=yH(t-t_{0})e^{-a(t-t_{0})}</script>
<p>and</p>
<script type="math/tex; mode=display">\langle x(t)x(s)\rangle_{C}=D\frac{e^{2a(t-s)}-e^{2a(t+s-2t_{0})}}{2a}.</script>
<h2 id="in-summary">In summary</h2>
<p>We’ve seen how to construct a path integral formulation of a generic SDE. And have seen how to construct Feynman diagrams perform perturbation expansions for the solution. In a <a href="http://benlansdell.github.io/statistics/sdesII/">follow-up post</a> we will consider more examples of how they can be used.</p>Ben Lansdellben dot lansdell at gmail dot comIntroduction