Announcement

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

  • Oaxaca with instrumental variable

    Dear all,

    I am trying to use an Oaxaca- Blinder decomposition to see if a variable of interest contributes to the gender wage gap.
    However, I would like to use an instrumental variable in place of my variable of interest in the decomposition.

    1) Is there a command that combines the oaxaca command with use of an IV?

    2) Alternatively, can I create the instrument variable and then put it directly instead of my original variable in the oaxaca command? If I do this, I suppose I will have to somehow change my standard errors to correct for the fact that my instrument is estimated to begin with. How might I change my standard errors?

    3) Is there a reference to a paper that has done something similar? Does anyone know if this is even econometrically sound and if yes/ no, why?

    Many thanks!

    Best regards,

    Adi

  • #2
    Hi Adi,

    Its been a few years but I am looking into something similar. Have you ever found out the answers to these questions?

    Kind regards,
    Dylan

    Comment


    • #3
      Here is a post on a similar topic ("Instrumental variable decomposition): https://www.statalist.org/forums/for...-decomposition

      Comment


      • #4
        This straps on Jann's oaxaca decomp calculations to ivreg2.

        Not ssc approved. Built with Claude Code. Use at your own risk. I've performed a crude test to check the calculations and it replicates Jann. Also ran in python and it replicates.

        Let me know if you run into a problem.

        If I can find the time, then I'll go through it and clean it up any errors and verify.

        Code:
        clear all
        
        use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta
        
        ** ivreg2 results
        ivreg2 lw s expr tenure rns smsa (iq=med kww age mrt)
        estat summarize
        
        ** straight oaxaca
        oaxaca lw s expr tenure smsa  iq , by(rns) omega detail vce(robust)
        
        ** check the calculations
        cap drop u
        g u = iq + rnormal()/200
        ivoaxaca lw s expr tenure smsa  (iq = u) , by(rns) omega detail vce(robust) ivopts(small)
        
        ** ivoaxaca
        ivoaxaca lw s expr tenure smsa  (iq = med kww age mrt), by(rns) ///
           omega detail vce(robust) ivreg2 first
        
        ** bootstrap
        bootstrap, reps(500) strata(rns) seed(123): ///
        ivoaxaca lw s expr tenure smsa  (iq = med kww age mrt), by(rns) ///
           omega detail vce(robust) ivreg2
        Attached Files
        Last edited by George Ford; 04 Sep 2026, 15:44.

        Comment


        • #5
          I'll add factor variables and e(sample) fix.

          Comment


          • #6
            factor vars and e(sample) fix.
            Attached Files

            Comment

            Working...
            X