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
{{ message }}
Repository navigation
ENH diagnostic/specification Vuong test for non-nested hypothesis #3897
(I don't find a specific issue, nor experimental code in the sandbox. I thought there should be.)
for non-nested hypothesis the Vuong test is actually trivial ztest_paired(model1.loglikeobs(res1.params), model2.loglikeobs(res2.params), alternative=...)
or ztest(model1.loglikeobs(res1.params) - model2.loglikeobs(res2.params), alternative=...)
We need loglikeobs to compute the variance of the difference across observations, otherwise it is jut the log-likelihoodratio.
It gets more complicated if the models are overlapping, or parameters are on the boundary of the parameter space.
application to Poisson versus ZeroInflatedPoisson, available in Stata zip and zinb, and in R pscl
(not clean theoretically, because they are nested in general, or unbound parameter space with Logit/Probit, see also #1357)
Cameron Trivedi count data 2nd edt. p. 198 secteion 5.4.2
Desmarais, B. A., and J. J. Harden. 2013. “Testing for Zero Inflation in Count Models: Bias Correction for the Vuong Test.” Stata Journal 13 (4): 810–35.
Wilson, Paul. 2015. “The Misuse of the Vuong Test for Non-Nested Models to Test for Zero-Inflation.” Economics Letters 127 (February): 51–53. doi:10.1016/j.econlet.2014.12.029.
One problem for zi models is that using Logit or Probit inflation model can have zero inflation only if linpred goes to inf (or -inf, depending on the definition of params). The edge case causes numerical and convergence problems. With clipping, the prob inflation is bound below > 0. So strictly speaking they are not nested, but the estimate in ZIModel will go to whatever lower bound we impose.)
We could have underinflation, but that is not implemented in the current ZI models. However, we will also get hurdle models which allow for more or fewer zeros than the main model, but it guess the model will be nested also in the implementation to the simple main model, Poisson, NegBin, ...
my draft version for compare_lr_test_nonnested and example comparing count models is in notebooks/notebook_old/try_vuong.ipynb
The version in the notebook is just
import statsmodels.stats.weightstats as smws
def compare_lr_test_nonnested(results, other, alternative='larger'):
"""Vuong (likelihood ratio) test for non-nested models
This assumes that the models are not nested.
"""
llo1 = results.model.loglikeobs(results.params)
llo2 = other.model.loglikeobs(other.params)
return smws.ztest(llo1 - llo2, alternative=alternative)
there are aic and bic corrected versions of this
(I don't remember seeing those corrections)
I guess we can just specify the correction as nonzero null value in the z- or t-test
Activity
josef-pkt commentedon Aug 31, 2017
Greene has an old working paper available at SSRN but equations don't render correctly (I didn't read it.)
Greene, William H., Accounting for Excess Zeros and Sample Selection in Poisson and Negative Binomial Regression Models (March 1994). NYU Working Paper No. EC-94-10. Available at SSRN: https://ssrn.com/abstract=1293115
josef-pkt commentedon Dec 3, 2020
searching for "vuong" in docs and code comes up empty still
josef-pkt commentedon Nov 22, 2022
my draft version for compare_lr_test_nonnested and example comparing count models is in notebooks/notebook_old/try_vuong.ipynb
The version in the notebook is just
josef-pkt commentedon Mar 14, 2023
there are aic and bic corrected versions of this
(I don't remember seeing those corrections)
I guess we can just specify the correction as nonzero null
valuein the z- or t-testhttps://stackoverflow.com/questions/75727494/how-can-i-code-vuongs-statistical-test-in-python
https://search.r-project.org/CRAN/refmans/pscl/html/vuong.html
josef-pkt commentedon Nov 7, 2025
bump
I did not realize we don't have it yet. I was searching docs and code for vuong.