Home > matlab > disp_moments.m

disp_moments

PURPOSE ^

Displays moments of simulated variables

SYNOPSIS ^

function disp_moments(y,var_list)

DESCRIPTION ^

 Displays moments of simulated variables

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function disp_moments(y,var_list)
0002 % Displays moments of simulated variables
0003 
0004 % Copyright (C) 2001-2012 Dynare Team
0005 %
0006 % This file is part of Dynare.
0007 %
0008 % Dynare is free software: you can redistribute it and/or modify
0009 % it under the terms of the GNU General Public License as published by
0010 % the Free Software Foundation, either version 3 of the License, or
0011 % (at your option) any later version.
0012 %
0013 % Dynare is distributed in the hope that it will be useful,
0014 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016 % GNU General Public License for more details.
0017 %
0018 % You should have received a copy of the GNU General Public License
0019 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 global M_ options_ oo_
0022 
0023 warning_old_state = warning;
0024 warning off
0025 
0026 if size(var_list,1) == 0
0027     var_list = M_.endo_names(1:M_.orig_endo_nbr, :);
0028 end
0029 
0030 nvar = size(var_list,1);
0031 ivar=zeros(nvar,1);
0032 for i=1:nvar
0033     i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
0034     if isempty(i_tmp)
0035         error (['One of the variable specified does not exist']) ;
0036     else
0037         ivar(i) = i_tmp;
0038     end
0039 end
0040 
0041 y = y(ivar,options_.drop+1:end)';
0042 
0043 m = mean(y);
0044 
0045 if options_.hp_filter
0046     [hptrend,y] = sample_hp_filter(y,options_.hp_filter);
0047 else
0048     y = bsxfun(@minus, y, m);
0049 end
0050 
0051 s2 = mean(y.*y);
0052 s = sqrt(s2);
0053 oo_.mean = transpose(m);
0054 oo_.var = y'*y/size(y,1);
0055 
0056 labels = deblank(M_.endo_names(ivar,:));
0057 
0058 if options_.nomoments == 0
0059     z = [ m' s' s2' (mean(y.^3)./s2.^1.5)' (mean(y.^4)./(s2.*s2)-3)' ];    
0060     title='MOMENTS OF SIMULATED VARIABLES';
0061     if options_.hp_filter
0062         title = [title ' (HP filter, lambda = ' ...
0063                  num2str(options_.hp_filter) ')'];
0064     end
0065     headers=char('VARIABLE','MEAN','STD. DEV.','VARIANCE','SKEWNESS', ...
0066                  'KURTOSIS');
0067     dyntable(title,headers,labels,z,size(labels,2)+2,16,6);
0068 end
0069 
0070 if options_.nocorr == 0
0071     corr = (y'*y/size(y,1))./(s'*s);
0072     if options_.noprint == 0
0073         title = 'CORRELATION OF SIMULATED VARIABLES';
0074         if options_.hp_filter
0075             title = [title ' (HP filter, lambda = ' ...
0076                      num2str(options_.hp_filter) ')'];
0077         end
0078         headers = char('VARIABLE',M_.endo_names(ivar,:));
0079         dyntable(title,headers,labels,corr,size(labels,2)+2,8,4);
0080     end
0081 end
0082 
0083 ar = options_.ar;
0084 if ar > 0
0085     autocorr = [];
0086     for i=1:ar
0087         oo_.autocorr{i} = y(ar+1:end,:)'*y(ar+1-i:end-i,:)./((size(y,1)-ar)*std(y(ar+1:end,:))'*std(y(ar+1-i:end-i,:)));
0088         autocorr = [ autocorr diag(oo_.autocorr{i}) ];
0089     end
0090     if options_.noprint == 0
0091         title = 'AUTOCORRELATION OF SIMULATED VARIABLES';
0092         if options_.hp_filter
0093             title = [title ' (HP filter, lambda = ' ...
0094                      num2str(options_.hp_filter) ')'];
0095         end
0096         headers = char('VARIABLE',int2str([1:ar]'));
0097         dyntable(title,headers,labels,autocorr,size(labels,2)+2,8,4);
0098     end
0099 end
0100 
0101 warning(warning_old_state);

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005