Path: blob/master/1.5 SDE - Lévy processes.ipynb
1675 views
Simulation
Merton distribution
(I took this formula from section 4.3 of [1] )
Merton characteristic function
Plot
Parameter estimation
In this section I will use the function scipy.optimize.minimize
to minimize the negative of the log-likelihood function i.e. I'm going to maximize the log-likelihood.
This is not an easy task... The model has 5 parameters, which means that the routine will be very slow, and we are not sure it will work. It is possible that the log-likelihood function has several local maximum points, or that some overflows appear.
We have to try several methods until we find the one that better performs.
Let us firts analyze our simulated data:
Maximum Likelihood Estimation
Initial guesses are important! We can gain some information of the unknown parameters from our data.
I use:
The mean of a Merton process is . See notebook A.3.
therefore we can assume equal contribution from
mu
andlam * muJ
. So,mu
=0.1. Of course this is just an initial guess.Diffusion coefficient of 0.5 is quite reasonable. A standard deviation of about 0.85 computed above contains also the effects of jumps.
We don't have information on lambda, so we choose in order to keep the formula for the mean consistent.
The histogram has positive skew. The parameter (or
muJ
) affects the skewness. The value 0.1 makes sense.About
sigJ
I set it to , because I expect that a jump has a standard deviation higher than the usual diffusion standard deviation.
Very good!!
The BFGS and Nelder-Mead methods work! The results are printed in the last line, and we can see that the values correspond to the original values.
I tried also L-BFGS-B and SLSQP which instead do not work.
See here for a list of possible methods: link
Variance Gamma process
Usually the Gamma distribution is parametrized by a shape and scale positive parameters
The random variable has the shape parameter dependent on (the shape is a linear function of ). The density function is
with
When working with the VG process, it is common to use a parametrization such that
therefore and . Inverting we obtain , .
The new parametrization is with respect to the new parameters and , such that
Variance Gamma
If we consider a Brownian motion with drift
and substitute the time variable with a Gamma random variable , we obtain the Variance Gamma process:
where we chose with in order to have .
It depends on three parameters:
, the volatility of the Brownian motion
, the variance of the Gamma process
, the drift of the Brownian motion
The characteristic function is:
The first four moments are:
Additional information can be found in A.3.
Simulation
VG Density
Fourier inversion of the VG characteristic function
Histogram vs density vs Fourier inversion
Parameter estimation
Let us consider a VG process with an additional (deterministic) drift :
such that .
This is a more general setting that keeps into account a possible "location" parameter for the VG distribution (the function VG_density
already considers the location parameter ).
The formulas for higher order moments are unchanged. The characteristic function if is:
Approximated Method of Moments
This method suggests to consider only the first order terms in and ignore , and . This method is motivated by the fact that usually is quite small.
Since there are 4 parameters to estimate, we need 4 equations i.e. the formulas for the first 4 moments. We get:
Inverting we have:
From the formulas above we obtained interesting information:
The parameter is connected with the skewness. (The sign of indicates if the distribution has positive or negative skewness)
The parameter represents the amount of kurtosis of the distribution.
The approximated method gives very good results!!
Only two remarks:
We simulated the process with and . Therefore, only the parameter contributes to the mean of the distribution. The results of this estimation process, assign a little part of the true value of to , which instead should be zero.
The estimated value of the parameter is not very precise.
Let us see if we can do better!
MLE
An alternative method to estimate the parameters is to use the Maximum Likelihood Estimator.
In the following cell I use the function scipy.optimize.minimize
to minimize the negative of the log-likelihood, i.e. I maximize the log-likelihood.
Since there are 4 parameters to be estimated, the routine can be very slow. Fortunately there are some tricks we can use in order to speed up the task.
We can use the values estimated with the approximated method of moments as initial guesses. It is reasonable to expect that they are quite good initial guesses.
Look at the Histogram above. From the histogram we can extract some information:
The range for the mean i.e.
The skewness is negative, therefore must be negative. I chose the interval .
For and I chose the reasonable intervals and .
Using a method with constraints such as 'L-BFGS-B' is helpful to reduce the computational time.
Very good!
These values (the last line of the output) are very satisfactory!
Inverse Gaussian (IG) distribution
Usually, the IG distribution is parametrized by two parameters: the mean () and the shape ():
where
with
The python function scipy.stats.invgauss is implemented for . To generate a distribution with a different , we have to scale both the variable and the mean :
The IG distribution is the distribution of the first passage time of a Brownian motion with drift , for a barrier .
If we let the barrier to be a linear function of the time , we obtain the IG process.
IG process
The IG process can be defined as:
where is a Brownian motion with drift and unitary diffusion coefficient. The IG process at time is distributed as
It is useful to consider the parameterization in terms of mean () and variance (). The variance is . By changing variables we get . Let us call
Ok... let us see if it works...
Normal Inverse Gaussian (NIG)
Following the same argument used to build the Variance Gamma process, we consider a Brownian motion with drift
and substitute the time variable with an Inverse Gaussian random variable , we obtain the Normal Inverse Gaussian process:
where we chose
with and in order to have .
The NIG process depends on three parameters:
, the volatility of the Brownian motion
, the variance of the IG process
, the drift of the Brownian motion
The characteristic function is:
The first four moments are:
Simulation
NIG Density
The NIG density usually is indicated with the parameters:
See [3] for instance. However, I prefer to use the () parameters, as in [1].
The following function corresponds to the NIG() density:
Fourier inversion of the NIG characteristic function
Histogram vs density vs Fourier inversion
References
[1] Rama Cont and Peter Tankov (2003) "Financial Modelling with Jump Processes", Chapman and Hall/CRC; 1 edition.
[2] Madan D. and Seneta E. (1990) "The Variance Gamma model for share market returns". The journal of Business. 63(4), 511-524
[3] Barndorff-Nielsen, Ole E. (1998) "Processes of Normal Inverse Gaussian type" Finance and Stochastics 2, 41-68.