Hi Wojciech,
To answer you question, I used all the polynomials
with total degree less than a certain number (poly in
R) and I regressed only for in the money paths. I
always used many paths (at least 10,000) and so I did
not run into the problem of not having enough of them
(even though this can happen in the future). I also
save the state of the random numbers generator so that
I can reproduce the states of every path at every
time point and so I do not have to store all the paths
(storing them exhausts the memory very quickly).
I have a numerical question connected to this:
If there are N stocks then the number of all the
polynomial of degree <= 3 is C(N+3,3) where C(n,k) is
the binomial coefficient, and this is significantly
more than N. poly() produces that number of columns
and then least squares is applied. If the
corresponding matrix is X then the explicit formula
for least squares could be used ((t(X)*X)^-1...). To
calculate t(X)*X one can produce two columns at a
time, find their dot product and store the result. In
such a case we need memory space for only N+1 columns
(it may take a long time CPU-wise but in many cases
this is not an issue).
One possible problem is that using the explicit
formula is numerically inferior to the QR algorithm
which is usually used in least squares. Can anybody
say anything about how bad this can be? Let me just
note that we do not need very high precision here.
Regards,
Moshe.
P.S. I started a new job last week and so I am pretty
busy these days. I will try to post my code (without
the use of the explicit formula) over the weekend.
--- Wojciech Slusarski <wojciech.slusarski at gmail.com>
wrote:
Hi Mosche,
Once I have implemented L-S algorithm for pricing
american-asian
options. I am wondering, how stable it is for basket
options. What
sort of polynomials did you use? Are you regressing
only paths that
are in-the-money, or all? If yes, what do you do,
when the number of
paths is lower, than the number of coefficients in
the regression?
Unfourtunately my code is not a generic one, and is
not useful for
pricing different option from the one I was pricing,
so sharing that
code would not bring any benefit to anybody, though
if that is
possible, I would appreciate a lot if you could send
me your
implementation if that is a flexible code.
Best regards,
Wojciech
2008/1/16, Moshe Olshansky <m_olshansky at yahoo.com>:
Hi Michel,
I wrote an R code implementing Longstaff-Schwartz
algorithm for pricing American put Basket option
the portfolio value). This code can be easily
to value call option (I intend to allow for "any"
payoff function in the future).
I can send you this code. It is in a very
state, so even though I did some basic testing I
not guarantee it to be correct.
Regards,
Moshe.
--- MAB <MichelBeck at sbcglobal.Net> wrote:
Hi!
I am looking for R code to price a multiple
basket option.
So far I only found a 2 asset pricer (in the
R-metrics packafe fExoticOption).
Where could I find some code for at least 4