Home > code > plot > plot_pcsv_sim.m

plot_pcsv_sim

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 cd('..');
0002 boot;
0003 cd(cgmm_config.directories.plot);
0004 
0005 load(cgmm_config.estimates.pcsv);
0006 
0007 n = 2
0008 p = 2
0009 
0010 % rename estimates to make clear that they play the role of true parameters here
0011 mu = mu_cgmm
0012 A = A_cgmm
0013 lambda_0 = lambda_0_cgmm
0014 kappa = kappa_cgmm
0015 theta = theta_cgmm
0016 sigma = sigma_cgmm
0017 rho = rho_cgmm
0018 
0019 S_0 = repmat(100,1,n);
0020 y_0 = log(S_0);
0021 kappa = 2*kappa
0022 disp('Feller condition');
0023 2*kappa.*theta >= sigma.^2
0024 
0025 t = 0:1/250:1;
0026 [y, lambda] = sim_pcsv(y_0, mu, A, lambda_0, kappa, theta, sigma, rho, t);
0027 
0028 v = zeros(size(lambda,1),2);
0029 c = zeros(size(lambda,1),1);
0030 for k=1:length(c)
0031   M = A(:,1:p)*diag(lambda(k,:))*A(:,1:p)';
0032   v(k,:) = [sqrt(M(1,1)) sqrt(M(2,2))];
0033   c(k) = M(2,1) / (sqrt(M(1,1)*M(2,2)));
0034 end
0035 
0036 % plot simulated paths
0037 subplot(3,1,1);
0038 plot(exp(y));
0039 title('Stock Price');
0040 subplot(3,1,2);
0041 plot(v);
0042 title('Volatility');
0043 subplot(3,1,3);
0044 plot(c);
0045 title('Correlation');
0046 
0047 %print(cgmm_config.plots.feature_test('pcsv'), cgmm_config.plots.device)

Generated on Mon 29-Apr-2013 19:29:13 by m2html © 2005