SciFinanceŽ

Forum Navigation:


FORUMS > Numerical Methods Forum < refresh >
Topic Title: Max Likelihood estimation of the MRJD parameters.... Matlab
Created On Mon Feb 12, 07 10:17 PM
Topic View:

View thread in raw text format


MF01
Member

Posts: 42
Joined: Aug 2005

Mon Feb 12, 07 10:17 PM
User is offline

Hi,

I am trying to estimate the parameters of Mean Reverting Jump Diffusion model to a certain dataset.

When I run the MLE program in MATLAB to estimate these, the results of parameter values I get seem absurd ( Mean reversion level of 1000 :-() . I am minimizing the negative log likelihood function and the initial values I provided in the program were estimated from ordinary least squares for MR GBM model ( long term mean, MR rate, diffusion vol ) and the initial parameter values for jump parameters are from Recursive filter method.

In this program, I tried to minimize the log likelihood function with constraints on parameters like lower bound on long term mean, lower and upper bound on diffusion variance and mean reversion rate, and all other parameters being positive.

I would appreciate suggestions to solve this problem , are there are any mistakes in program set up ??

Thanks.

MF

....Main Program................

clear all;
clc;
% intial values

%PP = [ mu(long term mean value) , sigma^2 ( diffusion variance), alpha( mean rev rate) , lambda(jump intensity), mu_jump( average jump size )]
PP = [3.59,0.00633966,0.088,0.068493151,0.010678] ;
%
options = optimset('LargeScale','off','MaxFunEval',10000,'MaxIter',10000,'TolFun',1e-12);
warning off;

[P, fval] = fmincon('mrjdlike',PP,[],[],[],[],[],[],'confun',options);

......Constraints.........................................

function [cin, ceq] = confun(P)

cin = [ -P(1); -P(2) ; P(2) - 0.15; -P(3); -P(4); P(4) - 1; -P(5)];
%cin = [ -P(1); -P(2) ; -P(3); -P(4); P(4) - 1; -P(5)];
ceq = [];

.........Function Files.............................

function logLikelihood = mrjdlike(P);

load returnsdata.txt;
X= returnsdata(:,1);

N = max(size(X));
logLikelihood = 0;

for t=2:N
logLikelihood = logLikelihood - log(mrjd(X(t),X(t-1),P)+1);
end


function pdf = mrjd(x,x_,P);
%
mu = (P(1) - P(2)/(2*P(3)))*(1-exp(-P(3))) + exp(-P(3))*x_;
sigma2 = (P(2)/(2*P(3))*(1 - exp(-2*P(3))));
%
pdf = (1-P(4))*normpdf(x,mu,sqrt(sigma2)) + P(4)*normpdf(x,mu +P(5),sqrt(sigma2+ 0.05*sigma2)) ;
 
Reply
   
Quote
   
Top
   
Bottom
     



Rez
Senior Member

Posts: 438
Joined: May 2003

Mon Feb 12, 07 10:23 PM
User is offline View users profile

could you describe the model you are estimating and give the diffusion? is it vasicek + jumps?
is your jump variance 5% of the diffusion variance? why is that?

cheers

Kyriakos

-------------------------
www.theponytail.net

Every entity shall be identical to itself. Any entity caught being unidentical to itself shall be subject to a fine of up to one tenth of a cent.
 
Reply
   
Quote
   
Top
   
Bottom
     



MF01
Member

Posts: 42
Joined: Aug 2005

Tue Feb 13, 07 10:43 AM
User is offline

Thanks for the reply Rez.

It is vasicek model with jump component.



The reason I chose jump variance as a certain proportion of diffusion variance was because of the following paper, http://www.cls.dk/caf/wp/wp-18.pdf .......it describes the problem of getting negative variance values when estimating jump variance directly with other parameters.

I am fitting this model to a dataset of electricity log-returns...I tried many other ways, like inputting the bounds directly in fmincon function, rather than in confun ( constraint file) , but still I would get absurd results...In theory I think I am doing according to any text book example for constrained optimization. Am I missing any specific point in this problem.

Please let me know if you would like any more clarification on anything else.

Thanks.
 
Reply
   
Quote
   
Top
   
Bottom
     



Rez
Senior Member

Posts: 438
Joined: May 2003

Tue Feb 13, 07 01:06 PM
User is offline View users profile

Getting mean reversion of 1000 is not always absurd, if you have spikes in the process. In your model an upward jump can be captured, but then the process has to revert rapidly back to its long run value. The jumps accumulate. In your model you have a jump at the log-price level, while what you need I presume is an up-jump followed by a down-jump.

I am no expert in electricity, but I would go with something like that:
logS_t = X_t + J_t
X_t a mean reverting process
J_t a simple jump, not a compound Poisson process

Does that make sense to you?

Kyriakos

-------------------------
www.theponytail.net

Every entity shall be identical to itself. Any entity caught being unidentical to itself shall be subject to a fine of up to one tenth of a cent.
 
Reply
   
Quote
   
Top
   
Bottom
     



MF01
Member

Posts: 42
Joined: Aug 2005

Tue Feb 13, 07 04:05 PM
User is offline


There are not too many spikes in the data. Using recursive algorithm with 3 standard deviations bounds, I estimated around 25 jumps, that is considering electricity trades for 365 days.

As you suggested to use the simple jump diffusion model, do you mean, a constant jump size (J) increment in the process everytime a jump happens ? Which will reduce the estimation problem to estimating the parameters for a simple mean reverting model , rather than the mean reverting diffusion part plus the jump part.

I have some papers where the max. likelihood method has been used to estimate the parameters of the MRJD in the compound poisson framework to the energy market data ...electricity, oil, gas, etc. Also, most important reason is it is a class project that I have to do in the compound poisson framework.


 
Reply
   
Quote
   
Top
   
Bottom
     



tradingquest
Junior Member

Posts: 6
Joined: May 2005

Thu Apr 05, 07 05:02 PM
User is offline

Hi MF01 ..I am trying to calibrate two stochastics models jointly using MLE's ...did you have any success with your problem on using MLE for eastimating SDE's? Please let me know..Thanks
 
Reply
   
Quote
   
Top
   
Bottom
     



MF01
Member

Posts: 42
Joined: Aug 2005

Fri Apr 13, 07 03:17 PM
User is offline


Hi Tradingquest, I could not use MLE method for estimating all the parameters. I had an email correspondence with one prof., who confimed issues I was having with using MLE on estimating all parametrs. I am quoting his response,

("When you set up a ML method for the full model (mixing jumps and
diffusion), it may be hard for the algorithm to distinguish what are
jumps, and what are diffusions. Also, it may be that the mean-reversion
of the jumps are significantly faster than the mean-reversion of the
diffusion, and this may corrupt your results when you enforce the same
reversion.You could maybe use forward contracts to say something about the
long-term mean" )

I hope this helps.
Thanks.
F.
 
Reply
   
Quote
   
Top
   
Bottom
     



zeta
Senior Member

Posts: 1952
Joined: Sep 2005

Sun Apr 15, 07 10:57 PM
User is offline View users profile

I give octave/matlab MCMC code in another thread, you could compare the results of MLE vs MCMC b/c the latter certainly scales better with increasing numbers of parameters

-------------------------
Sometimes I Doubt Your Commitment to Sparkle Motion
 
Reply
   
Quote
   
Top
   
Bottom
     



fd2151
Junior Member

Posts: 1
Joined: Oct 2008

Mon Oct 27, 08 02:50 AM
User is offline

logLikelihood = logLikelihood - log(mrjd(X(t),X(t-1),P)+1);
I dot know where is the +1 from and you assume dt=1?
 
Reply
   
Quote
   
Top
   
Bottom
     

View thread in raw text format
FORUMS > Numerical Methods Forum < refresh >

Forum Navigation:

© All material, including contents and design, copyright Wilmott Electronic Media Limited - FuseTalk 4.01 © 1999-2014 FuseTalk Inc. Terms & Conditions