# On the origins of some stochastic processes

### Javier Cárdenas

#### 30/06/2022

Stochastic processes play a key role in modelling the behavior over time of many financial assets. These mathematical descriptions of reality help making investment decisions. They can be used to price stock market options, make Monte Carlo simulations or define probabilities of expected returns, among others.

In today’s post we will explore the origins of two of the most common stochastic processes used in finance: Markov chains and Wiener processes.

## Stochastic processes

Consider a system that can be in any state of a given set of states and that the system changes, from one state $$x_t$$ to another state $$x_{t+1}$$, are caused by any random mechanism. Then, the variables $$x_i$$ will be random variables for any given i. This collection of variables $$x_i$$ is the definition of an stochastic processes and we use it to describe the evolution of a system over time.

Usually, the random variables that make up the process are not independent from each other. It’s this dependency between variables which distinguish some stochastic processes from others.

Even though so far I have talked about finance, there are an uncountable number of applications in many other fields, such as physics, biology, chemistry… as we will see.

## Markov chains

Markov chains are a type of discrete stochastic processes where the probability of event only depends on the last past event. This is:

$$p(x_{n+1} | x_0, …, x_n) = p(x_{n+1} | x_n)$$

The name comes from the Russian mathematician A. Markov who, in 1913, introduced this concept when he was making an statistical investigation in poetry .

A. Markov was trying to put into practice some of the discoveries he had made in the past proving that the law of large numbers applies perfectly well to systems of dependent variables if they meet certain criteria .

In his investigation, A. Markov was trying to discover any dependency between the letters of a poem. For this task, he collected 20.000 letters from the poem of Alexander Pushkin and counted the: 1) number of vowels and consonants in the poem and 2) the number of times two consecutive vowels or consonants appeared in the poem.

The results where:

1. A total of 8.638 vowels and 11.362 consonants.
2. The number of paired vowels, this is, when two vowels appear consecutively in the poem was 1.104 and 3.827 paired consonants. The rest of the time you had a vowel followed by a consonant or a consonant followed by a vowel.

He knew that, if the letters of the poem where independent, the probability of finding two vowels consecutively would be:

$$p(x=vowel)^2 = (\frac{8638}{20000})^2 = 0.187$$

But his analysis showed a completely different result. The probability of finding two consecutive vowels in the poems was $$\frac{1104}{20000} = 0.055$$, almost three times as less as the one above. This gave him enough evidence to proof that there was certain dependency between the letters of the poem.

### Poems experiment

We have decided to run the same experiment but this time with Spanish poems. We have selected the dataset available on Kaggle. This dataset contains 757.263 letters (leaving out spaces, dots, comas…).

Our process has two states: vowel and consonant

Our total number of counts are:

Which gives us the transition matrix:

$$P = \begin{pmatrix} 0.137 & 0.863\\ 0.775 & 0.225 \end{pmatrix}$$

Thanks to the works of A. Markov, we can give answers to questions such as:

If we start reading an Spanish poem and the first letter is a consonant, what are the probabilities that we will find a vowel 50 letters after?

$$p(x_{50}=vowel | x_0 = consonant) = P_{2,1}^{50} = 0.473$$

### Stocks experiment

We will do another simple experiment with stocks. This time we will be using Markov chains to describe the processes of the returns of the highest price of each day. For similar experiments on stocks, take a look at some other great posts on the topic (1, 2 and 3)

For our experiment we will be using the data of EURUSD from 2010. The two possible states are: positive and negative.
Positive/negative when today’s highest price is higher/lower than yesterday’s highest price.

The total number of positive and negative states are:

So our transition matrix will be:

$$P = \begin{pmatrix} 0.541 & 0.459 \\ 0.422 & 0.578 \end{pmatrix}$$

If you hold the asset for 20 days starting from today and today’s highest price was lower than yesterday’s highest price, what is the expected number of days that we would find negative returns (for the highest price series) during the time we hold the asset? This is: $$E[N_2(20)]=M_{20}[2, 2]$$.

Where $$M_0 = I$$ and $$M_n = I + P*M_{n-1}$$

This gives us the final results of: 11.5 days. So if today’s highest price was below yesterday’s highest price, we would expect to see this same case repeated, on average, 11.5 days for the next 20 days.

## Wiener processes

If you work in finance you will have probably heard of this process as it used in some valuable calculations such as pricing stock market options.

The Wiener processes is the most important Markov process with a continuous state of space and time. Given a stochastic process $$W_t$$ the Wiener processes satisfies the following conditions:

1. $$W_0 = 0$$
2. $$W_t$$ is continuous in t
3. $$W$$ has Gaussian increments.
4. $$W$$ has independent increments.

Its origins date back to 1827 when Brown discovered with his microscope, during his investigation on the fertilization process of a plant, a rapid and unpredictable movement of small pollen particles suspended on water, even though he could not see any force acting on them . This movement of particles was named Brownian motion.

Even though there were many hypothesis trying to explain this movement it was not until 1905 when Albert Einstein discovered that the chaotic movement of the pollen particles was due to the continuous hit of random molecules of water  (yes, the same year in three different papers he introduced the revolutionary idea that light comes in packages called photons, the special relativity theory and the equivalence of matter and energy with his famous equation $$E=mc^2$$)

It was Wiener who, years after in 1923, made some further investigations on the mathematical properties of the one-dimensional Brownian motion . From him we have that the density function of the one-dimensional movement of pollen particles suspended can be expressed as:

$$f_{w_{t}}(x) = \frac{1}{\sqrt{2\pi t}} e^{-\frac{x^2}{2t}}$$

This, in fact, is no other thing than a Normal distribution with $$\mu = 0$$ and $$\sigma=\sqrt{t}$$.

### Stocks experiment

Below you can see an example of a Wiener process in a two dimensional space representing two assets. As you can see, there is barely any differences between the simulated random movement of pollen particles and the movement of two assets in a two-dimensional space.

Pure Mathematics Is, In Its Way, The Poetry Of Logical Ideas

Albert Einstein

## Conclusions

In today’s post we have seen the origins of some of the most common stochastic processes used in finance.
Sadly we didn’t have time to see in detail the equations that lead to these concepts and we leave this task for the following post.

Thank you for reading and hopefully next time you read poetry or watch the flowers in spring you can see as well the mathematical expressions that govern them. Or maybe just think on your next trading strategy.

## References

 Brown, R. (1828). XXVII. A brief account of microscopical observations made in the months of June, July and August 1827, on the particles contained in the pollen of plants; and on the general existence of active molecules in organic and inorganic bodies. The philosophical magazine4(21), 161-173.
 Einstein, A. (1956). Investigations on the Theory of the Brownian Movement. Courier Corporation.
 Wiener, N., Rankin, B., Siegel, A., & Martin, W. T. (1966).
 Markov, A. A. (2006). An example of statistical investigation of the text Eugene Onegin concerning the connection of samples in chains. Science in Context19(4), 591-600.
 First Links in the Markov Chain. Brian Hayes