# FxPaul

Math in finance or vice versa

## Markov Chain for historical volatility

In previous post we used Markov Chain to discover a behavior of historical volatility and find out the 3/2 rule for ups and downs of random variable.

Now let’s construct more complicated model with the following volatility changes as states in chain:

1. Less than -25%: denote it as -100.
2. From -25% to -15% : -20.
3. From -15% to -5% : -10.
4. From -5% to 5% : 0.
5. From 5% to 15% : 10.
6. From 15% to 25% : 20.
7. More than 25% : 100.

## Stationary distribution in general

If Markov chain has states enumerated from 1 to N than probability of each state in stationary distribution is:
$p_j = \sum_{i=1}^N {P(j|i) p_i}$
and state probabilities must sum up to one:
$1 = \sum_{i=1}^N p_i$
or in matrix form:
$P = A P$
where
$P = \left( \begin{array}{c} p_1 \\ p_2 \\ \vdots \\ p_N \\ 1 \end{array} \right)$
and the last row of transition matrix specifies the constraint on probabilities:
$A = \left( \begin{array}{ccccc} P(1|1) & P(1|2) & \cdots & P(1|N) & 0 \\ P(2|1) & P(2|2) & \cdots & P(2|N) & 0 \\ \vdots & \vdots & \cdots & \vdots & \vdots \\ P(N|1) & P(N|2) & \cdots & P(N|N) & 0 \\ 1 & 1 & \cdots & 1 & 0 \\ \end{array} \right)$
The upper side of the transition matrix is in fact a left stochastic matrix and by Perron-Frobenius theorem it has spectral radius $\rho(A) = r$. This radius is a positive real number and it is an eigenvalue of the matrix, called the Perron-Frobenius eigenvalue. It satisfies the inequalities:
$\min_i \sum_j a_{ij} \leq r \leq \max_i \sum_j a_{ij}$
As each column of transition matrix is a conditional probabilities and sums up to one:
$1 \leq r \leq 1 \implies r = 1$
Thus spectral radius of transition matrix is equals one. The added zeros and ones just give additional eigenvalue zero and don’t influence the spectral radius

The stationary distribution is in fact an eigenvector with $\lambda = 1$:
$A P = \lambda P$
But in general case the eigenvector might not satisfy the probability constraint, i.e. non-negativity and sum up to one. Stationary distribution problem reduces to linear system of equations:
$(A-I) P = 0$
This system might have no solutions, one solution or infinitely many solutions in case of collinearity. Therefore, Markov chain might have no stationary distribution, one stationary distribution and infinitely many distributions.

## Transition probabilities for USD/CHF

From the experimental data of the year 2010 the following state transition matrix is deduced using Laplacian smoothing with k=1 and 7 classes.

From\To -100 -20 -10 0 10 20 100
-100 3.34 % 3.33 % 13.33 % 13.33 % 6.67 % 20.00 % 40.00 %
-20 6.25 % 6.25 % 9.38 % 18.75 % 21.88 % 18.75 % 18.74 %
-10 8.62 % 6.90 % 17.24 % 18.96 % 17.24 % 12.07 % 18.97 %
0 3.13 % 4.69 % 15.62 % 39.06 % 14.06 % 10.94 % 12.50 %
10 6.98 % 20.94 % 23.26 % 18.60 % 11.62 % 6.97 % 11.63 %
20 15.15 % 18.18 % 21.22 % 18.18 % 12.12 % 6.06 % 9.09 %
100 25.53 % 14.89 % 27.66 % 8.51 % 14.89 % 4.26 % 4.26 %

Or by transposing the table and fitting it into the matrix form:
$A = \left( \begin {array}{cccccccc} 0.0334& 0.0625& 0.0862& 0.0313& 0.0698& 0.1515& 0.2553& 0\\ 0.0333& 0.0625& 0.0690& 0.0469& 0.2094& 0.1818& 0.1489& 0\\ 0.1333& 0.0938& 0.1724& 0.1562& 0.2326& 0.2122& 0.2766& 0\\ 0.1333& 0.1875& 0.1897& 0.3906& 0.1860& 0.1818& 0.0851& 0\\ 0.0667& 0.2188& 0.1724& 0.1406& 0.1162& 0.1212& 0.1489& 0\\ 0.2& 0.1875& 0.1207& 0.1094& 0.0697& 0.0606& 0.0426& 0\\ 0.4& 0.1874& 0.1897& 0.1250& 0.1163& 0.0909& 0.0426& 0\\ 1& 1& 1& 1& 1& 1& 1& 0 \end {array} \right)$

## Stationary distribution

The transition matrix eigenvector for eigenvalue 1 is approximately:
$P_1 = \left( \begin{array}{c} 0.0909 \\ 0.4534 \\ -0.3242 \\ -0.3133 \\ -0.2274 \\ -0.1101 \\ 0.0 \\ 0.1179 \end{array} \right)$
As we can see the eigenvector doesn’t satisfy non-negativity requirement for probabilities. So it implies that this Markov chain doesn’t have stationary distribution.

No stationary distribution means that either the chain is reducible and/or some of its states are null-recurrent and/or periodic. The chain in consideration is obviously is irreducible because all states are in on communication class, i.e. it is possible to reach each state from another state. Therefore, there are 2 possibilities non-exclusive:

• There are some null-recurrent or transient states.
• The chain is k-periodic with k greater than 1.

The question will be considered in the next article.