I'm looking to understand the problem of least squares monte carlo that is used in valuation of bermudan options, but from a simpler context.

Say I have random variables $X$ and $Y$ which are uniform [0,1] and independent. Define $Z=X^2+Y^2+XY$. Let us say I want to evaluate the expectation $E(X|Z=a)$ using Monte Carlo. Can least squares MC help in this case? If so, can anyone outline the process?

I'm trying to understand the core of the algorithm without the tedious notation one has to go through while reading papers and other articles explaining MC least squares.

New contributor
user121416 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • $\begingroup$ Can you give a reference? In my head, least squares MC is done in the context of processes. $\endgroup$
    – Bob Jansen
    Nov 23 at 11:10
  • $\begingroup$ @BobJansen demonstrations.wolfram.com/…. I suppose the idea should be more generally applicable, perhaps its most popular use is in analysis of processes. $\endgroup$
    – user121416
    Nov 23 at 11:12

The link in your comments mention section 11.6 of Numerical Methods in Economics by Kenneth Judd. I recommend giving that a read as well. It's only a few pages. Below some code that implements least squares Monte Carlo for the problem you gave:

fun <- function(x, y) x^2 + y^2 + x * y
N <- 1e3L
X <- runif(N)
Y <- runif(N)
Z <- fun(X, Y)
plot(Z, X)

# We can create a function of Z that gives an estimate of X:
model <- lm(X ~ Z + sqrt(Z))

# Call:
# lm(formula = X ~ Z + sqrt(Z))
# Coefficients:
# (Intercept)            Z      sqrt(Z)  
#     0.02860      0.07183      0.44900  

a <- seq(0, 3, by = 0.01)
x_hat <- 
  model$coefficients[[1L]] + 
    a * model$coefficients[[2L]] + sqrt(a) * model$coefficients[[3L]]
lines(a, x_hat, col = 'blue')

a against x_hat showing reasonable fit

  • $\begingroup$ Right, thanks. I see that this is a simple linear regression. Some follow ups a.) In option pricing, would you simulate a few continuation values conditional on the underlying value, regress, and then just use the regression in your pricing whenever you need a continuation value? b.) Are there some results based potentially on asymptotics/right choice of basis functions to provide a theoretical basis for doing this regression? $\endgroup$
    – user121416
    Nov 25 at 5:13
  • $\begingroup$ That's enough material for a new question IMO. You can check the Longstaff Schwarz paper which is quite accessible. Some time ago, I did an implementation in Python which is hopefully easy to follow. $\endgroup$
    – Bob Jansen
    Nov 25 at 6:44
  • 1
    $\begingroup$ Very useful thanks - it was notation wise easier for me to look at the original paper than the sources I had been referring before. $\endgroup$
    – user121416
    Nov 25 at 12:22

I am not sure how to outline that process without going through some notation. The definition of the conditional expectation $f(a)=E[X|Z=a]$ is that the function $f$ is such that the squared norm $E[(X-f(Z))^2]$ is minimized.

Least squares regression looks only for affine linear functions $f(a)=\beta\,a+\varepsilon$ (where $\beta,\varepsilon$ are the constants that are to be found). In your example $X$ is not a linear function of $Z$ (take a small $Y$ so see that it is more like $X\sim\sqrt{Z}$). Therefore I find it unlikely that an affine linear $f$ is a good candidate for $E[X|Z=a]\,.$ It is probably better to try Polynomial regression instead.

Python should have all the packages to simulate $X,Y,Z$ and try all sorts of regressions and compare.


Your Answer

user121416 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.