data and optimizing with MATLAB's fmincon()

Joined
6/16/11
Messages
9
Points
13
Hello,
[.. this is a continuation of a recent threat, but a different question now]

I have a characteristic function which I can invert (via fourier transform) and supply it to fmincon() to estimate the parameters of my model. However, I don't know what to do with the data I have - I understand that I need to use it but don't know how.

The characteristic function I have is for the movement of (log-)prices Xt of a security in a jump-diffusion model: Xt = mu*t + sigma*Bt + sum(Xj). So, my characteristic function phi = exp{...} has several parameters that need to be estimated by fmincon(). I have data (the prices) but I don't know where to use it, since the characteristic function has no price variable in it. I know how to supply the data to fmincon() as extra parameter but not sure where to utilize it.

Any help would be greatly appreciated.

Thank you.
 
Hello,
[.. this is a continuation of a recent threat, but a different question now]

I have a characteristic function which I can invert (via fourier transform) and supply it to fmincon() to estimate the parameters of my model. However, I don't know what to do with the data I have - I understand that I need to use it but don't know how.

The characteristic function I have is for the movement of (log-)prices Xt of a security in a jump-diffusion model: Xt = mu*t + sigma*Bt + sum(Xj). So, my characteristic function phi = exp{...} has several parameters that need to be estimated by fmincon(). I have data (the prices) but I don't know where to use it, since the characteristic function has no price variable in it. I know how to supply the data to fmincon() as extra parameter but not sure where to utilize it.

Any help would be greatly appreciated.

Thank you.

Hi mikhairu,

I'm not sure I understand the problem. You have sampled data of the prices X(t) and you assume that they fit the model X(t)=mu*t+sigma*B(t)+sum(X(t)).

You also have a characteristic function of the sampled data or is it an analytic characteristic function of this model?

Ohad.
 
Hi mikhairu,

I'm not sure I understand the problem. You have sampled data of the prices X(t) and you assume that they fit the model X(t)=mu*t+sigma*B(t)+sum(X(t)).

You also have a characteristic function of the sampled data or is it an analytic characteristic function of this model?

Ohad.

Hi Ohad,

I have the analytic characteristic function for the model - and in it there are parameters that need to be estimated by fmincon(). But fmincon() needs the price data, of course, in order to estimate the parameters. But I'm not sure how to supply the price data properly.

[Basically, I'm using the maximum likelihood approach to estimate the parameters. The log-likelihood function that I supply to fmincon() for parameter estimation is just sum(log(inverted characteristic function which gives the conditional density function for the distribution of prices)). I have this part figured out but I don't know how to connect this with the price data.]
 
Hi Ohad,

I have the analytic characteristic function for the model - and in it there are parameters that need to be estimated by fmincon(). But fmincon() needs the price data, of course, in order to estimate the parameters. But I'm not sure how to supply the price data properly.

[Basically, I'm using the maximum likelihood approach to estimate the parameters. The log-likelihood function that I supply to fmincon() for parameter estimation is just sum(log(inverted characteristic function which gives the conditional density function for the distribution of prices)). I have this part figured out but I don't know how to connect this with the price data.]

Hmmmm, you're basically trying to do argmax(log(fy,theta(y;theta)) with respect to theta.
Where theta is the distribution parameters , y is the variable and fy,theta is the distribution given theta?

Well, analytically you're supposed to take the derivative with respect to each of the vector theta parameters, compare to zero and find the ML estimators.

Here you're trying to use fmincon approach instead, what are the constraints you intend to insert fmincon? You have some prior data of for theta to use as constraints?

Regarding to the actual sampled data,can you assume that each sample if independent of the others? Or do you know the conditional distribution?
 
Yes, the whole idea is that I'm inverting the conditional characteristic function to obtain conditional density.. [sample description is here http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.149.6889&rep=rep1&type=pdf around page 8 of the pdf]
I have some previous data for the initial search condition (based on previous research someone did). If I understand correctly theta is a vector with parameters that fmincon will estimate.. it'll start with initial search values and use the likelihood function to find the optimal solution..
 
