Repository navigation
Description
I'm not sure what the status here is, I just found an older script of mine with a function
def het_binary(results, exog_var, method='all'):
'''Lagrange Multiplier (score) test for heterogeneity in binary models
Test a homoscedastic model against a variance function for the latent
variable of the form exp(Z gamma) where the `exog_var` Z are the
explanatory variables for the heteroscedasticity.
which (unfortunately) has 4 or 5 different versions, and I don't know of any reference numbers.
(based on Greene, Wooldridge, and maybe Davidson-MacKinnon
http://www.statalist.org/forums/forum/general-stata-discussion/general/5564-heteroskedasticity-test-for-logit-and-logistic-models
http://www.stata.com/manuals13/rhetprobit.pdf
related to issues and PR on score/LM and conditional moment tests
two blog articles for R
http://www.r-bloggers.com/the-problem-with-testing-for-heteroskedasticity-in-probit-models/
https://diffuseprior.wordpress.com/2012/11/19/the-heteroskedastic-probit-model/
Shazam for LM test Davidson-MacKinnon with Shazam output (useful for unit test)
http://www.econometrics.com/intro/logit3.htm
data: http://www.econometrics.com/intro/school.htm
another blog article in favor of LM test
http://davegiles.blogspot.ca/2011/05/gripe-of-day.html
but he has things mostly in "unreadable" Eviews workfiles http://web.uvic.ca/~dgiles/downloads/binary_choice/index.html
Activity
josef-pkt commentedon Apr 20, 2016
just another idea based on double exponential model (GLM with GLM-Gamma dispersion estimation):
instead of using OLS for estimation of the LM test, use GLM-Gamma and test coefficients.
some discussion and example on GLM-Gamma for variance/dispersion function estimation is in Tweedie PR #2872
josef-pkt commentedon May 23, 2017
Stata nonlinear test has an example to test for unequal variance between male and female by testing the assumption that all coefficients for female and male are proportional to each other. (Ref ?)
josef-pkt commentedon May 23, 2017
attaching the full script file as reference, (so I don't have to look for it again)
"local_scripts\local_scripts\try_logit_lm_test.py"
2013-11-18, used with Python 2.7.1, updated to work with Python 3
result of hetbinary (no idea now what it the versions are)
josef-pkt commentedon Dec 3, 2018
related reference (just found by chance again, I don't remember)
looks good, some functions to be implemented, most likely directly generalized to all binary response models.
Yatchew, Adonis, and Zvi Griliches. 1985. “Specification Error in Probit Models.” The Review of Economics and Statistics 67 (1): 134–39. https://doi.org/10.2307/1928444.
josef-pkt commentedon Jan 2, 2020
related issue: omitted variable bias in Logit even if explanatory variables are uncorrelated
https://stats.stackexchange.com/questions/113766/omitted-variable-bias-in-logistic-regression-vs-omitted-variable-bias-in-ordina
quick read: omitted variable produces unobserved heterogeneity which also affects the mean parameter interpretation, ie. attentuation bias compared to including uncorrelated omitted variable.
This might come back to that heteroscedasticity is observationally equivalent to misspecified mean function. I didn't check the details now.
Can we provide specification tests based on this, e.g. if we have candidate explanatory variables of omitted mean variables or heteroscedasticity?
josef-pkt commentedon Oct 16, 2022
bump
orthvar = np.column_stack((res.model.exog, -xb[:,None] * z))I can derive this as a variable addition test using first order taylor series expansion of the nonlinearity.
with current status of statsmodels we can implement this using variable addition score_test in GLM and discrete,
or use a variable addition wald test
tres_wald)in above experimental code.in analogy to reset test, i.e. here we interact linpred with other explanatory variables (that might explain heteroscedasticity of latent variable) instead of using polynomial of linpred as in standard reset test.
see also #2179 (comment)