convPsi2varresult: Convert format for VAR coefficients from Psi to varresult

View source: R/convPsi2varresult.R

convPsi2varresultR Documentation

Convert format for VAR coefficients from Psi to varresult

Description

Convert a matrix of VAR coefficients estimated by a shrinkage method into a list of "shrinklm" object, where the class "shrinklm" inherits the class "lm".

Usage

convPsi2varresult(
  Psi,
  Y,
  X,
  lambda0,
  type = c("const", "trend", "both", "none"),
  ybar = NULL,
  xbar = NULL,
  Q_values = NULL,
  callstr = ""
)

Arguments

Psi

An M-by-K matrix of VAR coefficients

Y

An N-by-K data matrix of dependent variables

X

An N-by-M data matrix of regressors

lambda0

A rescaled shrinkage intensity parameter, based on which the effective number of parameters is computed by

Trace(X(X'X + \lambda_0*I)^{-1} X')

type

Type of deterministic variables in the VAR estimation problem. Either of "const", "trend", "both", or "none".

ybar, xbar

NULL if Y and X are not centered. Mean vectors if Y and X had been centered. If Y and X had been centered (ybar and xbar are not NULL) and type is "const" or "both", then the coefficients for the constant term is computed and concatenated to the coefficients.

Q_values

Nonnegative weight vector of length N. Default is NULL. Take weights on rows (samples) of Y and X by sqrt(Q).

callstr

The call to VARshrink().

Details

Consider VAR(p) model:

y_t = A_1 y_{t-1} + ... + A_p y_{t-p} + C d_t + e_t.

It can be written in the matrix form:

Y = X \Psi + E,

where \Psi is a concatenated M-by-K matrix, \Psi = (A_1, ..., A_p, C)^T. It can be written in the multiple linear regression form of a VAR(p) model:

y_j = X \psi_j + e_j, \quad j=1,...,K,

where y_j, \psi_j, and e_j are the j-th column vectors of Y, \Psi, and E, respectively. This function converts \Psi into a list of "shrinklm" objects, where each "shrinklm" object contains the length-M vector \psi_j as coefficients.

Considering that each coefficient vector \psi_j is estimated by a shrinkage method, the effective number of parameters, k_{eff}, is computed as:

k_{eff} = Trace(X (X^T X + \lambda_0 * I)^{-1} X^T).

Then, the degree of freedom of residuals is computed as:

df.residual = N - k_{eff},

where N is the number of rows of data matrices Y and X.

Value

A list object with objects of class c("shrinklm", "lm"). Each "shrinklm" object has components: coefficients, residuals, fitted.values, rank, df.residual, lambda0, call, terms, svd


VARshrink documentation built on Jan. 10, 2026, 1:06 a.m.