Repository navigation
Attach dates to VAR Forecasts - #3599
jbrockmendel wants to merge 19 commits into
Conversation
…one actually-new function
|
Thanks for following up on the VAR forecast dates (and all the pep errors :), and I'm sorry I wasn't more helpful before other than that cryptic message. My opinion is that we should not add more special-case date handling in general, and especially not for a "weird" case like From a quick test, what do you think about simply replacing the def forecast(self, y, steps):
"""Produce linear minimum MSE forecasts for desired number of steps
ahead, using prior values y
Parameters
----------
y : ndarray (p x k)
steps : int
Returns
-------
forecasts : ndarray (steps x neqs)
Notes
-----
Lutkepohl pp 37-38
"""
model = getattr(self, 'model', tsbase.TimeSeriesModel(y))
start, end, out_of_sample, prediction_index = (
model._get_prediction_index(model.nobs + 1, model.nobs + steps))
fcast = forecast(y, self.coefs, self.intercept, steps)
return model.data.attach_dates(fcast)It seems to work for me - maybe you can check that it does what you expect? |
When I run the unit test exactly as in the PR, the index is attached to the
This is a clever workaround, but I want to advocate against calls that make copies. |
|
…e editors (specifically SublimeText)
|
Dropped this for a while to focus on statespace, time to wrap this up.
You're right. I was confusing this was an unrelated case where I was passing in several columns from a DataFrame. I eventually want to get around to things like As I mentioned above, delegating to
This seems like an argument for patching this weird case in the short run, then a) getting rid of the weird case and b) handling the general case up in tsabase. I'd much rather spend this time bike-shedding my next PR over whether recession bars should be "peak-to-trough" or [...] Side-note: in var_model.py we have |
… old version was benign, but in others it would raise OSError on Windows
…for %: 'exceptions.ValueError' and 'str'
|
After further thought, I want to make another pitch for the implementation in the PR. The |
The example there belongs elsewhere, as this module is not intended to run as a script. Moreover, attempting to run it raises an error when it tries to run parse_lutkepohl_data and the passed path is not found. But most of all, deleting this should marginally increase coverage, so that coveralls will no longer mark this PR as unsuccessful
|
If there's an Issue for this, this can be closed. |
|
To hopefully also help moving this along: personally I still think like my solution above is the best for this case, since it uses the existing date handling infrastructure and doesn't create special cases. However, I don't have strong views, except that I think it's hard to see what is actually related to the VAR forecasts part here because of all the cleaning up in this PR. Was this cleanup ever merged in a different PR? If not, would it be possible to separate this into two PRs? |
|
This was from when I was just getting to know the code. Even if this approach is right (which it probably isn't), it will be easier to do fresh than to rebase at this point. Closing. |
Addresses #3531. Quoting from there:
In this PR,
_get_forecast_indexmethod is in a newTimeSeriesProcessclass thatVARProcessinherits from.ARMAetc should be able to inherit in the same way, but I'd like to get an OK on this before making changes all over the place.@ChadFulton I like the idea of handling this further up the hierarchy, but I think the "fiddly things" are exactly what is handled in
datetools.get_forecast_index.At the moment the forecast method checks the input data for an index, then falls back to look for a
self.model.dataand an associated index. I like the idea of getting rid of theself.modelcheck and overriding forecast inVARResults.