Announcement

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

  • How to calculate the Inverse Mill Ratio (IMR) as the Stata does?

    Hello,
    How does Stata calculate the Inverse Mill Ratio (IMR)?

    Here I got different values from the Stata post-estimation option
    mills(lambda)
    and the direct calculation of the ratio.
    Please check the following:
    webuse womenwk,clear reg wage education age married heckman wage education age married, select(married children age education) twostep mills(lambda)
    Here we can get the values of IMR in
    lambda
    .

    Now let's calculate it directly:

    probit married children age education

    predict xx, xb

    gen pdf=normalden(xx)
    gen cdf=normal(xx)
    gen millrat=pdf/cdf
    replace millrat=pdf/(cdf-1) if married==0
    Here, we get IMR in
    millrat
    .

    Now if we look at estimated
    millrat
    and
    lambda
    together using the following command, they look different.
    edit millrat lambda

    Does anyone know what is wrong?

    Best regards,
    Hossein









  • #2
    Don't know except for this comment on the name

    https://www.stata.com/statalist/arch.../msg00433.html

    https://www.statalist.org/forums/for...atio-a-comment #2

    Comment


    • #3
      First using [QUOTE] tags rather than # [CODE] makes this hard to read.

      Also, you selection equation is wrong. It not regressing married on children, age and education but if wages are observed or not.

      Try this:
      Code:
      . webuse womenwk,clear
      
      . qui heckman wage education age married, select(married children age education) twostep mills(lambda)
      
      . gen byte selectiondep =  wage < .
      
      . qui probit select married children age education
      
      . predict xb, xb
      
      . gen mylambda = normalden(xb) / normal(xb)
      
      . l mylambda lambda in 1/5
      
           +----------------------+
           | mylambda      lambda |
           |----------------------|
        1. | 1.282124   1.2821236 |
        2. | .9313837   .93138372 |
        3. | 1.126968   1.1269684 |
        4. | .9079438   .90794379 |
        5. | .5900134   .59001337 |
           +----------------------+

      Comment


      • #4
        Thank you Scott. I really appreciate the clarification.

        Comment


        • #5
          I have a question.when I am dealing with the problem,
          I will do

          gen mylambda = normalden(xb) / normal(xb) if z=1
          replace mylambda = -normalden(xb) / normal(-xb) if z=0

          but when I use the heckman command, and save the lambda ,it seems that lambda= normalden(xb) / normal(xb) for everyone.
          And this problem will associate with the problem of predicted wages for the unemployed.

          I am looking forward for your help

          Comment

          Working...
          X