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

format short e
gam=.12;
gamma=[gam 0]';
phic=[1 0]';
phig=[0 1]';
phi1=-1;
phii=[1 -phi1]';
deltak=.95;
thetak=1;
beta=1/1.05;
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;
pih=1;
deltah=.9;
thetah=(1-deltah);
ub=[30 0 0];
ud11=5; ud12=1;
ub1=30;
solvea
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)]';


% 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');

