Commit cbadf8f9 authored by rattoma's avatar rattoma
Browse files

Added steady state !

git-svn-id: file:///home/sebastien/dynare/gsa_dyn@146 f1850c17-3b45-254b-b221-fcb05880fee1
parent c4f7a025
......@@ -17,7 +17,7 @@ end
pnames = M_.param_names(estim_params_.param_vals(:,1),:);
filetoload=[OutputDirectoryName '/' fname_ '_prior'];
load(filetoload,'lpmat','lpmat0','istable','T','nspred','nboth','nfwrd')
load(filetoload,'lpmat','lpmat0','istable','T','yys','nspred','nboth','nfwrd')
if ~isempty(lpmat0),
lpmatx=lpmat0(istable,:);
else
......@@ -33,22 +33,28 @@ if opt_gsa.load_ident==0,
% th moments
options_.ar = min(3,options_.ar);
mss = yys(bayestopt_.mfys,:);
mss = teff(mss(:,istable),Nsam,istable);
yys = teff(yys(oo_.dr.order_var,istable),Nsam,istable);
[vdec, cc, ac] = mc_moments(T, lpmatx, oo_.dr);
if opt_gsa.morris==2,
[pdraws, TAU, GAM] = dynare_identification(-[1:npT],[lpmatx lpmat(istable,:)]);
if max(max(abs(pdraws-[lpmatx lpmat(istable,:)])))==0,
disp('Sample check OK'),
disp(['Sample check OK ', num2str(max(max(abs(pdraws-[lpmatx lpmat(istable,:)]))))]),
clear pdraws;
end
for j=1:length(istable), gas(:,j)=[vech(cc(:,:,j)); vec(ac(:,:,j))]; end
if max(max(abs(GAM-gas)))<=1.e-8,
disp('Moments check OK'),
% for j=1:length(istable), gas(:,j)=[vech(cc(:,:,j)); vec(ac(:,:,j))]; end
% if ~isempty(mss),
% gas = [mss(istable,:)'; gas];
% end
% if max(max(abs(GAM-gas)))<=1.e-8,
% disp(['Moments check OK ',num2str(max(max(abs(GAM-gas))))]),
clear GAM gas
end
% end
end
if opt_gsa.morris~=1,
if opt_gsa.morris~=1 & M_.exo_nbr>1,
ifig=0;
for j=1:M_.exo_nbr,
if mod(j,6)==1
......@@ -132,26 +138,28 @@ if opt_gsa.load_ident==0,
[yt, j0]=teff(A,Nsam,istable);
yt = [yys yt];
if opt_gsa.morris==2,
iii=find(std(yt(istable,:))>1.e-8);
if max(max(abs(TAU-yt(istable,iii)')))<= 1.e-10,
disp('Model check OK'),
clear TAU A
end
% iii=find(std(yt(istable,:))>1.e-8);
% if max(max(abs(TAU-yt(istable,iii)')))<= 1.e-8,
% err = max(max(abs(TAU-yt(istable,iii)')));
% disp(['Model check OK ',num2str(err)]),
clear TAU A
% end
else
clear A
clear A,
end
% [yt1, j01]=teff(T1,Nsam,istable);
% [yt2, j02]=teff(T2,Nsam,istable);
% [ytr, j0r]=teff(R,Nsam,istable);
%
% yt=[yt1 yt2 ytr];
save([OutputDirectoryName,'/',fname_,'_main_eff'],'ac','cc','vdec','yt')
save([OutputDirectoryName,'/',fname_,'_main_eff'],'ac','cc','vdec','yt','mss')
else
if opt_gsa.morris==2,
[pdraws, TAU, GAM] = dynare_identification([1:npT]); %,[lpmatx lpmat(istable,:)]);
end
load([OutputDirectoryName,'/',fname_,'_main_eff'],'ac','cc','vdec','yt')
load([OutputDirectoryName,'/',fname_,'_main_eff'],'ac','cc','vdec','yt','mss')
end
% for j=1:nr,
......@@ -169,6 +177,7 @@ end
if opt_gsa.morris==1,
%OutputDir = CheckPath('GSA/SCREEN');
if ~isempty(vdec),
if opt_gsa.load_ident==0,
SAMorris = [];
for i=1:size(vdec,2),
......@@ -197,6 +206,10 @@ if opt_gsa.morris==1,
eval(['print -depsc2 ' OutputDirectoryName '/' fname_ '_morris_vdec']);
eval(['print -dpdf ' OutputDirectoryName '/' fname_ '_morris_vdec']);
close(gcf)
else
save([OutputDirectoryName,'/',fname_,'_morris_IDE'],'vdec')
end
% ifig = 0;
% for j=1:size(options_.varobs,1)
......@@ -271,7 +284,7 @@ if opt_gsa.morris==1,
if opt_gsa.load_ident==0,
SAMorris = [];
ccac = [cc ac];
ccac = [mss cc ac];
for i=1:size(ccac,2),
[SAmeas, SAMorris(:,:,i)] = Morris_Measure_Groups(npT, [lpmat0 lpmat], [ccac(:,i)],nliv);
end
......@@ -799,6 +812,7 @@ elseif opt_gsa.morris==3,
figure, bar((idex_pcr.*ys_pcr)'./opt_gsa.Nsam), title('Parameters rank PCA')
elseif opt_gsa.morris==2, % ISKREV staff
return,
else, % main effects analysis
......@@ -953,7 +967,7 @@ else, % main effects analysis
catch
EET=[];
end
ccac = stand_([cc ac]);
ccac = stand_([mss cc ac]);
[pcc, dd] = eig(cov(ccac(istable,:)));
[latent, isort] = sort(-diag(dd));
latent = -latent;
......@@ -1512,3 +1526,5 @@ else, % main effects analysis
% eval(['print -depsc2 ' OutputDirectoryName '/' fname_ '_ident_SHOCKS',fsuffix]);
% eval(['print -dpdf ' OutputDirectoryName '/' fname_ '_ident_SHOCKS',fsuffix]);
end
return
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment