Home > . > disp_moments.m

disp_moments

PURPOSE ^

Copyright (C) 2001 Michel Juillard

SYNOPSIS ^

function disp_moments(y,var_list)

DESCRIPTION ^

 Copyright (C) 2001 Michel Juillard

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Copyright (C) 2001 Michel Juillard
0002 %
0003 function disp_moments(y,var_list)
0004   global M_ options_ oo_
0005   
0006   warning off
0007   nvar = size(var_list,1);
0008   if nvar == 0
0009     nvar = M_.endo_nbr;
0010     ivar = [1:nvar]';
0011   else
0012     ivar=zeros(nvar,1);
0013     for i=1:nvar
0014       i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
0015       if isempty(i_tmp)
0016           error (['One of the variable specified does not exist']) ;
0017       else
0018     ivar(i) = i_tmp;
0019       end
0020     end
0021   end
0022   y = y(ivar,options_.drop+M_.maximum_lag+1:end)';
0023   
0024   m = mean(y);
0025   y = y - repmat(m,size(y,1),1);
0026   s2 = mean(y.*y);
0027   s = sqrt(s2);
0028   oo_.mean = m;
0029   oo_.var = y'*y/size(y,1);
0030 
0031   labels = deblank(M_.endo_names(ivar,:));
0032   
0033   if options_.nomoments == 0
0034     z = [ m' s' s2' (mean(y.^3)./s2.^1.5)' (mean(y.^4)./(s2.*s2)-3)' ];
0035   
0036     title='MOMENTS OF SIMULATED VARIABLES';
0037     if options_.hp_filter > 1
0038       title = [title ' (HP filter, lambda = ' ...
0039            int2str(options_.hp_filter) ')'];
0040     end
0041     headers=strvcat('VARIABLE','MEAN','STD. DEV.','VARIANCE','SKEWNESS', ...
0042             'KURTOSIS');
0043     table(title,headers,labels,z,size(labels,2)+2,16,6);
0044   end
0045   
0046   if options_.nocorr == 0
0047     corr = (y'*y/size(y,1))./(s'*s);
0048     title = 'CORRELATION OF SIMULATED VARIABLES';
0049     if options_.hp_filter > 1
0050       title = [title ' (HP filter, lambda = ' ...
0051            int2str(options_.hp_filter) ')'];
0052     end
0053     headers = strvcat('VARIABLE',M_.endo_names(ivar,:));
0054     table(title,headers,labels,corr,size(labels,2)+2,8,4);
0055   end
0056   
0057   ar = options_.ar;
0058   options_ = set_default_option(options_,'ar',5);
0059   ar = options_.ar;
0060   if ar > 0
0061     autocorr = [];
0062     for i=1:ar
0063       oo_.autocorr{i} = y(ar+1:end,:)'*y(ar+1-i:end-i,:)./((size(y,1)-ar)*s'*s);
0064       autocorr = [ autocorr diag(oo_.autocorr{i}) ];
0065     end
0066     title = 'AUTOCORRELATION OF SIMULATED VARIABLES';
0067     if options_.hp_filter > 1
0068       title = [title ' (HP filter, lambda = ' ...
0069            int2str(options_.hp_filter) ')'];
0070     end
0071     headers = strvcat('VARIABLE',int2str([1:ar]'));
0072     table(title,headers,labels,autocorr,size(labels,2)+2,8,4);
0073   end
0074   
0075   warning on
0076 % 10/03/02 MJ corrected order std. dev var in printed report.
0077 % 01/02/03 MJ added correlation and autocorrelation
0078 % 01/19/03 MJ corrected variable name truncation
0079 % 02/18/03 MJ added subtitle for HP filter
0080 % 03/02/03 MJ added M_.maximum_lag to the number of entries of y
0081 % 04/28/03 MJ modified handling of options_
0082 % 06/23/03 MJ added warning off

Generated on Fri 16-Jun-2006 09:09:06 by m2html © 2003