You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG/DOC DynamicVAR in vector_ar example is broken #2272
@josef-pkt Do you have any idea where the 500-row data DataFrame in the DynamicVAR example came from?
Asking because that's what is causing the example to fail (apart from MultiPanel/Panel): the example assumes that there are columns called "A" through "D", but your example comes from the earlier section of the same page where data consists of "realgdp", etc.
My guess is that I didn't look carefully enough to realize that the data for DynamicVAR is different from the previous example.
After a bit of search, I guess it's simulated data, see the __main__ of statsmodels.tsa.vector_ar.dynamic
I'm using pandas.version '0.12.0' right now.
The following works for me
import pandas.util.testing as ptest
from statsmodels.tsa.vector_ar.dynamic import DynamicVAR
# the following lines are copied from statsmodels.tsa.vector_ar.dynamic __main__
ptest.N = 500
data = ptest.makeTimeDataFrame().cumsum(0)
var = DynamicVAR(data, lag_order=2, window_type='expanding')
var2 = DynamicVAR(data, lag_order=2, window=10,
window_type='rolling')
which generates:
>>> data
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 500 entries, 2000-01-03 00:00:00 to 2001-11-30 00:00:00
Freq: B
Data columns (total 4 columns):
A 500 non-null values
B 500 non-null values
C 500 non-null values
D 500 non-null values
dtypes: float64(4)
and this seems to be working
>>> var
<statsmodels.tsa.vector_ar.dynamic.DynamicVAR object at 0x0451F1F0>
>>> var.coefs
<class 'pandas.core.panel.Panel'>
Dimensions: 9 (items) x 489 (major_axis) x 4 (minor_axis)
Items axis: L1.A to intercept
Major_axis axis: 2000-01-18 00:00:00 to 2001-11-30 00:00:00
Minor_axis axis: A to D
>>> var.forecast(2)
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 487 entries, 2000-01-20 00:00:00 to 2001-11-30 00:00:00
Freq: B
Data columns (total 4 columns):
A 487 non-null values
B 487 non-null values
C 487 non-null values
D 487 non-null values
dtypes: float64(4)
Activity
kiyoto commentedon Jul 26, 2015
@josef-pkt Do you have any idea where the 500-row
dataDataFrame in the DynamicVAR example came from?Asking because that's what is causing the example to fail (apart from MultiPanel/Panel): the example assumes that there are columns called "A" through "D", but your example comes from the earlier section of the same page where
dataconsists of "realgdp", etc.josef-pkt commentedon Jul 27, 2015
My guess is that I didn't look carefully enough to realize that the data for DynamicVAR is different from the previous example.
After a bit of search, I guess it's simulated data, see the
__main__ofstatsmodels.tsa.vector_ar.dynamicI'm using pandas.version '0.12.0' right now.
The following works for me
which generates:
and this seems to be working
kiyoto commentedon Jul 27, 2015
@josef-pkt let me add that context for the data and also update it. Multipanel is deprecated, I think.
kiyoto commentedon Jul 28, 2015
@josef-pkt thanks for the comment. squashed into a single commit.