Estimate MarkovChain from data using ML


#1

It would be nice to have routines to construct the MarkovChain type / class in QuantEcon.jl / QuantEcon.py (which can be found here or here) from data. That is, the user provides a time series that shows transitions from across a finite number of states, and the routine returns a MarkovChain instance with transition probabilities corresponding to the empirical transition probabilities in the data. The standard estimation routine is max likelihood. See


#2

:+1: This would be great.

Relatedly, I would be keen on having a routine that takes continuous data and estimates a Markov Chain. You could rely on the assumption that there are N states (specified by the user) and that each observation is a “true state” plus (normally distributed) noise. This would be in the spirit of the the Hamilton QE example (I also think there is a famous example where he does a similar exercise for GDP growth) and other Hidden Markov models (some related calculations are worked out in appendix 2 of RMT 3).


#3

I was actually thinking of exactly this :wink:

One use would be as an alternative to methods like Tauchen’s method. You could take a specification of an arbitrary continuous state stochastic process (not just linear AR1!) and simulate it, and then estimate a corresponding discrete state Markov chain from the data.

Now you have a way to discretize any time homogeneous Markov process.

Assuming that this specified process is stationary and ergodic, it would be natural to somehow estimate the ergodic distribution from the simulated data, and then choose the state values for the Markov chain so that they concentrate in the region where the ergodic distribution puts most of its mass…


#4

Do you have some papers in mind that do something like this?

EDIT: I thought this had come up recently… One is linked in the discussion from a couple weeks ago (Alternative method for discretizing general state Markov processes).


Alternative method for discretizing general state Markov processes
#5

Right, thanks for making the connection. The method used in that paper is different again. It looks neat and we should probably start there first. But it would be good nonetheless to add an estimation routine to these MarkovChain objects that allows transition probabilities to be recovered from data, as discussed above.