Congrats and thanks for the package development! I think this is really one of the few options for estimating Vector Error Correction Models with stochastic volatility in R, works like a charm!
I've encountered an issue, however, when trying to use the summary.bvarlist on models with stochastic volatility.
The following works (taken from the vignette, substitung VAR for VEC with the default sigma priors):
library(bvartools)
set.seed(123456) # Set seed for reproducibility
data("e1") # Load data
data <- diff(log(e1)) * 100 # Obtain log-differences
# Use date up to 1978Q4
data <- window(data, end = c(1978, 4))
object <- gen_vec(data,
p = 1:3,
iterations = 5000, burnin = 1000
)
object <- add_priors(object,
coef = list(v_i = 0, v_i_det = 0),
sigma = list(
shape = 0.01,
rate = 0.01,
mu = 0, v_i = 0.01,
sigma_h = 0.05,
constant = 1e-04
)
)
object <- draw_posterior(object, mc.cores = 3)
summary(object)
p s r LL AIC BIC HQ
1 1 1 1 -487.5117 983.0235 992.1302 986.6489
2 1 1 2 -519.6540 1049.3080 1060.6913 1053.8397
3 2 1 0 -472.2474 950.4948 957.3248 953.2138
4 2 1 1 -455.6306 925.2613 941.1980 931.6057
5 2 1 2 -501.8354 1019.6707 1037.8840 1026.9215
6 3 1 0 -450.6170 913.2341 926.8941 918.6722
7 3 1 1 -444.5118 909.0237 931.7903 918.0871
8 3 1 2 -501.3037 1024.6073 1049.6507 1034.5771
When estimating this model with sv = TRUE, however, I get the following error message.
object <- gen_vec(data,
p = 1:3,
iterations = 5000, burnin = 1000, sv = TRUE
)
# add priors and draw_posterior like above
summary(object)
> Error in matrix(NA, tt, draws) : non-numeric matrix extent
In addition: Warning message:
In cbind(temp_pars, object[[i]][[j]]) :
number of rows of result is not a multiple of vector length (arg 1)
The same error message also comes up for for
object <- gen_var(data,
p = 1:3,
iterations = 5000, burnin = 1000, sv = TRUE
)
Is this a mathemical issue (impossibility), or rather a programmatic one? It would be helpful to make informed decisions about lag-length choice for those kind of VEC or VAR models.
R version 4.4.1 (2024-06-14)
Platform: x86_64-apple-darwin20
Running under: macOS 15.5
other attached packages:
[1] bvartools_0.2.4 Matrix_1.7-2 coda_0.19-4.1
Congrats and thanks for the package development! I think this is really one of the few options for estimating Vector Error Correction Models with stochastic volatility in R, works like a charm!
I've encountered an issue, however, when trying to use the
summary.bvarliston models with stochastic volatility.The following works (taken from the vignette, substitung VAR for VEC with the default sigma priors):
When estimating this model with
sv = TRUE, however, I get the following error message.The same error message also comes up for for
Is this a mathemical issue (impossibility), or rather a programmatic one? It would be helpful to make informed decisions about lag-length choice for those kind of VEC or VAR models.