% Technology 4 (Growth)
% Preferences 3 (Habit persistence)
% We modify the Jones-Manuelli example to get a version of Hall's
% model

tem= [ ..
   9.5238e-01
   9.0000e-01
   9.5000e-01
   1.2000e-01
  -1.0000e-01
  -1.0000e+00
   1.0000e+00
   1.0000e-01
];
[  9.7410e-01
   7.0133e-01
   9.4882e-01
   8.8060e-02
  -3.4836e-01
  -9.1645e-01
   1.4986e+00
   5.0000e-01
];
format short e
gam=.12;
gam=tem(4);
gamma=[gam 0]';
phic=[1 0]';
phig=[0 1]';
phi1=-1;
phi1=tem(6);
phii=[1 -phi1]';
deltak=.95;
deltak=tem(3);
thetak=1;
beta=1/1.05;
beta=tem(1);
ud=[5 1 0; 0 0 0];
rho1=.8;rho2=.5;
a22=[1 0 0; 0 rho1 0; 0 0 rho2];
sigma1=1; sigma2=0;sigma3=1;
c2=[0 1 0; 0 0 1]';
lambda=-.1;
lambda=tem(5);
pih=1;
pih=tem(7);
deltah=.9;
deltah=tem(2);
thetah=(1-deltah);
thetah=tem(8);
ub=[30 0 0];
ud11=5; ud12=1;
ub1=30;
sig=-.005;
solvex
ao
k
sy=[skl;si;sc;sg];
x0=zeros(1,5);
nnc=3;
steadst
x0=zs;
t1=170;
asimul
global zvar
rand('normal')
rand('seed',0)
zvar=y+.001*rand(y);


Theta=[beta deltah deltak gam lambda phi1 pih thetah thetak rho1 rho2 ...
       sigma1 sigma2 sigma3 ub1 ud11 ud12 .001*ones(1,4)]';

return

% make it challenging:
Thet2 = Theta.*(1+rand(Theta)/100);
disp('Theta,  Theta with noise:')
disp([Theta,Thet2])
disp(' ')
disp('L(Theta), L(Theta w/noise):')
disp([lqmle(Theta),lqmle(Thet2)])
[x,f,g,code,status]=uncmin(Thet2,'lqmle');

