PAR representations of VAR models
VAR2pcfilter.Rd
Give the univariate periodic autoregression representation of a VAR model. Several arrangements are supported as discussed by Boshnakov and Iqelan (2009) . If the VAR model contains unit roots on the unit circle, then the univariate model is periodically integrated.
Arguments
- phi
VAR coefficients, a matrix, see Details.
- ...
alternative way to specify the VAR coefficients by giving a matrix for each lag in separate arguments, see section ‘Details’.
- Sigma
covariance matrix of innovations.
- Phi0
coefficient matrix at lag 0 (alternative to
Sigma
).- Phi0inv
inverse of
Phi0
(alternative toSigma
andPhi0
). IfPhi0inv
is lower triangular, then it is the Cholesky factor of Sigma (in Sigma\({} = LDL'\)).- D
the diagonal matrix corresponding to
Phi0
, not used ifSigma
is specified.- what
what to return, a string. If equal to
"coef"
, return the PAR coefficients only (as a matrix with one row for each ``season''); if equal to"coef.and.var"
return also the innovation variances. Otherwise return additional quantities (useful for exploration).- perm
a permutation specifying the ordering of the variables when treated as ``seasons''. The default,
d:1
, corresponds to the U-form, see section ‘Details’.
Details
VAR2pcfilter
converts a VAR model to a scalar periodic
autoregressive (PAR) model. There are various ways to specify a VAR
model and associate its variables with seasons of the scalar
representation, see Boshnakov and Iqelan (2009)
for a detailed discussion and the terminology used here.
The VAR coefficients phi,...
are those in the standard form of
the VAR model (e.g., see Boshnakov and Iqelan 2009)
.
There are two ways to specify them. The first is to put them side by
side in a matrix \([\Phi_1, \ldots, \Phi_p]\) and give this matrix
as argument phi
. Alternatively, the matrices \(\Phi_i\) may
be given directly as arguments to VAR2pcfilter
, as in
VAR2pcfilter(Phi1, Phi2, Phi3, Sigma = Sigma)
.
The specification of the model can be completed by giving the
covariance matrix, Sigma
, of the innovations. Alternatively,
it is possible to give the components of the \(UDU'\) decomposition
of Sigma
. In this case argument D
is a vector giving the
diagonal of the matrix \(D\), while Phi0inv
represents the
upper triangular matrix \(U\). A further option is to use argument
Phi0
to specify the inverse of \(U\). In summary, give either
Sigma
or D
and one of Phi0inv
and Phi0
.
Phi0
can e interpreted as the coefficient at lag zero in the
U-form (Boshnakov and Iqelan 2009)
of the VAR model.
diag(D)
is the variance matrix of the innovations in that
form. D
also gives the variances of the innovations in the PAR
(periodic autoregression) form.
By default, VAR2pcfilter
constructs the U-form of the VAR model
and extracts the coefficients of the PAR filter from it. This means
that the variables in the multivariate vector are given ``seasons'' in
reverse order (the first variable takes the last season, and so on).
For the reasons behind this default, see
Boshnakov and Iqelan (2009)
. Another
arrangement can be chosen with the help of argument
perm
. perm
should be a permutation specifying the
desired allocation of variables to seasons. The default corresponds to
perm=d:1
, where d
is the number of
seasons. perm=1:d
could be used to request the ``natural''
order.
When D
and Phi0inv
(or Phi0
) are given, the
matrix Sigma
is not computed if argument perm
is missing
but it is if perm
is present. This means that perm = d:1
may be used to force the formation of Sigma
and recomputation
of Phi0
and Phi0inv
. This is redundant if the latter two
are unit upper-triangular (which is assumed but not checked) but may
be handy if, for example, the Cholesky decomposition with a lower
triangular matrix is available.
Value
If what="coef"
, a matrix containing the periodic model
coefficients (one row for each season).
If what="coef.and.var"
, a list containing the coefficients and
the innovations' variances:
- pcfilter
PAR coefficients, a matrix
- var
innovation variances, a vector
Otherwise the returned list contains an additional component,
Uform
, which is itself a list with components:
- Sigma
covariance matrix of innovations,
- U0
coefficient for lag zero,
- U
the remaining AR coefficients,
- U0inv
the inverse of
U0
,- perm
permutation giving the season of each variable.
Note: U0
and U
correspond to \(A0\) and \(A\) in the
reference (Boshnakov and Iqelan 2009).
References
Boshnakov GN, Iqelan BM (2009). “Generation of time series models with given spectral properties.” J. Time Series Anal., 30(3), 349--368. ISSN 0143-9782, doi:10.1111/j.1467-9892.2009.00617.x .
Note
This function uses some non-exported internal functions:
- .ldl
Computes the LDL' Cholesky decomposition with unit lower-triangular matrix L,
- .udu
Computes the UDU' Cholesky decomposition with unit upper-triangular matrix U.
Could export these if they are deemed more widely useful.
Examples
## create a pc filter
rfi <- sim_pcfilter(2,3)
rfi$pcfilter
#> [,1] [,2] [,3]
#> [1,] 0.7421642 0.2238061 -0.14942123
#> [2,] 0.3492677 0.1859270 -0.07680944
## turn it into VAR form
flt <- new("MultiFilter", coef = rfi$pcfilter)
I1 <- mf_VSform(flt, form="I")
I1
#> $Phi0
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
#>
#> $Phi
#> [,1] [,2] [,3] [,4]
#> [1,] 0.4451410 0.001358806 -0.05218801 0
#> [2,] 0.7421642 0.223806109 -0.14942123 0
#>
#> $Phi0inv
#> [,1] [,2]
#> [1,] 1 0.3492677
#> [2,] 0 1.0000000
#>
## from VAR to scalar form
flt2 <- VAR2pcfilter(I1$Phi, Sigma = I1$Phi0inv %*% t(I1$Phi0inv))
flt2
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.7421642 0.2238061 -0.14942123 0.000000e+00 0
#> [2,] 0.3492677 0.1859270 -0.07680944 2.040898e-18 0
## confirm that we are back to the original
## (VAR2pcfilter doesn't drop redundant zeroes, so we do it manually)
all.equal(flt2[ , 1:3], rfi$pcfilter) ## TRUE
#> [1] TRUE