Home > matlab > set_parameters.m

set_parameters

PURPOSE ^

function set_parameters(xparam1)

SYNOPSIS ^

function set_parameters(xparam1)

DESCRIPTION ^

 function set_parameters(xparam1)
 Sets parameters value (except measurement errors)
 This is called for computations such as IRF and forecast
 when measurement errors aren't taken into account
 
 INPUTS
    xparam1:   vector of parameters to be estimated (initial values)
    
 OUTPUTS
    none
        
 SPECIAL REQUIREMENTS
    none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function set_parameters(xparam1)
0002 
0003 % function set_parameters(xparam1)
0004 % Sets parameters value (except measurement errors)
0005 % This is called for computations such as IRF and forecast
0006 % when measurement errors aren't taken into account
0007 %
0008 % INPUTS
0009 %    xparam1:   vector of parameters to be estimated (initial values)
0010 %
0011 % OUTPUTS
0012 %    none
0013 %
0014 % SPECIAL REQUIREMENTS
0015 %    none
0016 
0017 % Copyright (C) 2003-2009 Dynare Team
0018 %
0019 % This file is part of Dynare.
0020 %
0021 % Dynare is free software: you can redistribute it and/or modify
0022 % it under the terms of the GNU General Public License as published by
0023 % the Free Software Foundation, either version 3 of the License, or
0024 % (at your option) any later version.
0025 %
0026 % Dynare is distributed in the hope that it will be useful,
0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0029 % GNU General Public License for more details.
0030 %
0031 % You should have received a copy of the GNU General Public License
0032 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0033 
0034 global estim_params_ M_
0035 
0036 nvx = estim_params_.nvx;
0037 ncx = estim_params_.ncx;
0038 nvn = estim_params_.nvn;
0039 ncn = estim_params_.ncn;
0040 np = estim_params_.np;
0041 Sigma_e = M_.Sigma_e;
0042 offset = 0;
0043 
0044 % stderrs of the exogenous shocks
0045 if nvx
0046     var_exo = estim_params_.var_exo;
0047     for i=1:nvx
0048         k = var_exo(i,1);
0049         Sigma_e(k,k) = xparam1(i)^2;
0050     end
0051 end
0052 % and update offset
0053 offset = offset + nvx + nvn;
0054 
0055 % correlations amonx shocks (ncx)
0056 if ncx
0057     corrx = estim_params_.corrx;
0058     for i=1:ncx
0059         k1 = corrx(i,1);
0060         k2 = corrx(i,2);
0061         Sigma_e(k1,k2) = xparam1(i+offset)*sqrt(Sigma_e(k1,k1)*Sigma_e(k2,k2));
0062         Sigma_e(k2,k1) = Sigma_e(k1,k2);
0063     end
0064 end
0065 % and update offset
0066 offset = offset + ncx + ncn;
0067 
0068 % structural parameters
0069 if np
0070     M_.params(estim_params_.param_vals(:,1)) = xparam1(offset+1:end);
0071 end
0072 
0073 M_.Sigma_e = Sigma_e;

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