Repository navigation
Conversation
Rename greek-named variable to standard notation Rename detomega to det_cov_resid Rename _cov_sigma to _cov_of_cov_resid
Use standard python names Small internal renames for consistency
Use a more meaningful name in forecast methods
Fully memoize confidence band constructions
Replace missed kwarg
Concistently apply renames
Deprecate verbose printing in favor of additional returns
Fix missed renames to avoid warnings Rename interval estimator to be more meaningful
Prefer Bunch to allow . access
Simplify and clean
Use inspection to determine type
Use endog in place of y Use pythonic variable nameing, e.g., replace Gd with g_d
Add many missing doctrings
Remove opaque private dictionary in facto of defined kwards
Use no space version
Fix some small doc issues
| self.svar_irfs = model.svar_ma_rep(periods, P=P) | ||
| else: | ||
| self.orth_irfs = model.orth_ma_rep(periods, P=P) | ||
| self.orth_irfs = model.orth_ma_rep(periods, p=P) |
There was a problem hiding this comment.
should this also be done in the svar_ma_rep above?
| @@ -296,11 +296,11 @@ def errband_mc(self, orth=False, svar=False, repl=1000, | |||
| model = self.model | |||
| periods = self.periods | |||
| if svar == True: | |||
| irf_resim = model.irf_resim(orth=orth, repl=repl, T=periods, seed=seed, | ||
| burn=100) | ||
| irf_resim = model.irf_resim(orth=orth, repl=repl, horizon=periods, seed=seed, | ||
| burn=100) |
There was a problem hiding this comment.
Should the burn kwarg in the method be passed instead of hard-coding 100?
There was a problem hiding this comment.
Saved for irf.py cleanup
| neqs = self.neqs | ||
| irf_resim = model.irf_resim(orth=orth, repl=repl, T=periods, seed=seed, | ||
| burn=100) | ||
| irf_resim = model.irf_resim(orth=orth, repl=repl, horizon=periods, seed=seed, |
There was a problem hiding this comment.
I think all uses of irf_resim are here. Should that just be an irf method instead of a VARResults method?
There was a problem hiding this comment.
Probably, but saving for irf clean
| T=periods, signif=signif, seed=seed, burn=burn, cum=True) | ||
| return model.irf_errband_mc(orth=orth, repl=repl, horizon=periods, | ||
| signif=signif, seed=seed, burn=burn, | ||
| cum=True) |
There was a problem hiding this comment.
I wouldn't be opposed to changing cum to cumul
| try: | ||
| from pandas.util._decorators import deprecate_kwarg | ||
| except ImportError: | ||
| from pandas.util.decorators import deprecate_kwarg |
| @@ -12,6 +12,10 @@ | |||
| import numpy as np | |||
| import numpy.linalg as npl | |||
There was a problem hiding this comment.
Getting rid of this and other unique import as [...] names in this modules would be nice
| self.names = names | ||
|
|
||
| def orth_ma_rep(self, maxn=10, P=None): | ||
| def orth_ma_rep(self, maxn=10, p=None): |
There was a problem hiding this comment.
svar_ma_rep below also change P-->p?
Actually, why this change? P is a matrix right?
There was a problem hiding this comment.
P is not an ideal python variable name, p is.
|
|
||
| def test_forecast(self): | ||
| point = self.res.forecast(self.res.y[-5:], 5) | ||
| point = self.res.forecast(self.res.endog[-5:], 5) |
There was a problem hiding this comment.
Very much +1 for getting rid of the multiple aliases with the # keep alias for nows
There was a problem hiding this comment.
There was a problem hiding this comment.
I added this decorator with some extensions as part of this PR. Saved a lot of error prone copy-paste pain upgrading attributes to properties.
There was a problem hiding this comment.
I like the edits you made, will incorporate them downstream. There's also a test ready to be copied.
|
|
||
| def test_forecast_interval(self): | ||
| y = self.res.y[:-self.p:] | ||
| y = self.res.endog[:-self.p:] |
There was a problem hiding this comment.
Maybe I need more caffeine; what does this slice mean?
There was a problem hiding this comment.
The last colon is unnecessary
| try: | ||
| from pandas.util._decorators import deprecate_kwarg | ||
| except ImportError: | ||
| from pandas.util.decorators import deprecate_kwarg |
There was a problem hiding this comment.
Should this be done in compat.pandas?
|
|
||
| return phis | ||
|
|
||
|
|
||
| def is_stable(coefs, verbose=False): | ||
| @deprecate_kwarg('verbose', 'eigenvalues') |
There was a problem hiding this comment.
Why this change? verbose seems clearer to me.
There was a problem hiding this comment.
Oh I see; verbose and eigenvalues are doing different things. In that case is deprecate_kwarg the right pattern?
There was a problem hiding this comment.
Not really, but I figured that it probably doesn't matter. It sort of does the same thing -- give the eigenvalues to the user.
|
|
||
| return phis | ||
|
|
||
|
|
||
| def is_stable(coefs, verbose=False): | ||
| @deprecate_kwarg('verbose', 'eigenvalues') | ||
| def is_stable(coefs, eigenvalues=False): |
There was a problem hiding this comment.
Several of the functions in this module are redundant with methods in the classes. is_stable is one that ideally I'd like to see in a VARParams-like class, which would be inherited by VARProcess. VARParams would basically just have coefs attribute.
There was a problem hiding this comment.
The class heirarchy in VAR/VARProcess doesn't make sense. VARPRocess needs to know about exog stuff which isn't actually in VARProcess. It could use a big refactor but this is more than I want to try in this PR. Ditto some of the functions (not in classes) that have self as the first argument so they can be used somewhere else. These should be rewritten as propper functions with lists of arguments rather than relying on a particular structure to self.
There was a problem hiding this comment.
I'm not sure exog belong in VARProcess, or at least being able to keep it out as option.
VARProcess should be the dynamic properties of the underlying VAR process, and not so much about exogenous changes in mean.
| return LagOrderResults(ics, selected_orders) | ||
|
|
||
| @property | ||
| def exog_names(self): |
There was a problem hiding this comment.
why did you turn this into a property?
There was a problem hiding this comment.
Better docstring and to match endog_names
| import warnings | ||
| warnings.warn("plotsim is deprecated and will be removed in 0.11.0. " | ||
| "Use plot_sim.", DeprecationWarning) | ||
| "Use plot_sim.", FutureWarning) |
There was a problem hiding this comment.
Isn't DeprecationWarning in these cases more appropriate?
There was a problem hiding this comment.
There is now guidance from python.org: Future for users, Deprecation for developers. So Future is almost always the right warning. Older posts seemed to indicate Future was for this is definitely going away and deprecation is for things that may go away but shouldn't be used because there is a better way now.
|
I went roughly through the main commits, comments are on commits not PR itself. |
Codecov Report
@@ Coverage Diff @@
## master #5220 +/- ##
==========================================
+ Coverage 81.59% 81.65% +0.05%
==========================================
Files 569 569
Lines 89766 89855 +89
Branches 10047 10054 +7
==========================================
+ Hits 73247 73373 +126
+ Misses 14249 14215 -34
+ Partials 2270 2267 -3
Continue to review full report at Codecov.
|
bf5a8b0 to
826d6b1
Compare
Codecov Report
@@ Coverage Diff @@
## master #5220 +/- ##
=========================================
Coverage ? 81.65%
=========================================
Files ? 569
Lines ? 89855
Branches ? 10054
=========================================
Hits ? 73373
Misses ? 14215
Partials ? 2267
Continue to review full report at Codecov.
|
826d6b1 to
93d960f
Compare
Codecov Report
@@ Coverage Diff @@
## master #5220 +/- ##
==========================================
+ Coverage 81.72% 81.81% +0.09%
==========================================
Files 569 569
Lines 89700 89796 +96
Branches 10028 10035 +7
==========================================
+ Hits 73305 73470 +165
+ Misses 14126 14064 -62
+ Partials 2269 2262 -7
Continue to review full report at Codecov.
|
|
Possibly closes #815? |
I don't think so, at least not yet. |
| """ | ||
| r""" | ||
| Test assumption of normal-distributed errors using Jarque-Bera-style | ||
| omnibus :math:`\\chi^2` test. |
There was a problem hiding this comment.
Should there still be double \?
Use cov_root consistently Rename horizon to steps
93d960f to
2f0e360
Compare
|
@bashtage why did you close this? The only potential problem I see is that there are tests for deprecated_alias usages that don't seem to be in place. |
|
There seemed to be real will to end up fix the API which seemed to be necessary to getting VAR to be coherent enough that it could be called correct. So I found other tings to do. |
MAINT: implement parts of #5220, deprecate ancient aliases
MAINT: implement parts of statsmodels#5220, deprecate ancient aliases
CLN: port parts of statsmodels#5220
CLN: port parts of statsmodels#5220
Bring in the changes in
vector_arand dependent modules only. Manually ported in fixes from #3028 rather than trying to rebase the entire PR.Lots of doc string changes.
A few external variables rename all with deprecation.
Structured commits that should each pass the test suite.
xref #5206 #3028
Plan is to get #3028 into VAR over a number of PRs to limit reviews work (which is already a lot).