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
Stata: as far as I have seen, Stata only has arch for this case, which uses MLE as estimator .
R: I haven't figured out what's similar, maybe an option/formula to lm
bias-correction: Greene mentions a less biased or bias corrected version for log link in the var estimation
not implemented
GLSHet looks good when comparing to MLE for #7793
Large sample results, nobs = 10000, agreement is high between MLE and iterated GLS, and even 2-step FGLS.
Simulated example with correctly specified model, except that we have 2 additional explanatory variables in exog_var with coefficient = 0 in dgp. loglink for variance.
OLS with HC1 or HC3 has bse in the same neighborhood. Nonrobust bse in OLS are less than half of that.
OLS params estimate are consistent in this case.
OLS here is actually no step GLSHet, I need to check defaults fit, fit_iterated.
update
There is something fishy with GLSHet 0-step, just calling GLSHet(...).fit(). The params correspond to OLS, but the bse are far away from OLS and from iterated GLSHet.
looks like wrong scale
I don't know what the problem could be with GLSHe fit()
GLSHet does not definie fit() and it is just inherited from the superclass, the relevant fit method is in top class RegressionModel
problem is not in fit()
The problem is that I called fit_iterative() after calling fit().
GLSHet is a stateful model, calling fit_iterative updates the model, weights wendog, wexog, ....
If we keep several results instance, during repeated calls of fit_iterative, then all but the last will be messed up, at least as far as some results still need to be computed at the end.
That is,
If we want to keep the results from intermediate stages for later analysis than we need separate model instances.
mod = GLSHet(y, X, exog_var=X, link=links.Log())
resgls1 = mod.fit()
mod = GLSHet(y, X, exog_var=X, link=links.Log())
resgls2 = mod.iterative_fit(maxiter=2)
mod = GLSHet(y, X, exog_var=X, link=links.Log())
resglsi = mod.iterative_fit(maxiter=100)
GLSAR has the same stateful pattern, but the only stateful attribute is rho, the autocorrelation coefficients for whitening.
GLSAR.fit_iterative solves the yule_walker equations to update rho. whiten is conditional on initial conditions, nobs is reduced by order of AR polynomial.
In both models GLSHet and GLSAR it looks like the inherited fit estimates the parameters and results based on the current "state" but doesn't update the state.
Actually, the current design with fit and fit_iterative is not so bad.
Calling fit(...) does not update the model (state, weight remains unchanged). So, we can call it with different options, e.g. different cov_types, if we don't assume that our specified variance function is correct.
I will add a onetime UserWarning to fit_iterative, that state/model will be changed.
Activity
josef-pkt commentedon Mar 21, 2013
also inherited from_formula would also need to handle 2-equation models
needs examples and test to be used with pandas and formula
also now we have an additional
missingoptions, need to drop rows also from variance exogjosef-pkt commentedon Mar 21, 2013
The exog_var will also need the "data" treatment if we want to have the names from a pandas dataframe.
josef-pkt commentedon Oct 17, 2021
GLSHet looks good when comparing to MLE for #7793
Large sample results, nobs = 10000, agreement is high between MLE and iterated GLS, and even 2-step FGLS.
Simulated example with correctly specified model, except that we have 2 additional explanatory variables in exog_var with coefficient = 0 in dgp. loglink for variance.
OLS with HC1 or HC3 has bse in the same neighborhood. Nonrobust bse in OLS are less than half of that.
OLS params estimate are consistent in this case.
OLS here is actually no step GLSHet, I need to check defaults fit, fit_iterated.
update
There is something fishy with GLSHet 0-step, just calling GLSHet(...).fit(). The params correspond to OLS, but the bse are far away from OLS and from iterated GLSHet.
looks like wrong scale
update2 wrong state of model instance when evaluating scale and bse.
see next comment
So GLSHet.fit() is the same as OLS and WLS without weights, if fit() has been called, but no state changing
fit_iterative<end update>josef-pkt commentedon Oct 19, 2021
I don't know what the problem could be with GLSHe fit()
GLSHet does not definie fit() and it is just inherited from the superclass, the relevant
fitmethod is in top classRegressionModelproblem is not in fit()
The problem is that I called fit_iterative() after calling fit().
GLSHet is a stateful model, calling fit_iterative updates the model, weights wendog, wexog, ....
If we keep several results instance, during repeated calls of fit_iterative, then all but the last will be messed up, at least as far as some results still need to be computed at the end.
That is,
If we want to keep the results from intermediate stages for later analysis than we need separate model instances.
and not the following
josef-pkt commentedon Oct 19, 2021
GLSAR has the same stateful pattern, but the only stateful attribute is rho, the autocorrelation coefficients for whitening.
GLSAR.fit_iterative solves the yule_walker equations to update rho.
whitenis conditional on initial conditions, nobs is reduced byorderof AR polynomial.In both models GLSHet and GLSAR it looks like the inherited
fitestimates the parameters and results based on the current "state" but doesn't update the state.josef-pkt commentedon Oct 19, 2021
Actually, the current design with fit and fit_iterative is not so bad.
Calling
fit(...)does not update the model (state, weight remains unchanged). So, we can call it with different options, e.g. different cov_types, if we don't assume that our specified variance function is correct.I will add a onetime UserWarning to fit_iterative, that state/model will be changed.