%EXAMPLE 1    computes maximum likelihood estimates for the example in 
%             `Cattle cycles' by Rosen, et.al.   For this example, only
%             quantities (y,x,c) are assumed to be observed.       

%             Ellen R. McGrattan, 7-20-93

%File:  lqmle_1.m 

%Data:  rosen.mat  (leave out 4th series for now)

%Fixed params:

  rho1   = 0.0;
  rho2   = 0.0;
  sigma1 = 1;
  sigma2 = 1;
  x0     = [0;17.56*ones(3,1);1;0;0;0];
  grate  = 1;
  Gam    = zeros(4);


%Parameters fixed during estimation:

  delta  = 0.0;
  rho3   = 0.846580854313;
  f5     = 1e-5;
  gamma0 = 0.0052;
  varm(2)= 1e-5;
  varm(4)= 1e-5;

%Current estimates:

  alpha0 = 69.879;
  alpha1 = 0.80438;
  beta   = 0.83807;
  gamma1 = 0.37343;
  f1     = 7.9979e-6;
  f3     = 2.6185e-4;
  f7     = 0.0049625;
  g      = 0.85002;
  sigma3 = 191.54;
  muh    = 19.885;
  mum    = 70.526;
  varm(1)= 0.014101;
  varm(3)= 17.168;


%Current likelihood value:

  L      = 296.04;


%Optimization of likelihood:

  Theta  = [alpha0;alpha1;beta;delta;gamma0;gamma1;f1;f3;f5;f7;g;rho1;rho2;
            rho3;sigma1;sigma2;sigma3;muh;mum;grate;varm(:)];
  ind    = [1,1,1,0,0,1, 1,1,0,1, 1, 0,0,0, 0,0,1, 1,1, 0, 1,0,1,0];
  Theta  = Theta(ind);

  global ZVAR
  load rosen
  format short e
  [x,f,g]= uncmin(Theta,'lqmle_1');
