from statsmodels.tsa.vector_ar.var_model import VAR
max_lag = 20
# occ_data is a dataframe by the size of 52584 rows × 5 columns
var_model = VAR(occ_data)
# select the best lag order
lag_results = var_model.select_order(max_lag)
selected_lag = lag_results.aic
print(selected_lag)
After running this I get the error: 5-th leading minor of the array is not positive definite
for this line: lag_results = var_model.select_order(max_lag)
How do I make the array to positive definite? Thanks for the help!
occ_data:
BGT North of NE 70th Total Ped South Ped North Bike North Bike South
Date
2014-01-01 00:00:00 0.002665 0.000243 0.000186 -1.901329e-05 0.002255
2014-01-01 01:00:00 -5.997088 1.000224 -1.999776 -1.000000e+00 -3.997536
2014-01-01 02:00:00 0.002912 -0.999776 0.000224 -1.000000e+00 2.002464
2014-01-01 03:00:00 10.002912 0.000224 0.000224 4.260205e-09 10.002464
2014-01-01 04:00:00 0.002912 0.000224 0.000224 4.260205e-09 0.002464
... ... ... ... ... ...
2019-12-31 19:00:00 -7.997536 -2.000000 -4.999104 1.000896e+00 -1.999328
2019-12-31 20:00:00 -3.997536 -2.000000 -0.999104 -9.991039e-01 0.000672
2019-12-31 21:00:00 1.002464 1.000000 2.000896 8.960573e-04 -1.999328
2019-12-31 22:00:00 -1.997536 -1.000000 -1.999104 8.960573e-04 1.000672
2019-12-31 23:00:00 1.002464 1.000000 0.000896 1.000896e+00 -0.999328
VAR: which stands for Vector Auto-Regression - is a statistical model used to capture the relationship between multiple quantities as they change over time. VAR is a type of stochastic process model. VAR models generalize the single-variable (univariate) autoregressive model by allowing for multivariate time series. VAR models are often used in economics and the natural sciences.