Home > matlab > thet2tau.m

thet2tau

PURPOSE ^

SYNOPSIS ^

function tau = thet2tau(params, indx, indexo, flagmoments,mf,nlags,useautocorr)

DESCRIPTION ^

 Copyright (C) 2011 Dynare Team

 This file is part of Dynare.

 Dynare is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Dynare is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function tau = thet2tau(params, indx, indexo, flagmoments,mf,nlags,useautocorr)
0002 
0003 %
0004 % Copyright (C) 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 nargin==1,
0024     indx = [1:M_.param_nbr];
0025     indexo = [];
0026 end
0027 
0028 if nargin<4,
0029     flagmoments=0;
0030 end
0031 if nargin<7 || isempty(useautocorr),
0032     useautocorr=0;
0033 end
0034 
0035 M_.params(indx) = params(length(indexo)+1:end);
0036 if ~isempty(indexo)
0037     M_.Sigma_e(indexo,indexo) = diag(params(1:length(indexo)).^2);
0038 end
0039 [A,B,tele,tubbies,M_,options_,oo_] = dynare_resolve(M_,options_,oo_);
0040 if flagmoments==0,
0041     tau = [oo_.dr.ys(oo_.dr.order_var); A(:); dyn_vech(B*M_.Sigma_e*B')];
0042 else
0043     GAM =  lyapunov_symm(A,B*M_.Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold);
0044     k = find(abs(GAM) < 1e-12);
0045     GAM(k) = 0;
0046     if useautocorr,
0047         sy = sqrt(diag(GAM));
0048         sy = sy*sy';
0049         sy0 = sy-diag(diag(sy))+eye(length(sy));
0050         dum = GAM./sy0;
0051         tau = dyn_vech(dum(mf,mf));
0052     else
0053         tau = dyn_vech(GAM(mf,mf));
0054     end
0055     for ii = 1:nlags
0056         dum = A^(ii)*GAM;
0057         if useautocorr,
0058             dum = dum./sy;
0059         end
0060         tau = [tau;vec(dum(mf,mf))];
0061     end
0062     tau = [ oo_.dr.ys(oo_.dr.order_var(mf)); tau];
0063 end

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005