Announcement

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

  • Ramsey RESET test for Heckman and Two-Part model

    Dear all,

    I am struggling to find the right code for RESET test in Stata after running Heckman and Two-Part model.

    Could you check the below code and confirm if I am correctly generating the fitted values and squaring them?

    Code:
    *RESET Test for Heckman Model
    heckman DV IV, select(dy = IV) twostep
    predict double fito, xb
    predict double xg, xbsel
    gen double fith=exp(fito+0.5*e(sigma)^2+log(normal(xg+ e(rho)*e(sigma))))
    * Square the fitted values
    gen fith2=fith^2
    * Estimate the model with the additional regressor
    heckman DV IV fith2, select(dy = IV fith2) twostep
    * Test the significance of the additional regressor (this is equivalent to a t-test on fit2)
    test fith2=0

    Code:
    *Performing Two Part Model
    probit dy IV, nolog
    regress DV IV if dy==1
    
    *RESET Test for Two Part Model
    probit dy IV, nolog
    predict fit, xb
    gen fit2=fit^2
    probit dy IV fit2, nolog
    test fit2=0
    *DV represents dependent and IV represents independent variable and dy represents DV>0

    Best regards,
    Imran Khan

  • #2
    Imran:
    as far as I know Ramsey' s test includes predicted values of the regressand up the fourth polynomial degree (see https://www.stata.com/bookstore/heal...s-using-stata/ pag 59).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,

      Many thanks for your reply.

      I am wondering how to generate the predicted values of the regressand up the fourth polynomial degree in Stata?

      Best regards,
      Imran Khan

      Comment


      • #4
        Imran:
        following your previous code:
        Code:
        gen fit3=fit^3
        gen fit4=fit^4
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Dear Carlo,

          Many thanks for helping me with the code. I have generated the predicted values of the regressand up the fourth polynomial degree as per your code and got the RESET test statistics too.

          Could you kindly look at the below codes and confirm I have done it the right way? I am a bit confused on the way I have added up the fitted values for the -test- command.

          Code:
          *RESET Test for Heckman Model
          heckman DV IV, select (dy=IV) twostep
          predict double fito, xb
          predict double xg, xbsel 
          gen double fith=exp(fito+0.5*e(sigma)^2+log(normal(xg+ e(rho)*e(sigma))))
          gen fit2=fith^2
          gen fit3=fith^3
          gen fit4=fith^4
          
          heckman DV IV fit2 fit3 fit4, select(dy = IV fit2 fit3 fit4) twostep
          
          test fit2+fit3+fit4=0
          Code:
          *Performing Two Part Model
          probit dy IV, nolog
          predict fit, xb
          gen fit2=fit^2
          gen fit3=fith^3
          gen fit4=fith^4
          
          probit dy IV fit2 fit3 fit4, nolog
          
          test fit2+fit3+fit4=0
          Looking forward to your guidance.

          Best regards,
          Imran Khan

          Comment


          • #6
            Imran:
            not quite.
            The last line of your code should be:
            Code:
            test fit2 fit3 fit4
            that is, you should -test- whether they are jointly statistically significant (H1) or not (H0).
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Many thanks Carlo.

              This code generated the following output stating constraint 4 and 5 are dropped. Will it affect the test statistics?


              Code:
               ( 1)  [logAvUSAid]fit2 = 0
               ( 2)  [logAvUSAid]fi3 = 0
               ( 3)  [dy]fit3 = 0
               ( 4)  [logAvUSAid]fit4 = 0
               ( 5)  [dy]fit4 = 0
                     Constraint 4 dropped
                     Constraint 5 dropped
              
                       chi2(  3) =   11.47
                       Prob > chi2 =    0.0094
              Moreover, I couldn’t understand the idea that when we are performing RESET test after -ppml- or -nbreg-, why we stop at fit2 instead of generating the predicted values of the regressand up the fourth polynomial degree? (see http://personal.lse.ac.uk/tenreyro/lgw.html
              and http://personal.lse.ac.uk/tenreyro/reset.do)


              Best regards,
              Imran Khan

              Comment


              • #8
                Imran:
                from your code output it seems that you have added to -test- some more predictors (I would say unuseful for RESET) in addition to fit2, fit3 and fit4.
                The link you provided takes me to the -log gravity- page; as Joao Santos Silva has a distinguished track of publications in this area, I do hope he will chime in.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Dear Imran Khan,

                  The RESET test has many different flavours but the one based on the inclusion of powers of the fitted linear index can be interpreted as a test of a given model against a polynomial approximation to an unknown functional form (other versions of the test are based on adding powers and cross products of the regressors).

                  How many powers to include is a matter of judgement: the more powers you introduce the larger the test statistic (or the larger the non-centrality parameter) and the larger the critical value. So, whether or not we gain by including more powers depends on the particular context we are using the test in. In binary models, there are good reasons to use squares and cubes, in other cases I often just use the squares because additional powers are often highly collinear with the squares and so they tend to reduce the power of the test.

                  In your case, I would perform the tests as:

                  Code:
                  *RESET Test for Heckman Model
                  heckman DV IV, select(dy = IV) twostep
                  predict double fito, xb
                  predict double xg, xbsel
                  
                  * Square the fitted values for linear part
                  gen fito2=fito^2
                  
                  *Powers for the binary part
                  gen xg2=xg^2
                  gen xg3=xg^3
                  
                  * Estimate the model with the additional regressor
                  heckman DV IV fito2, select(dy = IV xg2 xg3) twostep
                  
                  * Test the significance of the additional regressors
                  test fito2 xg2 xg3
                  
                  *RESET Test for Two Part Model
                  probit dy IV, nolog
                  predict fit, xb
                  gen fit2=fit^2
                  gen fit3=fit^3
                  probit dy IV fit2 fit3, nolog
                  test fit2 fit3
                  
                  regress DV IV if dy==1, robust
                  predict fitl, xb
                  gen fitl2=fitl^2
                  
                  regress DV IV fitl2 if dy==1, robust
                  test fitl2
                  Best wishes,

                  Joao
                  PS: Carlo Lazzaro, you are too kind ;-)

                  Comment


                  • #10
                    Dear Carlo and Joao,

                    Many thanks for your guidance, it helped me a lot in learning about the RESET test and the codes proved very useful.

                    Best regards,
                    Imran Khan.

                    Comment

                    Working...
                    X