Least Squares Monte Carlo for European Options
3 views (last 30 days)
Show older comments
Hi, I am trying to compare Spectral Methods, Black Scholes analytical and Least Squares Monte Carlo for European Put options.While Spectral method gives me a range of option values with different spot prices and its the same for Black Scholes. In case of LSM, I need to define a starting spot price and thus I am not getting the whole range of values like the other two methods. Can anyone help me out with a way to do least squares monte carlo and get a similar range like the spectral methods. Below is my LSM code.
T = 1.0; % Time to maturity
r = 0.03; % Risk free interest rate
sigma = 0.2; % Volatility
K = 40; % Strike price
S0 = 36; % Underlying asset price in-the-money
%S0 = 44; % Underlying asset price out-of-money
N = 50; % number of time steps
M = 100000; % 100k price paths
k = 3; % Number of Basis Functions used for Laguerre Polyomials
dt = T/N; % value of time step
t = 0:dt:T; % time vector
% Generate stock price matrix (100k price paths)
S = ones(M, N+1);
R = exp((r - sigma^2/2)*dt+sigma*sqrt(dt)*randn(N,M));
SS = cumprod([S0*ones(1,M); R]);
S = SS';
P = max((K - S(:,N+1)),0); %payoff at time T
for i = N:-1:2
itmP = find(S(:,i)); % All paths
X = S(itmP,i); % All price paths
Y = P(itmP)*exp(-r*dt); % discounted payoffs from continuation
A = BasisFunctions(X,k); % calculates basis functions
beta = A\Y; % regression coeff
C = A * beta; % Estimated continuation value
exP = itmP(K - X>0); % Paths where strike greater than spot
P(exP) = P(exP)*exp(-r*dt); %Insert payoffs and discount back one step
u = mean(P * exp(-r*dt)); % Value of the option
opt_val(i) = u;
plot(X,C,'-m')
0 Comments
Answers (0)
See Also
Categories
Find more on Financial Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!