diff --git a/matlab/conditional_variance_decomposition.m b/matlab/conditional_variance_decomposition.m index c04c61e0c6c6185b1ca3fa31ad4887e804791095..bf8eef091676ab8c5dbacea9bfbba8909af8b949 100644 --- a/matlab/conditional_variance_decomposition.m +++ b/matlab/conditional_variance_decomposition.m @@ -15,7 +15,7 @@ function PackedConditionalVarianceDecomposition = conditional_variance_decomposi % % [1] In this version, absence of measurement errors is assumed... -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2010 Dynare Team % % This file is part of Dynare. % @@ -31,6 +31,7 @@ function PackedConditionalVarianceDecomposition = conditional_variance_decomposi % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. + number_of_state_innovations = ... StateSpaceModel.number_of_state_innovations; transition_matrix = StateSpaceModel.transition_matrix; @@ -68,6 +69,6 @@ NumberOfVariables = length(SubsetOfVariables); PackedConditionalVarianceDecomposition = zeros(NumberOfVariables*(NumberOfVariables+1)/2,length(Steps),StateSpaceModel.number_of_state_innovations); for i=1:number_of_state_innovations for h = 1:length(Steps) - PackedConditionalVarianceDecomposition(:,h,i) = vech(ConditionalVariance(:,:,h,i)); + PackedConditionalVarianceDecomposition(:,h,i) = dyn_vech(ConditionalVariance(:,:,h,i)); end end \ No newline at end of file diff --git a/matlab/display_conditional_variance_decomposition.m b/matlab/display_conditional_variance_decomposition.m index 5fd17383c639d8e43585dd25e381cac5073256bc..99af1e8df36cb6fe5f9d20e1de9bd4b3e7867833 100644 --- a/matlab/display_conditional_variance_decomposition.m +++ b/matlab/display_conditional_variance_decomposition.m @@ -16,7 +16,7 @@ function oo_ = display_conditional_variance_decomposition(Steps, SubsetOfVariabl % [1] The covariance matrix of the state innovations needs to be diagonal. % [2] In this version, absence of measurement errors is assumed... -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2010 Dynare Team % % This file is part of Dynare. % @@ -58,7 +58,7 @@ for i=1:length(Steps) disp(['Period ' int2str(Steps(i)) ':']) for j=1:exo_nbr - vardec_i(:,j) = diag_vech(conditional_decomposition_array(:, ... + vardec_i(:,j) = dyn_diag_vech(conditional_decomposition_array(:, ... i,j)); end vardec_i = 100*vardec_i./repmat(sum(vardec_i,2),1,exo_nbr); diff --git a/matlab/diag_vech.m b/matlab/dyn_diag_vech.m similarity index 93% rename from matlab/diag_vech.m rename to matlab/dyn_diag_vech.m index 6b444b10e10f629a4d2ce2ffc7fe9b61a5568df1..5d5d9466486b19be9ae52eaec04e87c677b97bd2 100644 --- a/matlab/diag_vech.m +++ b/matlab/dyn_diag_vech.m @@ -1,4 +1,4 @@ -function d = diag_vech(Vector) +function d = dyn_diag_vech(Vector) % This function returns the diagonal elements of a symmetric matrix % stored in vech form % @@ -8,7 +8,7 @@ function d = diag_vech(Vector) % OUTPUTS % d [double] a n*1 vector, where n solves n*(n+1)/2=m. -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/unvech.m b/matlab/dyn_unvech.m similarity index 93% rename from matlab/unvech.m rename to matlab/dyn_unvech.m index b5a2bdc1e5efa92f6b583cc89e38bcaf3383e59d..f70670a986f44a3be3275a4ac5ea14942e4e7f49 100644 --- a/matlab/unvech.m +++ b/matlab/dyn_unvech.m @@ -1,4 +1,4 @@ -function Matrix = unvech(Vector) +function Matrix = dyn_unvech(Vector) % This function implements the unvech operator. % % INPUTS @@ -7,7 +7,7 @@ function Matrix = unvech(Vector) % OUTPUTS % Matrix [double] a n*n symetric matrix, where n solves n*(n+1)/2=m. -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2010 Dynare Team % % This file is part of Dynare. % @@ -23,6 +23,7 @@ function Matrix = unvech(Vector) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. + m = length(Vector); n = (sqrt(1+8*m)-1)/2; b = 0; diff --git a/matlab/vech.m b/matlab/dyn_vech.m similarity index 93% rename from matlab/vech.m rename to matlab/dyn_vech.m index b4837671850528ffa8db2edb8d63f01d453346bc..6e54c40502b7f70cc2ebbdf0fa4fd8c5c59ff314 100644 --- a/matlab/vech.m +++ b/matlab/dyn_vech.m @@ -1,4 +1,4 @@ -function Vector = vech(Matrix) +function Vector = dyn_vech(Matrix) % This function implements the vech operator. % % INPUTS @@ -7,7 +7,7 @@ function Vector = vech(Matrix) % OUTPUTS % Vector [double] a n*(n+1)/2 vector. -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2010 Dynare Team % % This file is part of Dynare. % @@ -23,6 +23,7 @@ function Vector = vech(Matrix) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. + n = length(Matrix); b = 0; Vector = NaN(n*(n+1)/2,1); diff --git a/matlab/dynare_identification.m b/matlab/dynare_identification.m index ca68d2b26894c727fc237d56605ec732305bed7d..be5956d1ea5271e26c7f3126c90c119da9bede2c 100644 --- a/matlab/dynare_identification.m +++ b/matlab/dynare_identification.m @@ -2,7 +2,7 @@ function [pdraws, TAU, GAM, LRE, gp, H, JJ] = dynare_identification(options_iden % main % -% Copyright (C) 2008 Dynare Team +% Copyright (C) 2010 Dynare Team % % This file is part of Dynare. % @@ -100,8 +100,8 @@ if iload <=0, % bayestopt_.restrict_var_list, ... % bayestopt_.restrict_columns, ... % bayestopt_.restrict_aux, M_.exo_nbr); - % tau=[vec(Aa); vech(Bb*M_.Sigma_e*Bb')]; - tau=[oo_.dr.ys(oo_.dr.order_var); vec(A); vech(B*M_.Sigma_e*B')]; + % tau=[vec(Aa); dyn_vech(Bb*M_.Sigma_e*Bb')]; + tau=[oo_.dr.ys(oo_.dr.order_var); vec(A); dyn_vech(B*M_.Sigma_e*B')]; yy0=oo_.dr.ys(I); [residual, g1 ] = feval([M_.fname,'_dynamic'],yy0, oo_.exo_steady_state', M_.params,1); @@ -121,7 +121,7 @@ if iload <=0, gam{j+1}=gam{j+1}.*sy; end end - dum = vech(gam{1}); + dum = dyn_vech(gam{1}); for j=1:nlags, dum = [dum; vec(gam{j+1})]; end @@ -277,7 +277,7 @@ end % GAM0=GAM; % end % if useautocorr, -% idiag = find(vech(eye(size(options_.varobs,1)))); +% idiag = find(dyn_vech(eye(size(options_.varobs,1)))); % GAM(idiag,:) = GAM(idiag,:)./(sGAM(idiag)'*ones(1,SampleSize)); % % siJmean(idiag,:) = siJmean(idiag,:)./(sGAM(idiag)'*ones(1,nparam)); % % siJmean = siJmean./(max(siJmean')'*ones(size(params))); diff --git a/matlab/getH.m b/matlab/getH.m index c7d9caef16e4d1780f8b3d6db2f6648c9947379b..30bd790dc599e91bc11eb1c0c1bed6a25ea311c5 100644 --- a/matlab/getH.m +++ b/matlab/getH.m @@ -2,7 +2,7 @@ function [H, dA, dOm, Hss, gp, info] = getH(A, B, M_,oo_,kronflag,indx,indexo) % computes derivative of reduced form linear model w.r.t. deep params % -% Copyright (C) 2008 Dynare Team +% Copyright (C) 2010 Dynare Team % % This file is part of Dynare. % @@ -279,7 +279,7 @@ else % generalized sylvester equation dSig(indexo(j),indexo(j)) = 2*sqrt(M_.Sigma_e(indexo(j),indexo(j))); y = B*dSig*B'; y = y(nauxe+1:end,nauxe+1:end); - H(:,j) = [zeros((m-nauxe)^2,1); vech(y)]; + H(:,j) = [zeros((m-nauxe)^2,1); dyn_vech(y)]; if nargout>1, dOm(:,:,j) = y; end @@ -296,7 +296,7 @@ else % generalized sylvester equation dA(:,:,j+length(indexo)) = x; dOm(:,:,j+length(indexo)) = y; end - H(:,j+length(indexo)) = [x(:); vech(y)]; + H(:,j+length(indexo)) = [x(:); dyn_vech(y)]; end % for j=1:param_nbr, % disp(['Derivatives w.r.t. ',M_.param_names(indx(j),:),', ',int2str(j),'/',int2str(param_nbr)]) @@ -308,7 +308,7 @@ else % generalized sylvester equation % y = y*B'+B*y'; % x = x(nauxe+1:end,nauxe+1:end); % y = y(nauxe+1:end,nauxe+1:end); - % H(:,j) = [x(:); vech(y)]; + % H(:,j) = [x(:); dyn_vech(y)]; % end H = [[zeros(M_.endo_nbr,length(indexo)) Hss]; H]; diff --git a/matlab/getJJ.m b/matlab/getJJ.m index d93316066bf295e2ee635b70e85bffbc9e7c3312..1f684a615b8ba8639a967b61c1e2ef09665d4fc8 100644 --- a/matlab/getJJ.m +++ b/matlab/getJJ.m @@ -1,6 +1,6 @@ function [JJ, H, gam, gp] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr) -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2010 Dynare Team % % This file is part of Dynare. % @@ -68,9 +68,9 @@ else dum1=dum; dum1 = (dum1.*sy-dsy.*GAM)./(sy.*sy); dum1 = dum1-diag(diag(dum1))+diag(diag(dum)); - dumm = vech(dum1(mf,mf)); + dumm = dyn_vech(dum1(mf,mf)); else - dumm = vech(dum(mf,mf)); + dumm = dyn_vech(dum(mf,mf)); end for i=1:nlags, dum1 = A^i*dum; @@ -93,9 +93,9 @@ else dum1=dum; dum1 = (dum1.*sy-dsy.*GAM)./(sy.*sy); dum1 = dum1-diag(diag(dum1))+diag(diag(dum)); - dumm = vech(dum1(mf,mf)); + dumm = dyn_vech(dum1(mf,mf)); else - dumm = vech(dum(mf,mf)); + dumm = dyn_vech(dum(mf,mf)); end for i=1:nlags, dum1 = A^i*dum; @@ -126,7 +126,7 @@ else GAM{j+1}=GAM{j+1}.*sy; end end - gam = vech(GAM{1}); + gam = dyn_vech(GAM{1}); for j=1:nlags, gam = [gam; vec(GAM{j+1})]; end