# Least Square Monte Carlo Longstaff-Schwartz method implementation problem

While trying to implement the Least Square Monte Carlo (LSMC) method by Longstaff-Schwartz I came across an error I am not quite sure how to fix.

The method uses a regression method (be it Multiple linear or Polynomial regression) to find the continuation value. In my solution I use matrix multiplication to find the coefficients with which to find the continuation value for all the paths in the money. However I discovered that if only 1 or 2 paths are in the money and since we only use the paths in the money to find the coefficients for the continuation values then my method can not find the coefficients. This is because I would get matrix's which have a determinant of 0. And the formula for finding the coefficients is: $$\begin{equation} b = (X'X)^{-1} X'Y. \end{equation}$$ And since a matrix with a determinant of 0 can't have an inverse, my implementation won't work.

$$\textbf{The solution I found in case of 2 paths:}$$

In my multiple linear regression I used $$(1, x, x^2)$$ as my $$X$$ matrix and in order to fix the problem I went from 3 variables to two which meant that my $$X$$ matrix now consisted of $$(1,x)$$.

$$\textbf{The problem}$$

What do I do when only a single path is in the money? How do I find a continuation value?

## 1 Answer

Use Singular Value Decomposition to solve for the linear least squares problem in the regression. See for instance numpy.linalg.lstsq in python.

• Do you by chance know how this function can find a linear regression when I give it a single row of data? for instance where A = [[1,0.3]] and y = [-1]. Because once again this should give me a matrix that doesn't have an inverse because $X'X$ is a matrix with determinant equal to $0$. – John.Doh Apr 27 at 14:06
• Standard implementations of linear least square use SVD so it does not matter what the rank of the matrix is. Lookup Linear Least Squares Problems SVD for more details. – Antoine Conze Apr 27 at 14:24
• Just a naive question if I may: If we have only one continuation value to apply the regression to, we will fit to that one value perfectly. Isn't this equivalent to using future information when making the decision whether to exercise? I.e. in effect we decide using the actual continuation value which will be realised in this one path? Thanks! – Robert Apr 28 at 8:27