Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • residuals from probit model?

    Dear All, Is the following code approproate for obatining residuals fom probit regressions?
    Code:
    sysuse auto, clear
    probit foreign price mpg weight
    predict phat
    gen resid=foreign-phat
    Thanks.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    Sure, that will give you ordinary residuals in the context of a generalized linear model. But note that these residuals are problematic in the case of nonlinear models. See the discussion in Cook and Tsai's 1985 article that suggests an alternative.
    Last edited by Andrew Musau; 28 Dec 2021, 03:06.

    Comment


    • #3
      Dear Andrew, Thanks for the information. I winder why Stata does provide such an option?
      Ho-Chuan (River) Huang
      Stata 17.0, MP(4)

      Comment


      • #4
        You can get the predictions directly if you estimate the model using glm with a probit link.

        Code:
        sysuse auto, clear
        probit foreign price mpg weight, nolog
        predict phat
        gen resid1=foreign-phat
        glm foreign price mpg weight, family(binomial) link(probit) nolog
        predict resid2, res
        assert round(resid1, 5)==round(resid2, 5)
        Res.:

        Code:
        . probit foreign price mpg weight, nolog
        
        Probit regression                               Number of obs     =         74
                                                        LR chi2(3)        =      55.76
                                                        Prob > chi2       =     0.0000
        Log likelihood = -17.151715                     Pseudo R2         =     0.6191
        
        ------------------------------------------------------------------------------
             foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               price |   .0005185   .0001651     3.14   0.002      .000195    .0008421
                 mpg |  -.0723615   .0556501    -1.30   0.193    -.1814337    .0367106
              weight |  -.0038232   .0010392    -3.68   0.000      -.00586   -.0017864
               _cons |   8.150001   2.962982     2.75   0.006     2.342664    13.95734
        ------------------------------------------------------------------------------
        
        . 
        . predict phat
        (option pr assumed; Pr(foreign))
        
        . 
        . gen resid1=foreign-phat
        
        . 
        . glm foreign price mpg weight, family(binomial) link(probit) nolog
        
        Generalized linear models                         Number of obs   =         74
        Optimization     : ML                             Residual df     =         70
                                                          Scale parameter =          1
        Deviance         =  34.30342965                   (1/df) Deviance =    .490049
        Pearson          =  38.73410124                   (1/df) Pearson  =   .5533443
        
        Variance function: V(u) = u*(1-u)                 [Bernoulli]
        Link function    : g(u) = invnorm(u)              [Probit]
        
                                                          AIC             =    .571668
        Log likelihood   = -17.15171482                   BIC             =  -266.9811
        
        ------------------------------------------------------------------------------
                     |                 OIM
             foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               price |   .0005185   .0001651     3.14   0.002      .000195    .0008421
                 mpg |  -.0723615   .0556501    -1.30   0.193    -.1814337    .0367106
              weight |  -.0038232   .0010392    -3.68   0.000      -.00586   -.0017864
               _cons |   8.150001   2.962982     2.75   0.006     2.342664    13.95734
        ------------------------------------------------------------------------------
        
        . 
        . predict resid2, res
        
        . 
        . assert round(resid1, 5)==round(resid2, 5)
        
        .

        Comment


        • #5
          Hi River
          Perhaps also to consider, when using probit model in a control function approach, the other option is to use generalized residuals/Score, which is how heckman-two step, or etregress works.
          Best wishes
          F

          Comment


          • #6
            Dear Andrew, Many thanks for the illustrative/helpful code.
            Ho-Chuan (River) Huang
            Stata 17.0, MP(4)

            Comment


            • #7
              Dear FernandoRios, I am not familiar with those, but will check them out. Thanks a lot.
              Ho-Chuan (River) Huang
              Stata 17.0, MP(4)

              Comment

              Working...
              X