Yes, the whole idea is that I'm inverting the conditional characteristic function to obtain conditional density.. [sample description is here http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.149.6889&rep=rep1&type=pdf around page 8 of the pdf]
I have some previous data for the initial search condition (based on previous research someone did). If I understand correctly theta is a vector with parameters that fmincon will estimate.. it'll start with initial search values and use the likelihood function to find the optimal solution..

I haven't read that in depth but from Eq (14) he talks about recalculating the distribution for different values of the parameter and then he finds the max.

I'm not sure where you insert the sampled data since the sampled data is a function of ALL the parameters you want to estimate.

y[n]=f(theta[1],theta[2],...,thetan[k],n)

Let's take a simple Gaussian example of AR(1) process :

You sample y[n]=theta*y[n-1]+w[n] where w[n] is a Gaussian white noise (i.i.d N(0,sigma^2)).
In this example you'll have fy[1,2,...,N](y,theta)=(1/sqrt(2*pi*sigma^2)^2*exp(sum((y[n]-theta*y[n-1])^2/2*sigma^2)

After taking the log and the derivative you'll get :
theta_ML=sum(y[n]*y[n-1])/sum(y[n]^2)

Only now you can use the sampled data.

Correct me if I'm wrong (don't think for a second I'm an expert in anything, I'm far from it) but first you need to do some analytic work on the model and get the equations to insert the sampled data into.

Trust me on one thing, always stop and write down exactly what you are going to do before you jump before the keyboard and start to script, it will save you a huge amount of time.....I know this from personal experience of wasting time trying to code things I haven't thought to the end.
 
Thank you very much, Ohad.
I will look into this in greater detail..

Hi mikhairu,

I thought of something that might fit your needs.
Lets take a simple case:
y[n]=x+w[n] , where x is a deterministic parameter and w[n] is i.i.d N(0,sigma^2) hence y[n] given x ~ N(x,sigma^2).
fy(y[1]...y[N] ; x ) = (1/sqrt(2*pi*sigma^2))^N * exp( -sum(y[n]-x)^2/(2*sigma^2) )

Taking the log and the derivative we get x_ML=sum(y[n])/N.

Now you can do:

1.Plot all your samples and see if their average is close x_ML, if so than the model was correct.

2.Get the ifft of the characteristic function you have been supplied and plot it, the max of this function should be around x_ML if it fits your model.

Overlapping the plot of the sampled data, the inverse of the characteristic function and the x_ML ( each with its own x axis { simply write plot(x1,y1,x2,y2,x3,y3....) } ) should give you a good direction in terms of if these samples fit the model and how far the ML estimator is , you can also use the ML estimator on only a part of the sampled data to see how it converges asymptotically.

Now all of this was fun and easy in this example, yours seems more complex but hopefully it will work too.

Tell me if this helps.
 
Thank you, Ohad. What you said totally makes sense. In my model it is slightly different though. The solution is described in Carr and Madan's paper "Option Valuation Using the Fast Fourier Transform" in Section 4 (starting page 10) if you are interested. Basically I discretize the analytic fourier transform to make it look like the FFT algorithm implementation (trapezoid/Simpson's rule). After that I do the fft() of the characteristic function (of course multiplied by the discretization factors) which returns the PDF over the discretized intervals. After that, I use spline() interpolation to determine the PDF values for my data... From there it's pretty straight forward to get the max-likelihood and so on.
Once again thank you so much for your valuable input, Ohad.
 
Hi Mikhairu,

Were you ever able to finalise your parameter fitting using the characteristic function in Matlab? I have been trying it on the VGSSD model for the past two weeks including exhaustively reading Carr's papers without success. Could you share your resources or refer me?
 
Back
Top Bottom