load c:\matlab\datgerin.txt;
echo on;
% creating the original parameters to be estimated
% r11 to r1919 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 r1919 s10 s20;
global AAr HH1r HH2r A H F R Q S10 Q0 p10 vp10 z;
% defining data matrix
dat=datgerin;
global dat;
% defining parameters
para=[4.0346916,4.0660162,-6.465255,-6.8215072,3.0979817,1.4923502,-0.69015894,-0.17029679,-1.7801797,-1.2362226,-0.68102726,0.60983616,-0.082530108,-0.14685034,-1.0676112,0.41457897,-0.31653961,-0.079408822,-0.37790821,0.73490396,0.80506935,0.51061064,0.39230219,-0.56051416,-2.7940033,-5.302371]
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('va2fgrin',para,options);
% saving a file with the parameters;
save c:\matlab\v2pgerin z -ascii;