estimate

quantecon.markov.estimate.estimate_mc(X)[source]

Estimate the Markov chain associated with a time series \(X = (X_0, \ldots, X_{T-1})\) assuming that the state space is the finite set \(\{X_0, \ldots, X_{T-1}\}\) (duplicates removed). The estimation is by maximum likelihood. The estimated transition probabilities are given by the matrix \(P\) such that \(P[i, j] = N_{ij} / N_i\), where \(N_{ij} = \sum_{t=0}^{T-1} 1_{\{X_t=s_i, X_{t+1}=s_j\}}\), the number of transitions from state \(s_i\) to state \(s_j\), while \(N_i\) is the total number of visits to \(s_i\). The result is returned as a MarkovChain instance.

Parameters:
Xarray_like

A time series of state values, from which the transition matrix will be estimated, where X[t] contains the t-th observation.

Returns:
mcMarkovChain

A MarkovChain instance where mc.P is a stochastic matrix estimated from the data X and mc.state_values is an array of values that appear in X (sorted in ascending order).