Skip to content

ENH: add generic score, LM test #1753

Open

Description

@josef-pkt

looks like this is actually pretty easy to add this generically.

We need to be able to build the unrestricted model with access to score_obs and hessian evaluated at some params (already available in discrete), and we need to be able to estimate the restricted model.

linear restrictions can be estimated with fit_constrained and we get the restricted parameters in the unconstrained parameterization.

Cameron Trivedi Microeconometrics equ. 7.25 p. 235 for correctly specified likelihood
just the standard definition

LM = - score_obs(params_constrained) dot invHessian(params_constrained) dot score_obs(params_constrained) / nobs

equ 7.29 and 7.38 (section 7.5.1) with sandwich form if likelihood is misspecified and for general M-estimators.

edit 7.38 looks "strange" to me, the term in the outer matrix inverse should be rank deficient. Maybe the outer inverse is a typo? Wooldridge Panel 2010 2nd ed. p. 423 equ. (12.68) doesn't have the outer inverse, and looks otherwise the same.

related:
Both Cameron/Trivedi and Davidson/MacKinnon argue that the LM/score tests based on outerproduct of gradient or auxiliary regression have low power in small samples.

Activity

  1. josef-pkt commented on Jun 12, 2014

    @josef-pkt
    MemberAuthor

    getting score and score_obs mixed up
    For the outer part we only need score not score_obs

    see for example jseabold/statsmodels@master...phreg-survival-mixed#diff-2d2bf43dff2e46b0201e0ef4f155d8d4R1583

    I don't find any general score_test in Stata, it has similar missing variable tests and other LM tests as in diagnostics

    R has score (Rao) test for linear restrictions for GLM
    for example http://stat.ethz.ch/R-manual/R-devel/library/stats/html/stat.anova.html
    test - a character string, matching one of "Rao", "LRT", "Chisq", "F" or "Cp"
    and for example http://cran.r-project.org/web/packages/statmod/statmod.pdf

  2. josef-pkt commented on May 19, 2017

    @josef-pkt
    MemberAuthor

    a related PR #2096

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions