rmcgibbo/mixtape — pull request #331 by rmcgibbo (2014-11-24 02:01:48+00:00)
Title: [ENH] Continuous time MSM (MLE rate matrix estimator)

This is a full implementation of maximum likelihood estimation of a continuous-time markov process. The math (in particular the analytic gradient) is from [a 1985 paper by Kalbfleisch and Lawless](http://www.jstor.org/discover/10.2307/2288545?uid=3739560&uid=2&uid=4&uid=3739256&sid=21104617114271).

The log likelihood function is `L(\theta) = \sum_{ij} [C_{ij} log(expm(K(\theta))_{ij})]`, where `C` is the matrix of observed counts, `K` is the rate matrix, and `T=expm(K)` is the matrix exponential, and `\theta` is a vector of free parameters. For this model, `K` is constrained to satisfy detailed balance, so `\theta` is of size `n*(n-1)/2 + n` (upper triangular elements and equilibrium vector). Once you diagonalize `K`, the gradient of the matrix exponential becomes not too onerous to compute.

cc @mpharrigan, @kyleabeauchamp, @vijaypande