Debian Codegraph @

contrib/ms-sbvar/TZcode/MatlabFiles/fn_tran_f2g.m

raw
1 function g = fn_tran_f2g(F,Vi,nvar,np)
2 % g = fn_tran_f2g(F,Vi,nvar,np)
3 % Transform F (A+) to free parameters g's. Note: columns correspond to equations
4 % See Waggoner and Zha's ``A Gibbs sampler for structural VARs''
5 %
6 % F: ncoef-by-nvar matrix of original lagged parameters A+. Column corresponding to equation.
7 % Note that ncoef is the number of original lagged variables per equation
8 % Vi: nvar-by-1 cell. In each cell, k-by-ri orthonormal basis for the null of the ith
9 % equation lagged restriction matrix where k is a total of exogenous variables and
10 % ri is the number of free parameters. With this transformation, we have fi = Vi*gi
11 % or Vi'*fi = gi where fi is a vector of total original parameters and gi is a
12 % vector of free parameters. There must be at least one free parameter left for
13 % the ith equation.
14 % nvar: number of endogeous variables
15 % np: nvar-element vector, ith element represents the number of free A+ parameters in ith equation
16 %---------------
17 % g: sum(np)-by-1 stacked vector of all free lagged parameters A+.
18 %
19 % August 2000, Tao Zha
20 %
21 % Copyright (C) 1997-2012 Tao Zha
22 %
23 % This free software: you can redistribute it and/or modify
24 % it under the terms of the GNU General Public License as published by
25 % the Free Software Foundation, either version 3 of the License, or
26 % (at your option) any later version.
27 %
28 % It is distributed in the hope that it will be useful,
29 % but WITHOUT ANY WARRANTY; without even the implied warranty of
30 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 % GNU General Public License for more details.
32 %
33 % If you did not received a copy of the GNU General Public License
34 % with this software, see <http://www.gnu.org/licenses/>.
35 %
36
37 np=np(:);
38 npcum = [0;cumsum(np)];
39 g = zeros(npcum(end),1);
40 for kj=1:nvar
41 g(npcum(kj)+1:npcum(kj+1)) = Vi{kj}'*F(:,kj);
42 end