load c:\matlab\datgerse.txt;
echo on;
% creating the original parameters to be estimated
% r11 to r1818 are the variances of the residuals in observation equations
% s10 and s20 are the starting values of the factors (subtracted by the respective means)
global delta phi1 phi2 sgm1 sgm2 lmda1 lmda2 r11 r22 r33 r44 r55 r66 r77 r88 r99 r1010 r1111 r1212 r1313 r1414 r1515 r1616 r1717 r1818 s10 s20;
global AAr HH1r HH2r A H F R Q S10 Q0 p10 vp10 z;
% defining data matrix
dat=datgerse;
global dat;
% defining parameters
para=[4.0524562,4.0885714,-7.0278938,-6.3928806,4.9439239,0.96790885,-0.74851797,-1.2854936,0.56307635,0.86598521,-1.9589695,-0.071854908,-0.42286542,0.39066876,0.06585957,0.12772959,-0.25375262,-0.44117969,1.159425,0.016528299,-1.0570679,-0.89223985,0.49191553,-0.040216852,-5.2595954]
global para;
%options about the minimisation function used below (see Matlab manual)
options(1)=1;
options(2)=0.001;
options(3)=0.001;
options(14)=100000;
% defining the optimisation problem (minimise -log-likelihood function)
z=fmins('va2fgrse',para,options);
% saving a file with the parameters;
save c:\matlab\v2pgerse z -ascii;