make_companion_matrix
make_companion_matrix(B_plus::Matrix{<:Number}) -> Matrix{<:Number}
make_companion_matrix(Bs::Vector{<:Matrix{<:Number}}, p::Int, n_exo::Int) -> Matrix{<:Number}
Constructs the companion matrix of a VAR(p) model.
Arguments
Bs
: a vector of lag matrices[B_1, B_2, ..., B_p]
, eachk × k
B_plus
: a single matrix formed by horizontally concatenating \([C B_1 B_2 ... B_p]\) where \(C\) is the matrix of coefficients for deterministic (exogeneous) components.p::Int
: lag-length of the VAR.n_exo::Int
: number of exogenous components, i.e. number of columns in \(C\).
Returns
Matrix{<:Number}
: The companion matrix of size(k*p × k*p)
Notes
The companion matrix C
has the block form:
\[ C = \begin{bmatrix} B_+ \\ I_{(p-1)k} & 0 \end{bmatrix} \]
where \(B_+\) stacks the lag matrices, and \(k\) is the number of variables.
make_companion_matrix(model::VAR) -> Matrix{<:Number}
Returns the companion matrix of a VAR(p)
model.
The companion matrix is a square matrix of size (k * p, k * p)
, where k
is the number of variables in the system and p
is the lag order.
\[ Z_t = A Z_{t-1} + \varepsilon_t \]
where \(Z_t\) is a \(k \times p\)-dimensional stacked vector of lagged variables.
The matrix has the following block form:
\[ A = \begin{bmatrix} B_1 & B_2 & ... & B_p \\ I_k & 0 & ... & 0 \\ 0 & I_k & ... & 0 \\ ... & ... & ... & ... \end{bmatrix} \]
where \(B_1, ..., B_p\) are the VAR coefficient matrices, and \(I_k\) is the identity matrix of size k
.
Arguments
model::VAR
: A fitted VAR model.
make_companion_matrix(model::SVAR) --> Matrix{<:Number}
Returns the companion matrix for the VAR
representation of the SVAR
.