This is the MATLAB code that replicates the option pricing model proposed by Duan in his paper "The GARCH Option Pricing Model". However, the parameters estimated in the file do not match with the ones presented in the paper. I tried to fix it but I still get wrong parameter values.
Here's the .m file for the Maximum Likelihood Estimation:
function y = findGARCH_LLy(params,S,rf)
% Finds log-likelihood for the GARCH option pricing model.
alpha0 = params(1);
alpha1 = params(2);
beta1 = params(3);
lambda = params(4);
N = length(S);
% Define the returns.
r = log(S(2:N)./S(1:N-1));
r = [0; r];
% Initialize the GARCH log-likelihood at t=1.
h(1) = var(r);
e(1) = 0;
LL(1) = -0.5*log(2*pi)-0.5*log(h(1))-0.5*e(1)^2/h(1);
% Find the rest of the GARCH log-likelihood.
for t=2:N
h(t) = alpha0 + alpha1*(e(t-1) - lambda*sqrt(h(t-1)))^2 + beta1*h(t-1);
e(t) = log(S(t)/S(t-1)) - rf + 0.5*h(t);
LL(t) = 0.5*log(2*pi)-0.5*log(h(t))-0.5*e(t)^2/h(t);
end
% Return the negative log-likelihood.
y = -sum(LL);
Here's the main .m file:
clc; clear;
% Input the price levels and dates.
[P, Dates] = xlsread('SP 100 Prices.xls','Sheet1');
Prices = P(:,2);
% Risk free rate
rf = 0;
% Starting values for optimization.
% Use estimates from Duan's paper as starting values.
start = [0.000015 0.19 0.72 0.007];
A = [0 1 1 0];
b = 1;
lb = [0 0 0 0];
ub = [+Inf +Inf +Inf +Inf];
params = fmincon(@(b) findGARCH_LLy(b,Prices,rf), start, A, b, [], [], lb, ub)
alpha0 = params(1);
alpha1 = params(2);
beta1 = params(3);
lambda = params(4);
% Find the standard deviation (sigma) implied by the parameters.
% Assume 365 days per year.
variance = alpha0 / (1 - alpha1*(1+lambda^2) - beta1);
sigma = sqrt(variance)*sqrt(365);
For completeness of information, the estimated parameter values in the paper are $\alpha_0=1.524\times 10^{-5}$, $\alpha_1=0.1883$, $\beta_1=0.7162$ and $\lambda=7.452\times 10^{-3}$, and the standard deviation $\sigma=24.13\%$. Moreover, the model is fitted to the S&P 100 daily index from Jan 2, 1986 to Dec 15, 1989.
Can someone help me to find where my error lies? Thank you very much for your help.