Repository navigation
Open
Description
An issue for open issues after merging VECM, to look at or decide before a release
extensions are separate issues #3135 #3133
- ???
- check api.py and doc additions
- why does HypothesisTestResults and subclasses implement
__eq__(LGTM warning) - check behavior for not supported cases in coint test, e.g. LGTM Warning "Local variable 'jc' may be used before it is initialized." in coint_table.py
- standard pattern in plots (add
ax), VECM follows VAR in some parts which does not have the "modern" statsmodels pattern and conventions in some parts - unit tests are
yieldbased, which might require adjustments when we switch to pytest and they deprecate/remove yield support. - backwards compatibility? new methods
test_whiteness_new, deprecate replace old methods?
other LGTM warnings seem mostly irrelevant (e.g. we circular import warnings with api.py which I think don't apply.)
https://lgtm.com/projects/g/statsmodels/statsmodels/rev/pr-8201a3203c0ae4914ad5563d67ab9b2fe56ddd2c
https://coveralls.io/builds/12153518/source?filename=%2Fhome%2Ftravis%2Fbuild%2Fstatsmodels%2Fstatsmodels%2Fstatsmodels%2Ftsa%2Fvector_ar%2Fvecm.py
edit/update still open (partial check)
- summary top table missing
- missing or incomplete docstrings, e.g. what is
cov_params_default? class docstring has non-existingcov_paramsinstead - related to
cov_params_default, the corresponding bse isstderr_params. There is noparamsattribute itself. What should be used for Wald tests? i.e. separate or joint components of all parameters. There is no joint params array in the fit method, and no joint Hessian. - ...
Activity
josef-pkt commentedon Jul 2, 2017
possible bug-wrong: in the forecast plot in the VECM notebook the seasonal timing looks wrong or shifted, when I use default lag 1, instead of
k_ar_diff=lag_order.aic, # =3(updated keyword).parameters for season dummies differ by a large amount from those with k_ar=3.
with k_ar_diff=3, the results are the same as in the gist
I'm trying out (and updating) @yogabonito's notebook from the gist (inflation and interest rate)
https://gist.github.com/yogabonito/b532e20b64587c19198f1aacb5ddfca2
josef-pkt commentedon Jul 2, 2017
about season dummies, AFAICS from browsing parts of the code
In
_endog_matricesthe time series are truncated for initial conditions, e.g.y_1_T = y[:, p:]. However,first_seasonis not adjusted and consequently the first season index refers to the truncated arrays and will depend on k_ar_diff. So coefficients for seasonal dummies are not comparable across different k_ar_diff.my guess is that we need something like (first_season + p) modulo season_length.
josef-pkt commentedon Jul 2, 2017
in predict
first_future_season = (self.first_season + nobs_tot) % self.seasonswhere
nobs_tot = self.nobs + self.k_arAFAIU, this assumes first_season is the first period of the untruncated array.
josef-pkt commentedon Jul 13, 2017
cointegration test:
The display of results does not show an "obvious" test result. I.e. I don't know how to interpret the output of
select_coint_rankandcoint_johansenwithout reading again the background of the tests.coint_johansen does not have a summary. select_coint_rank is a wrapper around coint_johansen that returns a CointRankResults instance.
partial correction:
select_coint_rankhas arankattribute with the estimated cointegrating rank, the summary table stops at the first not rejected rank.edit: deterministic/trend option: replace or alias numbers by
deterministicoption used inVECM.__init__, e.g.lico(question: I have 4 series with cointegrating rank two. I'd like to know if they form two pairs of series or if there is a common cointegrating relationship across all 4.
(example housing price indices of US regions with 2 pairs of similar regions.))
josef-pkt commentedon Jul 13, 2017
(continued)
normalization of cointegrating vector depends on order of variables, If there are separate groups of series that are cointegrated within group but not cointegrated across groups, then reordering looks better to get one of each group to be normalized to 1.
(still just experimenting)
edit
I am looking at the size and significance of the coefficients in the adjustment matrix alpha to see which cointegrating vector affects the different endog.
Also beta after reordering have 1 cointegration vector that is almost (0, 1, 0, -1)
josef-pkt commentedon Jul 14, 2017
plot_forecast fails in the same way
predict without specifying alpha works
edit
steps=11 or smaller works, steps=12 or larger raises above exception,
the data is monthly data without seasonal deterministic terms
res.plot_forecast(steps=11, alpha=0.1)josef-pkt commentedon Jul 14, 2017
res.plot_forecast(steps=11, alpha=0.1, n_last_obs=2*12)does not use date index for x-labels
predictis actually theforecastmethod (misnomer compared to other tsa model) and does only out-of-sample forecasting.josef-pkt commentedon Jul 14, 2017
summary() does not contain a top table with model description and overall fit results.
josef-pkt commentedon Jul 15, 2017
cosmetic, print style: could get small improvements
(notebook don't allow copy paste over several cells)
line breaks,
__repr__, raw%sjosef-pkt commentedon Jul 15, 2017
terminology, argument names:
VECM uses
signifinstead of the usualalpha, e,g,signif=0.05alphais the matrix of adjustment coefficientsjosef-pkt commentedon Jul 15, 2017
not clear to me: Is there a way to get the corresponding VAR models (now that VAR allows exog)?
get_var_modelmethod?AFAICS: the VECMResult uses the VAR representation directly, i.e.
var_repcomputesAlag-polynomial (?) matrices.internal: The data matrices for the regression are attached to the results instance and not to the model instance. Should this change? That's not important at the current stage, given that it's internal (leading underscore attributes)
edit
test_granger_causalityandtest_inst_causalitycreate a VAR model internallyjosef-pkt commentedon Jul 15, 2017
design comment, docs?
VECM uses the row representation used by Luetkepohl (non-standard for statsmodels, but internal
in model
res_t = VECM(dta_h3, coint_rank=2, deterministic="lico", k_ar_diff=4, seasons=12).fit()josef-pkt commentedon Jul 15, 2017
can we obtain and plot the stochastic trends? 4 endog, coint_rank=2, should have two stochastic trends
(I don't remember how that goes.)
josef-pkt commentedon Jul 15, 2017
forecast longer horizon
BUG fix:
forecast_intervalin var_model.py limits the ma_rep to 10.After changing it to steps, the forecast works also for larger number of steps
i.e. this should be an existing bug in VAR and is not VECM specific
BUG: VAR, VECM forecast horizon, season dummies, see statsmodels#3775
jbrockmendel commentedon Oct 16, 2017
Not a big deal, but I'd like to register a preference against the non-standard attributes
stderr_endog_lagged, stderr_dt, tvalues_endog_lagged, tvalues_dt, pvalues_endog_lagged, pvalues_dt, stderr_alpha, stderr_gamma, tvalues_det_coef_coint, conf_int_alpha, ...Is there a reason why VECMResults a) doesn't inherit from the Results hierarchy and B) doesn't have a VECMResultsWrapper?
vecm is a huge piece of very nice work.
josef-pkt commentedon Oct 16, 2017
@jbrockmendel
IIRC you asked a similar question in another issue, where I didn't reply.
The problem is that the results hierarchy currently doesn't help in the multivariate endog case. VAR/VECM implement all the special methods that work, while MNLogit inherits things that don't work, e.g. Wald inference, t_test, confint, ....
The same might be true for the VECMResultsWrapper, but most likely this is partially following the pattern of VAR and partially not having enough time to look into it.
One problem with VECM is the large number of intermediate arrays or results, and the large number of pieces for the final results. Essentially, I gave up coming up with names or a structure for all the specific things that are needed in VECM. What might be possible is to add more leading underscores if the results are private.
At least most names are a bit more informative in VECM than in VAR. Names like
pvalues_endog_laggedshould be pretty mnenomic instead of looking at a slice of the full params and pvalues. Coming up with good names is a lot of work.I'm sure there are ways to improve this or organize this better, but I came up empty or it didn't bother me enough given the limited amount of time.
jbrockmendel commentedon Oct 16, 2017
How long do we have until the next release (i.e. this is set in semi-stone)? I'm pretty slammed in the upcoming week, but may be able to look it over carefully later this month.
josef-pkt commentedon Oct 16, 2017
Nothing is set in stone or semi-stone (my older son had surgery last week and will be at home almost the entire week).
Bug-fixing and maintenance is a never ending story and at some point we have to pull the plug and release. It will have to be fairly soon, because I start to get impatient and want to do something more fun (either penalized or treatment effects).
There will always be a next release and some things will have to wait for it.
josef-pkt commentedon Jan 3, 2019
this needs an update to list what's still open
for example I just saw that summary still doesn't have the top table which I mentioned already in a comment above
Some of the BUGy things and the worst misnamings mentioned above are already fixed, AFAIR.