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 phi3 sgm1 sgm2 sgm3 lmda1 lmda2 lmda3 r11 r22 r33 r44 r55 r66 r77 r88 r99 r1010 r1111 r1212 r1313 r1414 r15151 r1616 r1717 r1818 s10 s20 S30;
global AAr HH1r HH2r A H F R Q S10 Q0 p10 vp10 z
% defining data matrix
dat=datgerse;
global dat;
% defining parameters
para=[3.025690437,4.038846409,6.905753276,-7.453734484,-6.372720613,-7.43583102,0.435396339,-1.967505083,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-5.299155345]
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('va3fgrse',para,options);
% saving a file with the parameters;
save c:\matlab\v3pgerse z -ascii;