Skip to content

Commit

Permalink
fix disp moments was broken with latest dynare unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
tholden committed Aug 30, 2016
1 parent e137955 commit 8bc81ba
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions Core/DispMoments.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function DispMoments(M, options, oo, dynareOBC)
function DispMoments(~, options, oo, dynareOBC)
% Derived from disp_moments.m in Dynare. Original file follows.

% Displays moments of simulated variables
Expand Down Expand Up @@ -57,6 +57,10 @@ function DispMoments(M, options, oo, dynareOBC)

labels = deblank( char( [ dynareOBC.EndoVariables( VariableSelect ) dynareOBC.MLVNames( MLVSelect ) ] ) );

sDynareVersion = dynare_version;
sDynareVersion = sDynareVersion( 1:3 );
DynareVersion = str2double( sDynareVersion );

if options.nomoments == 0
z = [ m' s' s2' (nanmean2(y.^3)./s2.^1.5)' (nanmean2(y.^4)./(s2.*s2)-3)' ];
title='MOMENTS OF SIMULATED VARIABLES';
Expand All @@ -66,7 +70,11 @@ function DispMoments(M, options, oo, dynareOBC)
end
headers=char('VARIABLE','MEAN','STD. DEV.','VARIANCE','SKEWNESS', ...
'KURTOSIS');
dyntable(title,headers,labels,z,size(labels,2)+2,16,6);
if DynareVersion >= 4.5
dyntable(options,title,headers,labels,z,size(labels,2)+2,16,6);
else
dyntable(title,headers,labels,z,size(labels,2)+2,16,6);
end
end

if options.nocorr == 0
Expand All @@ -78,7 +86,11 @@ function DispMoments(M, options, oo, dynareOBC)
num2str(options.hp_filter) ')'];
end
headers = char( 'VARIABLE', labels );
dyntable(title,headers,labels,corr,size(labels,2)+2,8,4);
if DynareVersion >= 4.5
dyntable(options,title,headers,labels,corr,size(labels,2)+2,8,4);
else
dyntable(title,headers,labels,corr,size(labels,2)+2,8,4);
end
end
end

Expand All @@ -99,8 +111,12 @@ function DispMoments(M, options, oo, dynareOBC)
title = [title ' (HP filter, lambda = ' ...
num2str(options.hp_filter) ')'];
end
headers = char('VARIABLE',int2str([1:ar]'));
dyntable(title,headers,labels,autocorr,size(labels,2)+2,8,4);
headers = char('VARIABLE',int2str((1:ar)'));
if DynareVersion >= 4.5
dyntable(options,title,headers,labels,autocorr,size(labels,2)+2,8,4);
else
dyntable(title,headers,labels,autocorr,size(labels,2)+2,8,4);
end
end
end
catch Error
Expand Down

0 comments on commit 8bc81ba

Please sign in to comment.