Personal tools
You are here: Home Community Unofficial Tutorials and Examples Random effects example collection Stochastic Volatility models with applications to financial data Stochastic Volatility models with applications to financial data

Stochastic Volatility models with applications to financial data

by Vita Petersone last modified Oct 15, 2009 02:47 PM

The basic Stochastic Volatility (SV) model was introduced by Taylor in early 80ies. It is a model which takes the conditional normalized log-returns of financial data to be normally distributed. 

Data

We use normalized log-returns of stock indices with 878 daily observations from 1 January 2005 to 30 June 2008, as a matter of fact the period just before the financial crisis. The data are downloaded from http://finance.yahoo.com/ and for later use we do the following commands in R to attain a .dat file.

#Download the spreadsheet from yahoo.com and save as yahoo_spreadsheed.dat
#Replace all "-" with ","
dat=read.table(file="yahoo_spreadsheed.dat", sep=",", dec=".", header=F)      #Read table in R
data=dat[,7]         #take the column number seven
data=rev(data)       #reverse
data=diff(log(data)) #achieve log-returns
data=data-mean(data) #normalize
n=length(data)
write(c(n,data), file="data.dat", sep=" ") #save as data.dat

 DJI

Log returns

See the .dat files for

Dow Jones Industrial Average stock index

Standard & Poor's 500 stock index

Hang Seng Index

Models

The basic SV model of Taylor is defined as follows

Xt = σX e (ht / 2) εt ,        t = 1, . . . , T,

ht+1 = φ ht + σ ηt ,         t = 1, . . . , T − 1,

where  (εt, ηt) ∼ N (0, 1) and σ, μ, φ constants. Noise variables εt and ηt are independent for all time steps.

As skewness is frequently observed in log-returns of financial data, it may seem more reasonable to assume the log-returns to follow a skew normal distribution ( http://en.wikipedia.org/wiki/Skew_normal_distribution ).

The skew normal SV model (SV-sn) is defined as SV model above with εt ∼ SN ( ξ,  ω 2, α), ηt ∼ N (0, 1), and σ, μ, φ constants. Noise variables εtt are independent for all time steps and ξ,  ω are defined such that E(εt) = 0 and Var(εt)=1. The skewed distribution has the following probability density function 

 Skew Normal Density

Another characteristic of financial data is the leverage effect. It means that we often observe higher volatility when equity prices decrease and lower volatility when prices increase. We can implement this characteristic in the previous model by letting εt and ηt depend on each other.

The skew normal SV model with leverage effect (SV-sn-lev) is defined as SV model above with εt ∼ SN ( ξ,  ω 2, α), ηt ∼ N (0, 1), and σ, μ, φ constants. Noise variables εt and ηt are correlated with coefficient ρ.

Note that our three models are nested. In case α = 0 for SV-sn model, we get the basic SV model. In case ρ =  0 for SV-sn-lev model, we get SV-sn model.

Parameter estimation

To calculate the estimates of the parameters we have to solve the likelihood function (see p.4 in http://www.mysmu.edu/faculty/yujun/Research/sml_ADMB13.pdf). Unfortunately an explicit solution of the integral does not exist. ADMB-RE approximates the integral by Laplace method or by Importance Sampling. Our task is to specify log{p(h1 | θ)}, log{p(ht | ht-1, θ)} and log{p(Xt | ht, θ)} and to present these in a template file. 

Since (h1 | θ) ~ (0, σ 2/(1- φ 2)), we have for all the three models above that log{p(h1 | θ)} = -0.5 log (2 π) - log(σ) + 0.5 log(1- φ 2) - 0.5 h12 (1- φ 2)/σ 

Since (ht | ht-1, θ) ~ (φ ht-1, σ 2), we have also for all three models that log{p(ht | ht-1, θ)} = -0.5 log (2 π) - log(σ) - 0.5 (ht - φ ht-1)2 /σ 2

The probability distribution function of (Xt | ht, θ) varies for the three models, because of different assumptions about εt.

Template file

We look on a .tpl file for Skew normal SV model step by step. Under DATA_SECTION we read in the data from a .dat file. Under PARAMETER_SECTION we define our parameters and set limits. For the basic SV model we have parameters φ , σ and σ X. For SV-sn model we have in addition the skewness parameter α and for SV-sn-lev model we have also correlation parameter ρ. As a number from 1 to 3 it is also defined in which phase the parameter should be estimated.

Under PROCEDURE_SECTION we define summations of log{p(h1 | θ)}, log{p(ht | ht-1, θ)} and log{p(Xt | ht, θ)} over all observations. Call these functions for sf1, sf2 and sf3. As mentioned above, the first two of these are the same for all three models, but the last one will differ. It is not always an easy task to define the probability distribution function of (Xt | ht, θ). Look for sf3 in templates for Skew normal SV model and Skew normal SV model with leverage effect to see how log{p(Xt | ht, θ)} may be defined for these models.

Further it is defined which parameters or other variables we are interested to see in an output file.

Running the models

 

Before running the program we have also to specify the starting points for iteration processes. This is done in a .pin file.

To run the SV-sn model we type

./sdv_n_skw -ind DJIdata.dat -ilmn 5

where the first phrase indicates which template file should be used and the second phrase specifies the input file. After running the model we get two output files. In the .par file the parameter estimates are specified as well as the estimates of all h values. In the .std file the standard deviations of estimates are listed. See examples here: Output data.

Diagnostics

Nested models can be compared by Akaike's Information Criterion (AIC). It is defined as AIC = 2k - 2ln(L) where k is number of parameters in the model and L is the maximazed likelihood function.

There can also be used Kolmogorov-Smirnov test, Jarque-Bera test, Ljung-Box test and ACF plot to examine if the residuals satisfy some particular properties as zero serial correlation, zero skewness and kurtosis.

For HSI stock index data we get following estimates:


SV SV-sn SV-sn-lev
φ  0.990 0.992
0.986
σ  0.133 0.118
0.153
σX  0.011  0.011 0.010
α   - 1.378
-1.863
ρ     -0.276
ln(L)  2687.11 2691.78
2696.38
AIC  -5368.22 -5375.56
-5382.76
K-S  0.001 0.033
0.359
J-Bera  0.033  0.001  0.000
L-B(20)  0.070  0.170  0.075
L-B(250)  0.095  0.258  0.074

 For standard deviations see Output data.

We see that for this dataset the SV-sn-lev model has the lowest AIC value, which may indicate that it explains the data best of all the three models. Null hypotheses for Kolmogorov-Smirnov and Ljung-Box tests are not to be rejected at 5% level for SV-sn-lev model, but null hypothesis for Jarque-Bera test is rejected ( H0: The residuals have no skewness and kurtosis). This is in accordance with the assumptions about εt in SV-sn-lev model.

Also for DJI and S&P 500 indices the SV-sn-lev explains the data better than the other two models.

Other models

There exist a number of different extensions of Stochastic Volatility models, for instance, a model where εt is assumed to follow a Students-distribution or skew Students-distribution. The template files for other models would look much the same as the ones listed above, except the sf3 function. This is where the probability distribution function of (Xt | ht, θ) comes forward.
 

References

Azzalini A. (1998/2008). «The skew-normal probability distribution (and related
distributions, such as the skew-t)». http://azzalini.stat.unipd.it/SN/
 
Skaug H. og Yu J. (2008). «Automated likelihood based inference for stochastic
volatility models». Working Paper, Singapore Management University. http://www.mysmu.edu/faculty/yujun/Research/sml_ADMB13.pdf
 
Taylor S. (1986). Modelling Financial Time Series. World Scientific Publishing Company.
ISBN 9812770844.
 
Yu J. (2005). «On leverage in a stochastic volatility model». Journal of Econometrics,
volume 127, number 1, pages 165–178.
Document Actions