# \donttest{
# select minimal or full example #
is_min = TRUE
idx_i = ifelse(is_min, 1, 1:14)
# load and prepare data #
data("EURO")
data("EU_w")
names_i = names(EURO[idx_i+1]) # country names (#1 is EA-wide aggregated data)
idx_k = 1:4 # endogenous variables in individual data matrices
idx_t = 1:76 # periods from 2001Q1 to 2019Q4
trend2 = idx_t^2
# individual VARX models with common lag-order p=2 #
L.data = lapply(EURO[idx_i+1], FUN=function(x) x[idx_t, idx_k])
L.exog = lapply(EURO[idx_i+1], FUN=function(x) cbind(trend2, x[idx_t, 5:10]))
L.vars = sapply(names_i, FUN=function(i)
vars::VAR(L.data[[i]], p=2, type="both", exogen=L.exog[[i]]),
simplify=FALSE)
# identify under common orthogonal matrix (with pooled sample size (T-p)*N) #
S.pind = copula::indepTestSim(n=(76-2)*length(names_i), p=length(idx_k), N=100)
R.pcvm = pid.cvm(L.vars, dd=S.pind, combine="pool")
R.irf = irf(R.pcvm, n.ahead=50, w=EU_w)
plot(R.irf, selection=list(1:2, 3:4))
# identify individually (with same sample size T-p for all 'i') #
S.pind = copula::indepTestSim(n=(76-2), p=length(idx_k), N=100)
R.pcvm = pid.cvm(L.vars, dd=S.pind, combine="indiv")
R.irf = irf(R.pcvm, n.ahead=50, w=EU_w)
plot(R.irf, selection=list(1:2, 3:4))
# }
Run the code above in your browser using DataLab