Home > matlab > display_conditional_variance_decomposition.m

display_conditional_variance_decomposition

PURPOSE ^

This function computes the conditional variance decomposition of a given state space model

SYNOPSIS ^

function oo_ = display_conditional_variance_decomposition(Steps, SubsetOfVariables, dr,M_,options_,oo_)

DESCRIPTION ^

 This function computes the conditional variance decomposition of a given state space model
 for a subset of endogenous variables.
 
 INPUTS 
   StateSpaceModel     [structure]   Specification of the state space model.
   Steps               [integer]     1*h vector of dates.
   SubsetOfVariables   [integer]     1*q vector of indices.
    
 OUTPUTS 
   PackedConditionalVarianceDecomposition  [double] n(n+1)/2*p matrix, where p is the number of state innovations and
                                                    n is equal to length(SubsetOfVariables).    

 SPECIAL REQUIREMENTS

 [1] The covariance matrix of the state innovations needs to be diagonal.
 [2] In this version, absence of measurement errors is assumed...

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function oo_ = display_conditional_variance_decomposition(Steps, SubsetOfVariables, dr,M_,options_,oo_)
0002 % This function computes the conditional variance decomposition of a given state space model
0003 % for a subset of endogenous variables.
0004 %
0005 % INPUTS
0006 %   StateSpaceModel     [structure]   Specification of the state space model.
0007 %   Steps               [integer]     1*h vector of dates.
0008 %   SubsetOfVariables   [integer]     1*q vector of indices.
0009 %
0010 % OUTPUTS
0011 %   PackedConditionalVarianceDecomposition  [double] n(n+1)/2*p matrix, where p is the number of state innovations and
0012 %                                                    n is equal to length(SubsetOfVariables).
0013 %
0014 % SPECIAL REQUIREMENTS
0015 %
0016 % [1] The covariance matrix of the state innovations needs to be diagonal.
0017 % [2] In this version, absence of measurement errors is assumed...
0018 
0019 % Copyright (C) 2010-2011 Dynare Team
0020 %
0021 % This file is part of Dynare.
0022 %
0023 % Dynare is free software: you can redistribute it and/or modify
0024 % it under the terms of the GNU General Public License as published by
0025 % the Free Software Foundation, either version 3 of the License, or
0026 % (at your option) any later version.
0027 %
0028 % Dynare is distributed in the hope that it will be useful,
0029 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0031 % GNU General Public License for more details.
0032 %
0033 % You should have received a copy of the GNU General Public License
0034 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0035 
0036 endo_nbr = M_.endo_nbr;
0037 exo_nbr = M_.exo_nbr;
0038 StateSpaceModel.number_of_state_equations = M_.endo_nbr;
0039 StateSpaceModel.number_of_state_innovations = exo_nbr;
0040 StateSpaceModel.sigma_e_is_diagonal = M_.sigma_e_is_diagonal;
0041 
0042 iv = (1:endo_nbr)';
0043 ic = dr.nstatic+(1:dr.npred)';
0044 
0045 [StateSpaceModel.transition_matrix,StateSpaceModel.impulse_matrix] = kalman_transition_matrix(dr,iv,ic,exo_nbr);
0046 StateSpaceModel.state_innovations_covariance_matrix = M_.Sigma_e;
0047 StateSpaceModel.order_var = dr.order_var;
0048 
0049 conditional_decomposition_array = conditional_variance_decomposition(StateSpaceModel,Steps,SubsetOfVariables );
0050 
0051 if options_.noprint == 0
0052     disp(' ')
0053     disp('CONDITIONAL VARIANCE DECOMPOSITION (in percent)')
0054 end
0055 
0056 vardec_i = zeros(length(SubsetOfVariables),exo_nbr);
0057 
0058 for i=1:length(Steps)
0059     disp(['Period ' int2str(Steps(i)) ':'])
0060     
0061     for j=1:exo_nbr
0062         vardec_i(:,j) = 100*conditional_decomposition_array(:, ...
0063                                                           i,j);
0064     end
0065     if options_.noprint == 0
0066         headers = M_.exo_names;
0067         headers(M_.exo_names_orig_ord,:) = headers;
0068         headers = char(' ',headers);
0069         lh = size(deblank(M_.endo_names(SubsetOfVariables,:)),2)+2;
0070         dyntable('',headers,...
0071                  deblank(M_.endo_names(SubsetOfVariables,:)),...
0072                  vardec_i,lh,8,2);
0073     end
0074 end
0075 
0076 oo_.conditional_variance_decomposition = conditional_decomposition_array;

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