# NOT RUN {
# }
# NOT RUN {
# These are long-running examples that use parallel computing.
data(eurusd, package="gmvarkit")
data <- cbind(10*eurusd[,1], 100*eurusd[,2])
colnames(data) <- colnames(eurusd)
# Structural GMVAR(2, 2), d=2 model identified with sign-constraints:
params222s <- c(1.428, -0.808, 1.029, 5.84, 1.314, 0.145, 0.094, 1.292,
-0.389, -0.07, -0.109, -0.281, 1.248, 0.077, -0.04, 1.266, -0.272,
-0.074, 0.034, -0.313, 0.903, 0.718, -0.324, 2.079, 7, 1.44, 0.742)
W_222 <- matrix(c(1, NA, -1, 1), nrow=2, byrow=FALSE)
mod222s <- GMVAR(data, p=2, M=2, params=params222s, structural_pars=list(W=W_222))
mod222s
# Alternatively, use:
# fit222s <- fitGMVAR(data, p=2, M=2, structural_pars=list(W=W_222),
# ncalls=20, seeds=1:20)
# To obtain an estimated version of the same model.
# Estimating the GIRFs of both variables with default arguments
# (initial values are drawn from the stationary distribution of the process,
# 30 periods ahead, confidence levels 0.95 and 0.8):
girf1 <- GIRF(mod222s)
plot(girf1)
girf1
# Estimating the GIRF of the second variable only, 36 periods ahead
# and shock size 1, initial values drawn from the stationary distribution
# of the first regime, confidence level 0.9:
girf2 <- GIRF(mod222s, variables=2, shock_size=1, N=36, init_regimes=1, ci=0.9)
plot(girf2)
# Estimating the GIRFs of both variables, shock sizes 1 and 3, N=50 periods ahead,
# estimation based on 1000 Monte Carlo simulations, and fixed initial values given
# by the last p observations of the data:
girf3 <- GIRF(mod222s, shock_size=c(1, 3), N=50, R1=1000, init_values=mod222s$data)
# }
Run the code above in your browser using DataLab