Repository navigation
Conversation
Fix AIC and BIC so that they match LS when models are identical Remove checks on (0,0) and (0,d,0) models Fixed bug where fittedvalues where not initialized
Information criteria tests are not failing - need clarification about definition
|
Looks quite good, I didn't expect that you can get with as few changes as in this PR looking through parts of the source: For the details, I leave it to @jseabold It's his code and he wrote the unittests. |
|
I have updated the tests with a few more edge cases involving exogenous regressors. I agree that the +1 is almost certainly from a formula where:
The main issue is how to fix the test failures. It seems that |
|
In some cases we added the R or Stata files to the test directory, but not always or not even very often. the the results .py files look to be autogenerated from R or Stata. We have Stata and R scripts in tools to dump the results to py files and csv, |
…it of the penalty
|
For now I have fixed them is a bad way but subtracting 1 unit of the penalty in the test functions. It would be best to re-generate these test results (and have a script that can do the regeneration), but that sounds a non-trivial issue and also potentially risky. |
|
Gretl results available in the GUI are not always available from their scripting language IIRC, so you have to do it by point and click in the GUI. This may have changed since I wrote this, or I may just not have spent much time trying to do this. Otherwise, it was the case that you don't have enough control over formatting from the scripting language so it was just easier to copy-paste the table at greater precision from the GUI. The My recollection/guess is that the |
The DOF calculation it is now consistent with both OLS and other packages
|
Are the IC changes related to the other changes? If not, can you put them into a separate PR? I'm going to look into this. |
|
Yes, the information criteria as is match gretl already. The issue is that our |
|
Is there a justification why they count also the variance? We don't do it in the linear models. |
|
My guess was always that though it's concentrated out, it could be (and is often presented as if it is) estimated as part of the optimization problem. MLE vs. OLS. Cf. the discrete choice models. |
|
The x-12arima manual is a little more explicit. "Suppose the number of estimated parameters in the model, including the white noise variance, is n_p...then the formulas are" |
|
sounds ok to me either way. I assume in a GARCH model we would also count the variance parameters. Then the question is whether ARMA is a generalization of OLS/GLS or if it is a special case of GARCH. (maybe there is an analogy to the difference between ML and REML which I also haven't really figured out yet. Maybe there is some justification somewhere why we should have one or the other which is only really relevant in very small samples, and to have a nice consistency across models. ) And finally: the Stata documentation has quite a lot of explanations why different equivalent models/estimators don't give exactly the same results, mainly because of different small sample corrections. |
|
After reading through the testing comments, I found some information about "why" the IC take the forms that they do. In particular, the IC match X12 but not GRETL in all cases. GRETL uses:
The GRETL choices are particularly confusing since they don't generally match the GRETL documentation. X12, according to the comments, always uses the +1 IC. While I believe the +1 is due to sigma^2 parameter, I think it is silly since restricting the sigma^2 produces a model which is no longer point identified, at least for AR models estimated CSS since there is a K-1 dimension solution to this problem. I am a big beleiver is doing things based on sane principles even if it means differing form what other packages output, at least when:
|
I think it only makes sense to treat it as a parameter if it is possible to fix its (sigma^2) value and then estimate the remaining parameters. Similar to fixing an AR coefficient, and then not counting this. |
|
There is always a difference in treatment between OLS and some full maximum likelihood (for general models). The question is where is the difference. One argument why I thought about not counting the variance parameter in OLS and GLS with heterogeneity is when the Hessian is block diagonal. From this it sounds like we could justify the boundary between counting or not counting the variance parameter in whether we have the block diagonal structure and can separate the mean model from the (co)variance model. If we don't have the block diagonal structure, then the mean model cannot be consistently estimated without correctly specifying the variance function. I don't know what this means for ARMA models, but for example for GARCH models there is a difference between garch in mean without separation and the regular garch models that have separation of mean and variance function (and in ARMA-GARCH we can estimate the two parts separately). However maybe this gets "weird" if we estimate mean and variance functions jointly in MLE and would separate the IC for the two parts. However, we do separate them in a two stage model, I think. |
I've never heard about that in econometrics. However, astronomists, physicists and in some engineering fields they fix sigma. I had long discussions on the scipy mailing list and scipy issues about whether the scale/sigma should be estimated in nonlinear WLS or not. However, for least squares the estimating or fixing the scale does not affect the (mean) parameter estimates. I'm not sure it's relevant for ARMA. Does the variance parameter directly affect the coefficient estimates through the initial conditions? |
Maybe that's not so weird. In terms of consistency with misspecification it makes a difference if we estimate in two stages or in the joint estimation problem. I haven't implemented anything yet, but from what I was reading in GEE and GMM, when the information matrix has block-diagonal structure: |
|
Making the same argument in small samples, for the actual calculation: In OLS, WLS, GLS and Poisson, we can set the scale to anything and the actual coefficients and mean prediction, fittedvalues and residuals don't change. This doesn't rely on asymptotics, it's just the separability of the optimization problem. |
|
Changes Unknown when pulling 736d32a on bashtage:ARIMA-order-0-0 into * on statsmodels:master*. |
In the case of least squares/Gaussian MLE, the justification is that given the parameters of the conditional mean, the ML estimator of the variance has a closed form so that the concentrated log likelihood can be used in place of the full (joint) log likelihood. The block diagonality of the hessian only holds when either the model includes a constant or when the model is correct for the conditional mean; the concentration still holds even when the model is mis-specified.
I would think a more natural "test" is whether the scale/variance is be jointly estimated with the other parameters in the model so that it could be naturally restricted. In all of the LS models, including CSS AR, this is not possible since the solution is no longer point identified, and so I think it is reasonable to not count the variance in these models.
In GARCH models the natural analogue would be to not count the intercept in the variance equation since this parameter would be there even if all of the ARCH-terms were removed. Although someone may be interested in estimating a model with out an intercept in the variance equation (e.g. IGARCH), and so things would become more complicated.
I think this affects the convexity of the problem, although a proper prior on the regression coefficient would provide some guidance on which coefficients to prefer.
I think this is the wrong test - the important question is whether these are ML estimates (or justifiable under some other criteria, such as consistency). |
|
about concentrated log likelihood: I always thought this is just a computational trick. We can always replace a joint optimization by a nested optimization. Is there anything that concentrating out the scale adds? Even if we maximize the non-concentrated log-likelihood, then the first order conditions for the mean parameters are independent of the scale/variance estimate in the normal model, aren't they?
I don't understand this part. What do you mean by "no longer point identified"? We still get the unique solution for the mean parameters, which is still a consistent estimator in OLS, WLS, AFAIKS. It might be irrelevant for all practical purposes but the similar case that I'm interested in and where we have to come up with some convention is between Feasible GLS and MLE for linear models with estimated heteroscedasticity or autocorrelation. |
I don't think this is any reason to not use the concentrated likelihood since it is always the solution to the MLE, only a full likelihood has a additional parameter to estimate.
Suppse you want to estimate the mean using LS - which is just regression on a constant. However, you want to do this subject to a constraint that the variance is 1 (and suppose that this is larger than the MLE estimator of the variance), then there are 2 points which will produce the same variance value of 1, mu_hat + theta and mu_hat - theta where theta is that value that will make the variance satisfy the constraint. If the regression model had more explanatory variances, the set of points would be a k-1 dimensional plane (i.e. a line if 2 regressors, etc.) |
|
I think I'll roll back all of the IC changes and leave that for someone else. |
|
Changes Unknown when pulling d66ea97 on bashtage:ARIMA-order-0-0 into * on statsmodels:master*. |
(I just realized I never wrote my reply) Aren't you fixing the mse, the variance of the estimated residuals in this case, and not the estimated population variance. |
|
Any objections to my cleaning this up a bit before a merge. I just want to squash to two commits for tests and the code changes and rewrite the commit messages so that things are clear. To be clear the code, the authorship, and the notes will be the same as they are now. |
|
See #1370. |
|
Closed by baff17b. |
Does not try to implement "parameterless" models.