VARData: Data generating process of VAR(p)

Description Usage Arguments Value Examples

View source: R/VARs.R

Description

This function will generate data from a staionary VAR(p) process and return a list containing data and parameters used in the VAR(p) process.

Usage

1
VARData(n, p, T, r_np, A, B, Co, U, Sigma, type, X, mu, Yo)

Arguments

n

: number of variables

p

: lag length

T

: number of observations

r_np

: n x p matrix of roots outside unit circle for an n dimensional independent ar(p)-processes (Lag equations). If not provided, it will be generated randomly.

A

: an n x n full rank matrix of transformation to generate correlated VAR(p) from the n independent AR(p)

B

: (n,n,p) array of the AR(p) process. If B is not given, it will be calculated out of r_np and A.

Co

: (n,k+1) vector of intercept of the VAR(p) process. for type="none" Co = O*(1:n), for const Co is an n vector, exog0 Co is a (n,k) matrix for exog1 Co is an (n,1+k) matrix Depending on type it will be zeros for none,

U

: residuals, if it is not NA it will be used as input to generate the VAR(p)

Sigma

: The covariance matrix of the n dynamically independent processes

type

: deterministic component "none", "const" "exog0" and "exog1" are four options

X

: (T x k) matrix of exogeneous variables.

mu

: an n vector of the expected mean of the VAR(p) process

Yo

: (p x n) matrix of initial values of the process

Value

1
 : A list containing the generated data, the parameters and the input exogeous variables. res = list(n,p,type,r_np,Phi,A,B,Co,Sigma,Y,X,resid,U,Y1,Yo,check)

Examples

1
2
3
4
5
6
7
8
res_d = VARData(n=2,p=2,T=100,type="const")  
res_d = VARData(n=2,p=2,T=10,Co=c(1:2)*0,type="none") 
res_d = VARData(n=2,p=2,T=10,Co=c(1:2),  type="const") 
res_d = VARData(n=3,p=2,T=200,type="exog1",X=matrix(rnorm(400),200,2)) 
res_d = VARData(n=3,p=2,T=200,Co=matrix(c(0,0,0,1,2,3,3,2,1),3,3), type="exog0",X=matrix(rnorm(400),200,2)) 

res_d = VARData(n=2,p=2,T=100,type="const")  
res_d = VARData(n=3,p=2,T=200,type="exog1",X=matrix(rnorm(400),200,2)) 

puchen8229/VARs documentation built on Dec. 31, 2020, 2:10 a.m.