Scilab code to estimate Asian call option using the control variates method
Hello everyone,
I need to estimate Asian call option based on the arithmetic mean by using the control variates method. Since we have the exacte value of the option with geometric mean (Black-Scholes formula), i choosed the geometric mean as a control variates for the arithmetic mean.
The problem is that i'm getting the same values (graph) for the confidence interval limits and the estimate values.
Please help me to fix it.
Thanks in advance.
clear;
clc;
K = 120;
S0 = 100;
r = 0.04;
sigma = 0.4;
sigma2 = sigma^2;
T = 1;
n = 52;
dt = T/n;
t = 0:dt:T;
Nmax = 100;
z = 1.96;
sigman=(sigma/n)*sqrt(((n+1)*(2*n+1))/6);
sigman2=sigman^2;
rn=(r-0.5*sigma2)*(0.5*(n+1)/n)+0.5*sigman2;
d1 = (log(S0/K)+(rn+0.5*sigman2)*T)/(sigman*sqrt(T));
d2 = d1-sigman*sqrt(T);
ECg = exp(-r*T)*(S0*exp(rn*T)*cdfnor("PQ",d1,0,1)-K*cdfnor("PQ",d2,0,1));
function S=f(x)
S = ones(1,n);
for i = 1:n
u = exp((r-0.5*sigma2)*t(i+1)+sigma*x*sqrt(t(i+1)));
S(i)= u;
end
endfunction
function [CI_low, CI_up, CV]=integralCV(N)
S1 = 0;
S2 = 0;
for i = 1:N
u = grand(Nmax,1,"nor",0,1);
St = S0 * f(u(1));
ht1 = max(mean(St)-K,0);
ht2 = max((prod(St))^(1/n)-K,0);
ht = ht1-ht2;
S1 = S1 + exp(-r*T)*ht;
S2 = S2 + (exp(-r*T)*ht)^2;
end
CV = S1 / N + ECg;
stdev = sqrt((1 / (N-1))*( S2 - N*CV^2 ));
CI_low = CV - z * stdev / sqrt(N) ;
CI_up = CV + z * stdev / sqrt(N) ;
endfunction
D = 10:1:Nmax-9;
for i=1:length(D)
[CI_lowerCV(i), CI_upperCV(i), CV(i)] = integralCV(D(i));
clf();
plot2d(log10(D)', [ CI_lowerCV CI_upperCV CV], [ 3 5 2 ]);
legend([ "Lower Bound (CV)" "Upper Bound (CV)" "CV"]);
title("Estimation of E[Ca] by the control variates method");
- unanswered
- 129 views
- Pro Bono
Related Questions
- Product of Numbers from a Log Normal Distribution
- Statistical analysis on a 2 dimensional data set
- Applied Probability
- Density plot
- [Combinatorics] Selections, Distributions, and Arrangements with Multiple Restrictions
- Probability and Statistics Question
- Cramer's Theorem question
- Probability - Expectation calculation for a function.
This is a very advanced problem...