You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Name of QuantLet : STFhes02Published in : Statistical Tools for Finance and InsuranceDescription : 'Plots the marginal pdfs in the Black-Scholes (GBM) and Heston models for [kappa,theta, sigma, rho] = [2, 0.04, 0.3, -0.05] as well as log-linear scale of the Heston marginal pdfs.The tails of the Heston marginal pdfs are exponential. Requires pdfHeston.m function.'Keywords : 'heston, simulation, geometric-brownian-motion, visualization, graphical representation,wiener-process, black-scholes, pdf'See also : pdfHestonAuthor : Rafal Weron, Agnieszka JanekSubmitted : Tue, September 18 2012 by Dedy Dwi PrastyoExample : pdfHeston.m plots the Heston marginal pdf and log of the pdf.
MATLAB Code:
% clear variables and close windowsclearallcloseallclc
standalone =0; % set to 0 to make plots as seen in STF2% Sample input:
kappa =2; % speed of mean revision of the volatility process
theta =.04; % long-term mean of volatility process
sigma =.3; % volatility
rho = -.05; % correlation between the spot price and volatility processes
x =-2:.02:2;
% Compute Heston marginal pdf at values in x
y = pdfHeston(x,theta,kappa,sigma,rho,1,0);
% Compute GBM marginal pdf at values in x
z = normpdf(x,0,0.2);
% Compare marginal pdf with Gaussian density of N(0,0.2)ifstandalone,
figure(1);
else
figure(1);
subplot(1,2,1);
end
plot(x,z,'r--',x,y,'b','LineWidth',1);
ifstandalone, title('Gaussian vs. Heston densities'); end
xlabel ('x');
ylabel ('PDF(x)');
legend('GBM','Heston',2)
set(gca,'xlim',[-11]);
ifstandalone,
figure(2);
else
subplot(1,2,2);
end
semilogy(x,z,'r--',x,y,'b','LineWidth',1);
ifstandalone, title('Gaussian vs. Heston log-densities'); end
xlabel ('x');
ylabel ('PDF(x)');
set(gca,'ylim',[1e-810],'ytick',[1e-81e-61e-41e-21]);