Learn R Programming

pvars (version 1.1.1)

as.pvarx: Coerce into a 'pvarx' object

Description

Coerce into a 'pvarx' object. On top of the parent class 'pvarx', the child class 'pid' is imposed if the input object to be transformed contains a panel SVAR model.

Usage

as.pvarx(x, w = NULL, ...)

Value

A list of class 'pvarx'. Objects of this class contain the elements:

A

Matrix. The lined-up coefficient matrices \(A_j, j=1,\ldots,p\) for the lagged variables in the panel VAR.

B

Matrix. The \((K \times S)\) structural impact matrix of the panel SVAR model or an identity matrix \(I_K\) as a placeholder for the unidentified VAR model.

beta

Matrix. The \(((K+n_{d1}) \times r)\) cointegrating matrix of the VAR model if transformed from a rank-restricted VECM.

L.varx

List of varx objects for the individual estimation results.

args_pvarx

List of characters and integers indicating the estimator and specifications that have been used.

args_pid

List of characters and integers indicating the identification methods and specifications that have been used. This element is specific to the child-class 'pid' for panel SVAR models, that inherit from parent-class 'pvarx' for any panel VAR model.

Arguments

x

A panel VAR object to be transformed.

w

Numeric, logical, or character vector. \(N\) numeric elements weighting the individual coefficients, or names or \(N\) logical elements selecting a subset from the individuals \(i = 1, \ldots, N\) for the MG estimation. If NULL (the default), all \(N\) individuals are included without weights.

...

Additional arguments to be passed to or from methods.

Details

as.pvarx is used as an intermediary in the pvars functions to achieve compatibility with different classes of panel VAR objects. If the user wishes to extend this compatibility with further classes, she may simply specify accordant as.pvarx-methods instead of altering the original pvars function.

Examples

Run this code
data("PCAP")
names_k = c("g", "k", "l", "y")  # variable names
names_i = levels(PCAP$id_i)      # country names 
L.data  = sapply(names_i, FUN=function(i) 
  ts(PCAP[PCAP$id_i==i, names_k], start=1960, end=2019, frequency=1), 
  simplify=FALSE)
  
L.vars = lapply(L.data, FUN=function(x) vars::VAR(x, p=2, type="both"))
as.pvarx(L.vars)

Run the code above in your browser using DataLab