Merge remote-tracking branch 'origin/master' into dr1break
commit
f88b7a24b8
|
@ -90,13 +90,8 @@ CovJump = VarCov;
|
||||||
ModePar = xparam1;
|
ModePar = xparam1;
|
||||||
|
|
||||||
%% [1] I tune the scale parameter.
|
%% [1] I tune the scale parameter.
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
hh = dyn_waitbar(0,'Tuning of the scale parameter...');
|
||||||
diary off;
|
set(hh,'Name','Tuning of the scale parameter.');
|
||||||
disp(' ');
|
|
||||||
else
|
|
||||||
hh = waitbar(0,'Tuning of the scale parameter...');
|
|
||||||
set(hh,'Name','Tuning of the scale parameter.')
|
|
||||||
end
|
|
||||||
j = 1; jj = 1;
|
j = 1; jj = 1;
|
||||||
isux = 0; jsux = 0; test = 0;
|
isux = 0; jsux = 0; test = 0;
|
||||||
ix2 = ModePar;% initial condition!
|
ix2 = ModePar;% initial condition!
|
||||||
|
@ -126,16 +121,8 @@ while j<=MaxNumberOfTuningSimulations
|
||||||
jsux = jsux + 1;
|
jsux = jsux + 1;
|
||||||
end% ... otherwise I don't move.
|
end% ... otherwise I don't move.
|
||||||
prtfrc = j/MaxNumberOfTuningSimulations;
|
prtfrc = j/MaxNumberOfTuningSimulations;
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
if mod(j, 10)==0
|
||||||
if mod(j, 10)==0
|
dyn_waitbar(prtfrc,hh,sprintf('Acceptance rates: %f [%f]',isux/j,jsux/jj));
|
||||||
if exist('OCTAVE_VERSION')
|
|
||||||
printf('Tuning of the scale parameter (%f%% done):: Acceptance rates: %f [%f]\r',prtfrc*100,isux/j,jsux/jj);
|
|
||||||
else
|
|
||||||
fprintf(' Tuning of the scale parameter (%f \b%% done):: Acceptance rates: %f [%f]\r',prtfrc*100,isux/j,jsux/jj);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
waitbar(prtfrc,hh,sprintf('Acceptance rates: %f [%f]',isux/j,jsux/jj));
|
|
||||||
end
|
end
|
||||||
if j/500 == round(j/500)
|
if j/500 == round(j/500)
|
||||||
test1 = jsux/jj;
|
test1 = jsux/jj;
|
||||||
|
@ -156,18 +143,11 @@ while j<=MaxNumberOfTuningSimulations
|
||||||
j = j+1;
|
j = j+1;
|
||||||
jj = jj + 1;
|
jj = jj + 1;
|
||||||
end
|
end
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
|
||||||
diary on;
|
dyn_waitbar_close(hh);
|
||||||
else
|
|
||||||
close(hh);
|
|
||||||
end
|
|
||||||
%% [2] One block metropolis, I update the covariance matrix of the jumping distribution
|
%% [2] One block metropolis, I update the covariance matrix of the jumping distribution
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
hh = dyn_waitbar(0,'Metropolis-Hastings...');
|
||||||
diary off;
|
set(hh,'Name','Estimation of the posterior covariance...'),
|
||||||
else
|
|
||||||
hh = waitbar(0,'Metropolis-Hastings...');
|
|
||||||
set(hh,'Name','Estimation of the posterior covariance...')
|
|
||||||
end
|
|
||||||
j = 1;
|
j = 1;
|
||||||
isux = 0;
|
isux = 0;
|
||||||
ilogpo2 = - feval(ObjFun,ix2,varargin{:});
|
ilogpo2 = - feval(ObjFun,ix2,varargin{:});
|
||||||
|
@ -190,16 +170,8 @@ while j<= NumberOfIterations
|
||||||
jsux = jsux + 1;
|
jsux = jsux + 1;
|
||||||
end% ... otherwise I don't move.
|
end% ... otherwise I don't move.
|
||||||
prtfrc = j/NumberOfIterations;
|
prtfrc = j/NumberOfIterations;
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
if mod(j, 10)==0
|
||||||
if mod(j, 10)==0
|
dyn_waitbar(prtfrc,hh,sprintf('Acceptance rate: %f',isux/j));
|
||||||
if exist('OCTAVE_VERSION')
|
|
||||||
printf('Estimation of the posterior covariance (%f%% done):: Acceptance rates: %f\r',prtfrc,isux/j);
|
|
||||||
else
|
|
||||||
fprintf(' Estimation of the posterior covariance (%f \b%% done):: Acceptance rates: %f \r',prtfrc*100,isux/j);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
waitbar(prtfrc,hh,sprintf('Acceptance rate: %f',isux/j));
|
|
||||||
end
|
end
|
||||||
% I update the covariance matrix and the mean:
|
% I update the covariance matrix and the mean:
|
||||||
oldMeanPar = MeanPar;
|
oldMeanPar = MeanPar;
|
||||||
|
@ -208,23 +180,15 @@ while j<= NumberOfIterations
|
||||||
(1/j)*(ix2*ix2' - CovJump - oldMeanPar*oldMeanPar');
|
(1/j)*(ix2*ix2' - CovJump - oldMeanPar*oldMeanPar');
|
||||||
j = j+1;
|
j = j+1;
|
||||||
end
|
end
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
dyn_waitbar_close(hh);
|
||||||
diary on;
|
|
||||||
else
|
|
||||||
close(hh);
|
|
||||||
end
|
|
||||||
PostVar = CovJump;
|
PostVar = CovJump;
|
||||||
PostMean = MeanPar;
|
PostMean = MeanPar;
|
||||||
%% [3 & 4] I tune the scale parameter (with the new covariance matrix) if
|
%% [3 & 4] I tune the scale parameter (with the new covariance matrix) if
|
||||||
%% this is the last call to the routine, and I climb the hill (without
|
%% this is the last call to the routine, and I climb the hill (without
|
||||||
%% updating the covariance matrix)...
|
%% updating the covariance matrix)...
|
||||||
if strcmpi(info,'LastCall')
|
if strcmpi(info,'LastCall')
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
hh = dyn_waitbar(0,'Tuning of the scale parameter...');
|
||||||
diary off;
|
set(hh,'Name','Tuning of the scale parameter.'),
|
||||||
else
|
|
||||||
hh = waitbar(0,'Tuning of the scale parameter...');
|
|
||||||
set(hh,'Name','Tuning of the scale parameter.')
|
|
||||||
end
|
|
||||||
j = 1; jj = 1;
|
j = 1; jj = 1;
|
||||||
isux = 0; jsux = 0;
|
isux = 0; jsux = 0;
|
||||||
test = 0;
|
test = 0;
|
||||||
|
@ -249,16 +213,8 @@ if strcmpi(info,'LastCall')
|
||||||
jsux = jsux + 1;
|
jsux = jsux + 1;
|
||||||
end% ... otherwise I don't move.
|
end% ... otherwise I don't move.
|
||||||
prtfrc = j/MaxNumberOfTuningSimulations;
|
prtfrc = j/MaxNumberOfTuningSimulations;
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
if mod(j, 10)==0
|
||||||
if mod(j, 10)==0
|
dyn_waitbar(prtfrc,hh,sprintf('Acceptance rates: %f [%f]',isux/j,jsux/jj));
|
||||||
if exist('OCTAVE_VERSION')
|
|
||||||
printf('Tuning of the scale parameter (%f%% done):: Acceptance rates: %f [%f]\r',prtfrc*100,isux/j,jsux/jj);
|
|
||||||
else
|
|
||||||
fprintf(' Tuning of the scale parameter (%f \b%% done):: Acceptance rates: %f [%f] \r',prtfrc*100,isux/j,jsux/jj);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
waitbar(prtfrc,hh,sprintf('Acceptance rates: %f [%f]',isux/j,jsux/jj));
|
|
||||||
end
|
end
|
||||||
if j/1000 == round(j/1000)
|
if j/1000 == round(j/1000)
|
||||||
test1 = jsux/jj;
|
test1 = jsux/jj;
|
||||||
|
@ -275,23 +231,16 @@ if strcmpi(info,'LastCall')
|
||||||
j = j+1;
|
j = j+1;
|
||||||
jj = jj + 1;
|
jj = jj + 1;
|
||||||
end
|
end
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
dyn_waitbar_close(hh);
|
||||||
diary on;
|
|
||||||
else
|
|
||||||
close(hh);
|
|
||||||
end
|
|
||||||
Scale = iScale;
|
Scale = iScale;
|
||||||
%%
|
%%
|
||||||
%% Now I climb the hill
|
%% Now I climb the hill
|
||||||
%%
|
%%
|
||||||
climb = 1;
|
climb = 1;
|
||||||
if climb
|
if climb
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
hh = dyn_waitbar(0,' ');
|
||||||
diary off;
|
set(hh,'Name','Now I am climbing the hill...'),
|
||||||
else
|
disp('Now I am climbing the hill...'),
|
||||||
hh = waitbar(0,' ');
|
|
||||||
set(hh,'Name','Now I am climbing the hill...')
|
|
||||||
end
|
|
||||||
j = 1; jj = 1;
|
j = 1; jj = 1;
|
||||||
jsux = 0;
|
jsux = 0;
|
||||||
test = 0;
|
test = 0;
|
||||||
|
@ -308,16 +257,8 @@ if strcmpi(info,'LastCall')
|
||||||
jsux = jsux + 1;
|
jsux = jsux + 1;
|
||||||
end% otherwise I don't move...
|
end% otherwise I don't move...
|
||||||
prtfrc = j/MaxNumberOfClimbingSimulations;
|
prtfrc = j/MaxNumberOfClimbingSimulations;
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
if mod(j, 10)==0
|
||||||
if mod(j, 10)==0
|
dyn_waitbar(prtfrc,hh,sprintf('%f Jumps / MaxStepSize %f',jsux,sqrt(max(diag(iScale*CovJump)))));
|
||||||
if exist('OCTAVE_VERSION')
|
|
||||||
printf('Now I am climbing the hill (%f%% done):: %f Jumps / MaxStepSize %f\r',prtfrc*100,jsux,sqrt(max(diag(iScale*CovJump))));
|
|
||||||
else
|
|
||||||
fprintf(' Now I am climbing the hill (%f \b%% done):: %f Jumps / MaxStepSize %f \r',prtfrc*100,jsux,sqrt(max(diag(iScale*CovJump))));
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
waitbar(prtfrc,hh,sprintf('%f Jumps / MaxStepSize %f',jsux,sqrt(max(diag(iScale*CovJump)))));
|
|
||||||
end
|
end
|
||||||
if j/200 == round(j/200)
|
if j/200 == round(j/200)
|
||||||
if jsux<=1
|
if jsux<=1
|
||||||
|
@ -338,11 +279,7 @@ if strcmpi(info,'LastCall')
|
||||||
j = j+1;
|
j = j+1;
|
||||||
jj = jj + 1;
|
jj = jj + 1;
|
||||||
end
|
end
|
||||||
if exist('OCTAVE_VERSION') || options_.console_mode
|
dyn_waitbar_close(hh);
|
||||||
diary on;
|
|
||||||
else
|
|
||||||
close(hh);
|
|
||||||
end
|
|
||||||
end%climb
|
end%climb
|
||||||
else
|
else
|
||||||
Scale = iScale;
|
Scale = iScale;
|
||||||
|
|
|
@ -3,7 +3,7 @@ global options_ M_
|
||||||
|
|
||||||
[nr1, nc1, nsam] = size(mm);
|
[nr1, nc1, nsam] = size(mm);
|
||||||
disp('Computing theoretical moments ...')
|
disp('Computing theoretical moments ...')
|
||||||
h = waitbar(0,'Theoretical moments ...');
|
h = dyn_waitbar(0,'Theoretical moments ...');
|
||||||
|
|
||||||
for j=1:nsam,
|
for j=1:nsam,
|
||||||
dr.ghx = mm(:, [1:(nc1-M_.exo_nbr)],j);
|
dr.ghx = mm(:, [1:(nc1-M_.exo_nbr)],j);
|
||||||
|
@ -18,8 +18,8 @@ global options_ M_
|
||||||
dum=[dum, autocorr{i}];
|
dum=[dum, autocorr{i}];
|
||||||
end
|
end
|
||||||
ac(:,:,j)=dum;
|
ac(:,:,j)=dum;
|
||||||
waitbar(j/nsam,h)
|
dyn_waitbar(j/nsam,h)
|
||||||
end
|
end
|
||||||
close(h)
|
dyn_waitbar_close(h)
|
||||||
disp(' ')
|
disp(' ')
|
||||||
disp('... done !')
|
disp('... done !')
|
||||||
|
|
|
@ -25,7 +25,7 @@ nrun=size(B,3);
|
||||||
iff=zeros(nvar,nshock,nrun);
|
iff=zeros(nvar,nshock,nrun);
|
||||||
tadj=iff;
|
tadj=iff;
|
||||||
disp('Computing speed of adjustement ...')
|
disp('Computing speed of adjustement ...')
|
||||||
h = waitbar(0,'Speed of adjustement...');
|
h = dyn_waitbar(0,'Speed of adjustement...');
|
||||||
|
|
||||||
for i=1:nrun,
|
for i=1:nrun,
|
||||||
irf=zeros(nvar,nshock);
|
irf=zeros(nvar,nshock);
|
||||||
|
@ -45,8 +45,8 @@ for i=1:nrun,
|
||||||
tt=(irf>0.5).*t;
|
tt=(irf>0.5).*t;
|
||||||
tadj(:,:,i)=((tt-tadj(:,:,i))==tt).*tt+tadj(:,:,i);
|
tadj(:,:,i)=((tt-tadj(:,:,i))==tt).*tt+tadj(:,:,i);
|
||||||
end
|
end
|
||||||
waitbar(i/nrun,h)
|
dyn_waitbar(i/nrun,h)
|
||||||
end
|
end
|
||||||
disp(' ')
|
disp(' ')
|
||||||
disp('.. done !')
|
disp('.. done !')
|
||||||
close(h)
|
dyn_waitbar_close(h)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var Capital, Output, Labour, Consumption, Efficiency, efficiency;
|
var Capital, Output, Labour, Consumption, Efficiency, efficiency, ExpectedTerm;
|
||||||
|
|
||||||
varexo EfficiencyInnovation;
|
varexo EfficiencyInnovation;
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ parameters beta, theta, tau, alpha, psi, delta, rho, effstar, sigma2;
|
||||||
|
|
||||||
beta = 0.990;
|
beta = 0.990;
|
||||||
theta = 0.357;
|
theta = 0.357;
|
||||||
tau = 2.000;
|
tau = 30.000;
|
||||||
alpha = 0.450;
|
alpha = 0.450;
|
||||||
psi = -0.500;
|
psi = -5.000;
|
||||||
delta = 0.020;
|
delta = 0.020;
|
||||||
rho = 0.950;
|
rho = 0.950;
|
||||||
effstar = 1.000;
|
effstar = 1.000;
|
||||||
|
@ -39,7 +39,10 @@ model(block,bytecode);
|
||||||
((1-theta)/theta)*(Consumption/(1-Labour)) - (1-alpha)*(Output/Labour)^(1-psi);
|
((1-theta)/theta)*(Consumption/(1-Labour)) - (1-alpha)*(Output/Labour)^(1-psi);
|
||||||
|
|
||||||
// Eq. n°6:
|
// Eq. n°6:
|
||||||
(((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption - beta*((((Consumption(1)^theta)*((1-Labour(1))^(1-theta)))^(1-tau))/Consumption(1))*(alpha*((Output(1)/Capital)^(1-psi))+1-delta);
|
(((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption - ExpectedTerm(1);
|
||||||
|
|
||||||
|
// Eq. n°7:
|
||||||
|
ExpectedTerm = beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital(-1))^(1-psi))+1-delta);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -50,6 +53,7 @@ end;
|
||||||
steady;
|
steady;
|
||||||
|
|
||||||
options_.ep.verbosity = 0;
|
options_.ep.verbosity = 0;
|
||||||
options_.console_mode = 1;
|
options_.ep.stochastic = 0;
|
||||||
|
options_.console_mode = 0;
|
||||||
|
|
||||||
ts = extended_path([],1000);
|
ts = extended_path([],1000);
|
|
@ -43,4 +43,6 @@ ys(4)=SteadyStateConsumption;
|
||||||
ys(1)=SteadyStateCapital;
|
ys(1)=SteadyStateCapital;
|
||||||
ys(3)=SteadyStateLabour;
|
ys(3)=SteadyStateLabour;
|
||||||
ys(5)=M_.params(8);
|
ys(5)=M_.params(8);
|
||||||
ys(6)=0;
|
ys(6)=0;
|
||||||
|
ys(7)=M_.params(1)*((((SteadyStateConsumption^M_.params(2))*((1-SteadyStateLabour)^(1-M_.params(2))))^(1-M_.params(3)))/SteadyStateConsumption)* ...
|
||||||
|
(M_.params(4)*((SteadyStateOutput/SteadyStateCapital)^(1-M_.params(5)))+1-M_.params(6));
|
Loading…
Reference in New Issue