Serving the Quantitative Finance Community

 
User avatar
matlabnoob
Topic Author
Posts: 0
Joined: April 9th, 2010, 9:20 pm

Longsaff&Schwartz and fmincon in matlab

March 21st, 2012, 3:04 pm

Hi,I am trying to find parameters (in this case sigma and r), so that squared difference between price obtained by Longstaff&Schwartz algorithm and market price is minimal. Below are attached two codes. LSMX simulates paths of prices, then finds price of American option by Longstaff&Schwartz, and squares difference of this price from real market price. Second code is algorithm by fmincon to find parameters, sigma and r, which give minimal value for squared difference from market price (LSMX value).During optimization by fmincon, values of sigma and r, do not converge to any values but oscillate. What am I doing wrong?
 
User avatar
willsmith
Posts: 2
Joined: January 14th, 2008, 11:59 pm

Longsaff&Schwartz and fmincon in matlab

March 29th, 2012, 6:32 pm

One suggestion :fmincon assumes you are trying to minimize a DETERMINISTIC function, it will do something like a binary search (perhaps with Newton-Raphson or something) to choose each new value.But you are generating paths with RANDN inside the function you want to optimize, making it stochastic.Essentially you are asking matlab to find the bottom of a curve, but you are shaking that curve up and down. The optimizer doesn't realise that.Try reseeding the random numbers to the same value each time. Or pre-calcualte them and save them in a global array or something.
 
User avatar
matlabnoob
Topic Author
Posts: 0
Joined: April 9th, 2010, 9:20 pm

Longsaff&Schwartz and fmincon in matlab

October 14th, 2012, 9:44 am

Dear Will,Thanks for the answer, I have tried couple of options, changing matlab functions for minimization, but range of results is kind of too large. For example volatility is in a range of 0,18-034 or something like that, and drift has even worse results. So, i tried the function for global minimum, asamin, range is smaller but still not what I was expecting - something like 0,23-0,24 (a small range). Actually I don't get it, if someone asks me, estimate volatility and drift using Longstaff&Schwartz, I run this code, come back and say " Sir, volatility is somewhere between 0,18-0,34 and drift 0,05-0,11" what is the point? What do they use this model for? Is it fast, so they use it when they have already estimated parameters through some other method?By the way,nice stuff and articles at www.commoditymodels.com/:-) great job!
 
User avatar
willsmith
Posts: 2
Joined: January 14th, 2008, 11:59 pm

Longsaff&Schwartz and fmincon in matlab

October 25th, 2012, 7:31 pm

There's discussion of the longstaff and schwartz model here:http://www.wilmott.com/messageview.cfm? ... d=87942I'm not clear you've fixed the problem I mentioned that you can't expect a minimization functon to do a good job minimizing a function that isn't deterministic in the inputs.Put it another way - you are trying to roll a ball down a valley to find the global minimum error. But every point on that landscape is jumping around because your function does not return the same values each time you give it the same inputs. How do you expect the ball to ever come to rest?A hack would be just increase the number of paths - you should at least get less variation in your answers.