Home > matlab > disp_th_moments.m

disp_th_moments

PURPOSE ^

Display theoretical moments of variables

SYNOPSIS ^

function disp_th_moments(dr,var_list)

DESCRIPTION ^

 Display theoretical moments of variables

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function disp_th_moments(dr,var_list)
0002 % Display theoretical moments of variables
0003 
0004 % Copyright (C) 2001-2011 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_ oo_ options_
0022 
0023 if size(var_list,1) == 0
0024     var_list = M_.endo_names(1:M_.orig_endo_nbr, :);
0025 end
0026 nvar = size(var_list,1);
0027 ivar=zeros(nvar,1);
0028 for i=1:nvar
0029     i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
0030     if isempty(i_tmp)
0031         error (['One of the variable specified does not exist']) ;
0032     else
0033         ivar(i) = i_tmp;
0034     end
0035 end
0036 
0037 [oo_.gamma_y,stationary_vars] = th_autocovariances(dr,ivar,M_,options_);
0038 m = dr.ys(ivar);
0039 non_stationary_vars = setdiff(1:length(ivar),stationary_vars);
0040 m(non_stationary_vars) = NaN;
0041 
0042 i1 = find(abs(diag(oo_.gamma_y{1})) > 1e-12);
0043 s2 = diag(oo_.gamma_y{1});
0044 sd = sqrt(s2);
0045 if options_.order == 2
0046     m = m+oo_.gamma_y{options_.ar+3};
0047 end
0048 
0049 z = [ m sd s2 ];
0050 oo_.mean = m;
0051 oo_.var = oo_.gamma_y{1};
0052 
0053 if ~options_.noprint %options_.nomoments == 0
0054     title='THEORETICAL MOMENTS';
0055     if options_.hp_filter
0056         title = [title ' (HP filter, lambda = ' num2str(options_.hp_filter) ')'];
0057     end
0058     headers=char('VARIABLE','MEAN','STD. DEV.','VARIANCE');
0059     labels = deblank(M_.endo_names(ivar,:));
0060     lh = size(labels,2)+2;
0061     dyntable(title,headers,labels,z,lh,11,4);
0062     if M_.exo_nbr > 1 && size(stationary_vars, 1) > 0
0063         disp(' ')
0064         title='VARIANCE DECOMPOSITION (in percent)';
0065         if options_.hp_filter
0066             title = [title ' (HP filter, lambda = ' ...
0067                      num2str(options_.hp_filter) ')'];
0068         end
0069         headers = M_.exo_names;
0070         headers(M_.exo_names_orig_ord,:) = headers;
0071         headers = char(' ',headers);
0072         lh = size(deblank(M_.endo_names(ivar(stationary_vars),:)),2)+2;
0073         dyntable(title,headers,deblank(M_.endo_names(ivar(stationary_vars), ...
0074                                                      :)),100*oo_.gamma_y{options_.ar+2}(stationary_vars,:),lh,8,2);
0075     end
0076     
0077     conditional_variance_steps = options_.conditional_variance_decomposition;
0078     if length(conditional_variance_steps)
0079         oo_ = display_conditional_variance_decomposition(conditional_variance_steps,...
0080                                                          ivar,dr,M_, ...
0081                                                          options_,oo_);
0082     end
0083 end
0084 
0085 if length(i1) == 0
0086     disp(' ')
0087     disp('All endogenous are constant or non stationary, not displaying correlations and auto-correlations')
0088     disp(' ')
0089     return;
0090 end
0091 
0092 if options_.nocorr == 0 && size(stationary_vars, 1) > 0
0093     corr = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)');
0094     if ~options_.noprint,
0095         disp(' ')
0096         title='MATRIX OF CORRELATIONS';
0097         if options_.hp_filter
0098             title = [title ' (HP filter, lambda = ' num2str(options_.hp_filter) ')'];
0099         end
0100         labels = deblank(M_.endo_names(ivar(i1),:));
0101         headers = char('Variables',labels);
0102         lh = size(labels,2)+2;
0103         dyntable(title,headers,labels,corr,lh,8,4);
0104     end
0105 end
0106 if options_.ar > 0 && size(stationary_vars, 1) > 0
0107     z=[];
0108     for i=1:options_.ar
0109         oo_.autocorr{i} = oo_.gamma_y{i+1};
0110         z(:,i) = diag(oo_.gamma_y{i+1}(i1,i1));
0111     end
0112     if ~options_.noprint,      
0113         disp(' ')    
0114         title='COEFFICIENTS OF AUTOCORRELATION';      
0115         if options_.hp_filter        
0116             title = [title ' (HP filter, lambda = ' num2str(options_.hp_filter) ')'];      
0117         end      
0118         labels = deblank(M_.endo_names(ivar(i1),:));      
0119         headers = char('Order ',int2str([1:options_.ar]'));
0120         lh = size(labels,2)+2;
0121         dyntable(title,headers,labels,z,lh,8,4);
0122     end  
0123 end

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