Hello everyone,
I'm working on a VAR (Vector Autoregression) model using R, and I'm running into some issues with the serial test of the residuals. I am using the vars
package for my analysis.
After fitting the VAR model for different lag lengths, I perform a serial correlation test (serial.test()
function in vars
package) to evaluate the model. Oddly enough, every test comes back with a degrees of freedom (df) value of 0 and a very low p-value, which seems to suggest that there is a serious issue with the model.
Here is the R code snippet I am using for the VAR model and the serial test:
Fitting VAR model
var_fits_reduced <- list()
max_lag_reduced <- 30
for (p in 2:max_lag_reduced) {
var_fits_reduced[[p - 1]] <- VAR(data_reduced, p = p, type = "both")
}
Serial correlation test
serial_tests_reduced <- list()
for (i in 1:length(var_fits_reduced)) {
serial_tests_reduced[[i]] <- serial.test(var_fits_reduced[[i]], lags.pt = var_fits_reduced[[i]]$p)
print(paste("Serial test for lag", var_fits_reduced[[i]]$p))
print(serial_tests_reduced[[i]])
}
Here is an example of one of the test results:
Portmanteau Test (asymptotic)
Chi-squared = 1.7954, df = 0, p-value < 2.2e-16
I've double-checked the data for stationarity and other potential issues but can't seem to find the source of the problem.
- Has anyone else encountered this issue?
- What might be causing this?
- Are there any solutions or alternatives to investigate?
I appreciate any help or insights you can offer. Thank you in advance!