# Stylized facts in financial time series

Stylized facts in financial time series

Stylized facts are statistical properties emerging from the returns of financial time series that are present in almost every market.

## Getting stylized facts from an index

Getting stylized facts from an index

Although the mechanism which generates the financial time series it is not fully understood, making impossible to have a prediction on the next stock price, there are however some statistical properties inherent to the financial time series, these are called stylized facts. We can explore them using the FinancialData function, that conveniently can load the stock prices and returns.

Stylized facts are the result of many independent empirical studies on the statistical properties of financial markets that have been proven to be common across financial markets.

Stylized facts are the result of many independent empirical studies on the statistical properties of financial markets that have been proven to be common across financial markets.

This is how a financial time series usually look like: Random, noisy and in some cases similar to a random walk. In this case since we are using an index that tracks the most successful companies in an stock market it has a tendency of growth.

◼

We will start this exploration using the Mexican index IPC because it has had a growth in efficiency that can be seen in the stylized facts.

In[193]:=

DateListPlot[FinancialData["^MXX",All],PlotRangeFull,FrameLabel{"Date","Price"}]

Out[193]=

To get the stylized facts we need to compute the returns, that are a stationary measure of the price changes. Returns are defined as the price difference in a timespan.

In[194]:=

returns=FinancialData["^MXX","Return",All];

Let us plot the returns

In[195]:=

DateListPlot[returns,PlotRangeFull,FrameTrue,FrameLabel{"Date","Return"}]

Out[195]=

The first stylized fact is that returns lack autocorrelations. This is actually to be expected in an efficient market, because present prices have to reflect all information that is currently know of the market (assuming that investors are rational), making impossible to make a future prediction because the expected value of the future price would have to be the present price.

◼

Since FinancialData by default return the data in the {Date, Value} format, which was used to make the plots, we will have to separate each one into two variables in order to make the analysis.

In[196]:=

dates=returns[[All,1]];values=returns[[All,2]];ListLinePlot[CorrelationFunction[values,{50}],FrameTrue,FrameLabel{"Lag","Corr"}]

Out[197]=

But investors are not always rational, so autocorrelation in fact can be used to as an indicator of the efficiency of the market. More efficient markets often are less autocorrelated.

◼

We can plot the same data in different time windows and look at the value of autocorrelation at lag = 2. As time passes this market becomes more efficient.

In[269]:=

ListPlot[Map[CorrelationFunction[#,{20}]&,Partition[values,1000]],JoinedTrue,ScalingFunctions{"Log",None},PlotRangeFull,PlotLegendsMap[DateString[First[#],"ISODate"]<>" to "DateString[Last[#],"ISODate"]&,Partition[dates,1000]],FrameTrue,FrameLabel{"Lag","Corr"}]

Out[269]=

The autocorrelation of the absolute returns decays slowly

In[305]:=

ListLinePlot[CorrelationFunction[Abs[returns[[All,2]]],{50}],PlotRangeFull,FrameTrue,FrameLabel{"Lag",""}]

2

Corr

Out[305]=

This slow decay is explained by the volatility clustering. Volatility clustering means that the price change is mostly followed by another with similar magnitude.

There is an aggregational gaussianity on the returns, when calculated with time intervals Δt.

There is an aggregational gaussianity on the returns, when calculated with time intervals Δt.

Drop

In[328]:=

prices=FinancialData["^MXX",All];Returns[x_,Δt_]:=N[Log[Drop[x[[All,2]],Δt]]-Log[Take[x[[All,2]],{1,-(1+Δt)}]]];SmoothHistogram[Table[Returns[prices,Δt],{Δt,1,8}],PlotRangeFull,PlotLegendsTable["Δt = "<>ToString[i],{i,1,8}],FrameTrue,FrameLabel{"R","Density function"}]

Out[330]=

This convergence to a gaussian distribution as Δt increases, is apparent in the evolution of the kurtosis that converges to the normal distribution kurtosis value.

In[205]:=

ListLinePlot[Table[Kurtosis[Returns[prices,Δt]],{Δt,1,200}]-Kurtosis[NormalDistribution[]],FrameTrue,FrameLabel{"Δt","Kurtosis"},PlotRangeFull]

Out[205]=

Most measures of volatility of an asset are negatively correlated with the returns of that asset. This is the leverage effect. This happens because high volatility usually means a market in panic, where prices go down. Let us define the volatility as the absolute value of the returns and visualize it.

Returns’ distributions are characterized by heavy tails. A simple way to view this fact is to plot the histogram in a logarithmic vertical scale. Since the distribution is a power law, the histogram has a linear profile. In some cases there could be some events with abnormally large values that do not follow a power law. These are often indicators of an economic crisis.

◼

Notice that we are taking the positive values of the returns. One can also do exactly the same analysis for the negative part of the distribution.

Then we can visualize the points by adding them to the histogram.

Now we have a list of extreme events with their dates.

We can plot the dates that correspond to the extreme events.

Notice that most of them are packed together around known market crashes, so we can use FindClusters to find which extreme events correspond to a known market crash.

◼

Since the Mexican market it’s not as efficient as US markets we will showcase this behavior using the S&P 500 index. Also because this method it’s computationally expensive we will use a sub sample of 1000 values of the returns.

So the most plausible point of symmetry of the returns is

## A simple system with stylized facts: the game of life

A simple system with stylized facts: the game of life

One of the reasons of the relevance of stylized facts is that they allow us to construct models of financial markets under a microscopic point of view, and assess their effectiveness by checking if they are still able to reproduce the stylized facts. Many artificial stock markets have been modelled as agent based models or cellular automata models, and in fact even the game of life exhibits stylized facts. We will now search for them.

◼

We will iterate 2000 times the game of life with a board of 200x200. The greater the board the better the results will be.

Let’s define the “center of mass” of the game of life as

Then we can get all the center of masses. It looks like a random walk.

Then to construct a time series we can take the norm of the center of masses, and obtain a time series r. This r will be the observable of the system.

Returns show a more complicated structure that indicates that this is not a simple random walk. One can check by plain sight that there is some degree of volatility clustering.

There is aggregational gaussianity

as is evidenced by the convergence of the kurtosis.

The fat tails are a bit more tricky to visualize.

And it is not always clear to what degree they might be considered a power law.

Slow decay of absolute returns.

And leverage effect.

It seems that financial markets share many properties with a simple game of life. One question that remains open is, do they share common properties? or are stylized facts very common properties found across a wide range of complex systems that arise when carefully selecting an observable?

Further Explorations

Investigate if the stylized facts still appear using other measures of returns

Implement a trading strategy based on the stylized facts

Authorship information

Carlos Manuel Rodríguez Martínez

2017/06/23

fis.carlosmanuel@gmail.com