Differences between revisions 4 and 5
Revision 4 as of 2010-03-08 13:38:02
Size: 2635
Comment:
Revision 5 as of 2011-11-06 14:59:00
Size: 2847
Comment:
Deletions are marked like this. Additions are marked like this.
Line 42: Line 42:
''R'',,i,, matrices have ''k=r*n+m'' columns and as many rows as there are restrictions. ''R'',,i,, matrices have ''k=r*n+1'' columns and as many rows as there are restrictions.
Line 46: Line 46:
The ''Q'',,i,, and ''R'',,i,, matrices are stored in 3-dimensional arrays: ''Qi' and ''Ri' The ''Q'',,i,, and ''R'',,i,, matrices are stored in 2 cell arrays, with as many elements as equations:
Line 48: Line 48:
Qi = zeros(n,n,n);
Ri = zeros(k,k,n);
Qi = cell(n);
Ri = cell(n);
Line 52: Line 52:
For each exculsion of variable ''y'',,t,j,, in equation ''i'' Each element of the cell arrays is a matrix with as many rows as there are restrictions on the equation and as many columns as there are coefficients in ''A'',,0,, and ''A'',,+,, respectively.

For each exclusion of variable ''y'',,t,j,, in equation ''i''
Line 54: Line 56:
Qi(h,j,i) = 1; Qi{i}(h,j) = 1;
Line 60: Line 62:
Ri(h,(p-1)*n+j,i) = 1; Ri{i}(h,(p-1)*n+j) = 1;
Line 64: Line 66:
The above should be implemented in the preprocessor that should create {{{options_.ms.Qi}}} and {{{options_.ms.Ri}}} [these names may collide with restriction on Markov processes. We will need to check later] For general linear restrictions on the coefficients, the non-zero elements of the matrices in {{{Qi}}} and {{{Ri}}} are not necessarily equal to 1.
Line 66: Line 68:
In Matlab, we need a function {{{swz/identification/exclusions.m}}}, similar of {{{swz/identification/upper_cholesky.m}}} that is called when exclusions are specified instead of {{{upper_cholesky}}} or {{{lower_cholesky}}} Excluding the constant in equation ''i'' requires setting
{{{
Ri{i}(h,r*n+1) = 1;
}}}
Line 68: Line 73:
The only code needed in this function is The preprocessor creates {{{options_.ms.Qi}}} and {{{options_.ms.Ri}}}

The Matlab function {{{swz/identification/exclusions.m}}} handles these options, except when {{{upper_cholesky}}} or {{{lower_cholesky}}} are specified. It contains the following code:
Line 83: Line 90:
It is also necessary to write {{{swz/identification/lower_cholesky.m}}} and makes sure that the matrices have the right dimensions.

Interface for SVAR exculsion restrictions

Model

\[
y_t' A_0 = \sum_{i=1}^r y_{t-i} A_i + z_t' C + \epsilon_t
\]

where yt is a vector of n endogenous variables, r is the maximum lag length, z a vector of m exogenous variables (only a constant for the time being).

Note that each equation corresponds to the columns of Ai, i=0,...,r.

The model can be written in a more compact form

\[
y_t' A_0 = x_t A_+ + \epsilon_t
\]

where

\[
x_t = \left[\begin{array}{cccc}y_{t-1}' & \ldots & y_{t-r}' & z_t'\end{array}\right]\;\;\;
A_+ = \left[\begin{array}{c}A_1\\ \vdots \\ A_t\\ C\end{array}\right]
\]

Exculsion Restrictions

Restricitions are defined with Qi and Ri matrices for each column of A0 and A+ respectively.

Q and R matrices are made of 0 and 1 such that

\[
Q_i A_{0,i} = 0\;\;\;R_i A_{+,i} = 0
\]

Qi matrices have n columns and as many rows as there are restrictions.

Ri matrices have k=r*n+1 columns and as many rows as there are restrictions.

Dynare implementation

The Qi and Ri matrices are stored in 2 cell arrays, with as many elements as equations:

Qi = cell(n);
Ri = cell(n);

Each element of the cell arrays is a matrix with as many rows as there are restrictions on the equation and as many columns as there are coefficients in A0 and A+ respectively.

For each exclusion of variable yt,j in equation i

Qi{i}(h,j) = 1;

where h is the number of the restriction in equation i in A0

For each exclusion of variable yt-p,j in equation i

Ri{i}(h,(p-1)*n+j) = 1;

where h is the number of the restriction in equation i in A+

For general linear restrictions on the coefficients, the non-zero elements of the matrices in Qi and Ri are not necessarily equal to 1.

Excluding the constant in equation i requires setting

Ri{i}(h,r*n+1) = 1;

The preprocessor creates options_.ms.Qi and options_.ms.Ri

The Matlab function swz/identification/exclusions.m handles these options, except when upper_cholesky or lower_cholesky are specified. It contains the following code:

%make local copy in order not to call structure fields inside a loop
Qi = options_.ms.Qi;
Ri = options_.ms.Ri;
for n=1:nvar
 Ui{n" = null(Qi(:,:,n));
 Vi{n} = null(Ri(:,:,n));
 n0(n) = size(Ui{n},2);
 np(n) = size(Vi{n},2);
end

ixmCoPres = NaN; }}}

and makes sure that the matrices have the right dimensions.

DynareWiki: SvarExclusionInterface (last edited 2011-11-06 14:59:48 by MichelJuillard)