Announcement

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

  • RIF decomposition with categorical variables

    Hello everyone,

    I'm trying to analyse the gender pay gap by using RIF decomposition. The attached pictures are the sample results I wanna get.
    Click image for larger version

Name:	decomposition1.png
Views:	1
Size:	98.6 KB
ID:	1541826


    Click image for larger version

Name:	decomposition.png
Views:	1
Size:	134.1 KB
ID:	1541827

    But I'm confused how to deal with the categorical variables. The variables I used include highest education background, employment type, industry type, occupation type, region and experience. For the first picture, I've checked oaxaca_rif, can I use "oaxaca_rif lnwage educ exper tenure, by(female) wgt(1) rif(mean) rwlogit(educ exper tenure)" by simply adding the categorical variable names in the commend (e.g. "oaxaca_rif lnwage educ exper tenure highestedubg emplytype, by(female) wgt(1) rif(mean) rwlogit(educ exper tenure)") ? Also how can I get the results like the second picture?

    Regards
    Yuanji JIANG

  • #2
    Hi Yuanji
    Let me try answering your questions one by one.
    1. How to deal with categorical variables? Just add dummies for each one. Oaxaca_rif does not allow for factor notation, so you need to create them before adding them to the model.
    this follows the same rule as standard OLS. you can only add h-1 dummies if your variable has h categories.
    2. for the second part. you cant obtain those results in a single output, I'm afraid.
    The closet you will get will be doing something like

    Code:
    use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta
    oaxaca_rif lnwage age educ (exper_tenure:exper tenure), by(female) wgt(1) rif(q(25)) rwlogit(age educ)
    esttab m1, keep(Pure_Unexplained: Pure_explained:) unstack
    Also, I recently found a bug on the last update of the program, so please replace the file oaxaca_rif with the one I'm attaching below.
    Fernando
    Attached Files

    Comment


    • #3
      Hi Fernando

      Thanks for your help! Really appreciate it!

      Comment


      • #4
        Hi FernandoRios ,

        Sorry for bothering you again. When I'm doing the decomposition, the result shows :

        oaxaca_rif lny edu* emplytp* industrytp* occtp* regiontp* experience exper2
        > 2 , by( gender ) wgt(1) rif(mean) rwlogit(edu* emplytp* industrytp* occtp*
        > regiontp* experience exper22)
        Estimating Reweighted RIF-OAXACA using RIF:mean
        dropped coefficients or zero variances encountered
        specify -noisily- to view model estimation output
        specify -relax- to ingnore
        r(499);

        Can I ask where is the problem, can I just simply add relax to the code?

        And I'm also confused with wgt(). In my variable, gender=1 indicates male and gender=2 indicates female. If the counterfactural group is the women with characteristics that look like men, is it correct to use wgt(0)?

        Thanks in advance for your time!

        Regards
        Yuanji JIANG

        Comment


        • #5
          Hi Yuanji
          From a mechanical point of view, adding relax will "fix" this problem. However, keep in mind that its better if you understand why this is happening. It may be that there are some industries or occupations where there are only men or only women. I would say that it doesnt make sense to make decompositions onwhen tht happens.
          Regarding the option wgt
          using wgt(1) should give you a heading like this:
          Code:
          Group 1: female = 0                              N of obs 1      = 751
          Group c: X1~>rw~>X2 or x2*b1                     N of obs C      = 751
          Group 2: female = 1                              N of obs 2      = 683
          This means that the counterfactual is formed by women using betas of men,
          or that is based on data of men (X1 or female==0) that have been reweighted so that X1 ~>X2 (x2 now looks like X2).

          Hope this helps
          Fernando

          Comment


          • #6
            Hi FernandoRios

            Thanks for your reply, that helps a lot.
            I checked my data, there is no category where there are only men or women. In that case, is adding relax makes sense? If not, is there any way I can fix this problem?
            Also, can I ask if I wanna decompose the gap into specific variables (as is shown in my first post picture 2), is this the same result I get in pure explained and pure unexplained after using oaxaca_rif, the same command used in the first decomposition? If so, how can I choose the baseline group? I attached my result here as an example. Do you think this result make sense?
            Estimating Reweighted RIF-OAXACA using RIF:mean
            Model : Blinder-Oaxaca RIF-decomposition
            Type : Reweighted
            RIF : mean
            Scale : 1
            Group 1: gender = 1 N of obs 1 = 5143
            Group c: X1~>rw~>X2 or x2*b1 N of obs C = 5143
            Group 2: gender = 2 N of obs 2 = 3946
            -----------------------------------------------------------------------------
            > -
            lny | Coef. Std. Err. z P>|z| [95% Conf. Interval
            > ]
            -------------+---------------------------------------------------------------
            > -
            Overall |
            Group_1 | 10.44096 .0104884 995.48 0.000 10.4204 10.4615
            > 2
            Group_c | 10.41195 .0115693 899.97 0.000 10.38928 10.4346
            > 3
            Group_2 | 10.15703 .012311 825.03 0.000 10.1329 10.1811
            > 5
            Tdifference | .2839353 .0161731 17.56 0.000 .2522367 .315633
            > 9
            ToT_Explai~d | .0290065 .0069314 4.18 0.000 .0154212 .042591
            > 7
            ToT_Unexpl~d | .2549289 .0180719 14.11 0.000 .2195086 .290349
            > 2
            -------------+---------------------------------------------------------------
            > -
            Explained |
            Total | .0290065 .0069314 4.18 0.000 .0154212 .042591
            > 7
            Pure_expla~d | .0242651 .0075264 3.22 0.001 .0095137 .039016
            > 6
            Specif_err | .0047413 .0035494 1.34 0.182 -.0022154 .01169
            > 8
            -------------+---------------------------------------------------------------
            > -
            Pure_expla~d |
            educationy~s | -.0031371 .0013456 -2.33 0.020 -.0057744 -.000499
            > 8
            edu1 | 0 (omitted)
            edu2 | .0002767 .0004007 0.69 0.490 -.0005086 .001062
            > 1
            edu3 | -.0028857 .00118 -2.45 0.014 -.0051985 -.000572
            > 9
            edu4 | .001757 .0005677 3.10 0.002 .0006444 .002869
            > 6
            emplytp1 | -.0134833 .0042107 -3.20 0.001 -.0217361 -.005230
            > 6
            emplytp2 | 0 (omitted)
            emplytp3 | -.007791 .0023466 -3.32 0.001 -.0123903 -.003191
            > 8
            emplytp4 | .0007928 .0006358 1.25 0.212 -.0004534 .00203
            > 9
            emplytp5 | .0131088 .0032229 4.07 0.000 .006792 .019425
            > 7
            emplytp6 | .0089647 .0021752 4.12 0.000 .0047015 .013227
            > 9
            emplytp7 | .007516 .0019703 3.81 0.000 .0036542 .011377
            > 8
            industrytp1 | -.0018932 .0023792 -0.80 0.426 -.0065564 .002769
            > 9
            industrytp2 | .0042925 .0070789 0.61 0.544 -.009582 .01816
            > 7
            industrytp3 | .0022749 .0026982 0.84 0.399 -.0030134 .007563
            > 2
            industrytp4 | .0063639 .0050445 1.26 0.207 -.0035232 .01625
            > 1
            industrytp5 | -.0018498 .011431 -0.16 0.871 -.0242541 .020554
            > 5
            industrytp6 | 0 (omitted)
            industrytp7 | -.0013451 .0031175 -0.43 0.666 -.0074552 .00476
            > 5
            industrytp8 | -.0024342 .0022876 -1.06 0.287 -.0069179 .002049
            > 4
            occtp1 | .0065844 .0014297 4.61 0.000 .0037822 .009386
            > 5
            occtp2 | -.0046573 .0013551 -3.44 0.001 -.0073132 -.002001
            > 5
            occtp3 | .0100636 .0060691 1.66 0.097 -.0018316 .021958
            > 7
            occtp4 | -.0001086 .0002171 -0.50 0.617 -.0005341 .000316
            > 9
            occtp5 | -.0046492 .0066125 -0.70 0.482 -.0176095 .00831
            > 1
            occtp6 | 0 (omitted)
            regiontp1 | -.0024894 .0011367 -2.19 0.029 -.0047172 -.000261
            > 5
            regiontp2 | .0007518 .0007454 1.01 0.313 -.0007092 .002212
            > 7
            regiontp3 | 0 (omitted)
            experience | .1562832 .0123587 12.65 0.000 .1320605 .180505
            > 8
            exper22 | -.148041 .0128551 -11.52 0.000 -.1732365 -.122845
            > 5
            -------------+---------------------------------------------------------------
            > -
            Specif_err |
            educationy~s | -.1113091 .0556119 -2.00 0.045 -.2203064 -.002311
            > 7
            edu1 | .1737778 .0318136 5.46 0.000 .1114244 .236131
            > 3
            edu2 | .1609211 .0300588 5.35 0.000 .1020069 .219835
            > 2
            edu3 | .2070096 .0387031 5.35 0.000 .1311529 .282866
            > 4
            edu4 | .0108166 .0023588 4.59 0.000 .0061934 .015439
            > 7
            emplytp1 | -.0386988 .0105122 -3.68 0.000 -.0593022 -.018095
            > 3
            emplytp2 | -.0099113 .0023205 -4.27 0.000 -.0144593 -.005363
            > 3
            emplytp3 | -.0143068 .0042984 -3.33 0.001 -.0227315 -.005882
            > 1
            emplytp4 | -.0146745 .004022 -3.65 0.000 -.0225574 -.006791
            > 5
            emplytp5 | -.1525498 .0365779 -4.17 0.000 -.2242412 -.080858
            > 3
            emplytp6 | -.0509529 .015155 -3.36 0.001 -.0806562 -.021249
            > 6
            emplytp7 | -.0232601 .0075657 -3.07 0.002 -.0380887 -.008431
            > 5
            industrytp1 | -.0005715 .0052591 -0.11 0.913 -.0108792 .009736
            > 2
            industrytp2 | -.0018196 .0025146 -0.72 0.469 -.0067481 .003108
            > 8
            industrytp3 | -.0054602 .0097888 -0.56 0.577 -.0246459 .013725
            > 5
            industrytp4 | .0002287 .0008128 0.28 0.778 -.0013644 .001821
            > 8
            industrytp5 | .0044095 .0095051 0.46 0.643 -.0142202 .023039
            > 2
            industrytp6 | 0 (omitted)
            industrytp7 | .0014194 .0035929 0.40 0.693 -.0056226 .008461
            > 4
            industrytp8 | -.0029853 .0073389 -0.41 0.684 -.0173693 .011398
            > 7
            occtp1 | .013464 .0028505 4.72 0.000 .0078772 .019050
            > 8
            occtp2 | .0621257 .0125941 4.93 0.000 .0374418 .086809
            > 7
            occtp3 | .0430888 .009307 4.63 0.000 .0248475 .061330
            > 1
            occtp4 | .0605604 .0118432 5.11 0.000 .0373481 .083772
            > 7
            occtp5 | .1156427 .0233825 4.95 0.000 .0698139 .161471
            > 6
            occtp6 | .0116185 .0026945 4.31 0.000 .0063374 .016899
            > 5
            regiontp1 | .0022645 .01246 0.18 0.856 -.0221568 .026685
            > 7
            regiontp2 | .009549 .0093512 1.02 0.307 -.008779 .027876
            > 9
            regiontp3 | .0058218 .0064126 0.91 0.364 -.0067467 .018390
            > 3
            experience | -.0521213 .0426256 -1.22 0.221 -.135666 .031423
            > 3
            exper22 | .0100941 .0254123 0.40 0.691 -.0397132 .059901
            > 3
            _cons | -.4094497 .1514979 -2.70 0.007 -.70638 -.112519
            > 3
            -------------+---------------------------------------------------------------
            > -
            Unexplained |
            Total | .2549289 .0180719 14.11 0.000 .2195086 .290349
            > 2
            Reweight_err | -.0045237 .0082076 -0.55 0.582 -.0206103 .01156
            > 3
            Pure_Unexp~d | .2594525 .016091 16.12 0.000 .2279147 .290990
            > 3
            -------------+---------------------------------------------------------------
            > -
            Pure_Unexp~d |
            educationy~s | .2088383 .138608 1.51 0.132 -.0628285 .48050
            > 5
            edu1 | -.1708158 .0317698 -5.38 0.000 -.2330834 -.108548
            > 3
            edu2 | -.1809848 .0292966 -6.18 0.000 -.238405 -.123564
            > 6
            edu3 | -.2493106 .0374257 -6.66 0.000 -.3226635 -.175957
            > 7
            edu4 | -.0140258 .0027818 -5.04 0.000 -.019478 -.008573
            > 7
            emplytp1 | .0039138 .012204 0.32 0.748 -.0200056 .027833
            > 1
            emplytp2 | .00432 .0036467 1.18 0.236 -.0028273 .011467
            > 3
            emplytp3 | 0 (omitted)
            emplytp4 | .0036873 .0051278 0.72 0.472 -.0063629 .013737
            > 5
            emplytp5 | .0201456 .0407183 0.49 0.621 -.0596608 .09995
            > 2
            emplytp6 | -.0165613 .0146967 -1.13 0.260 -.0453663 .012243
            > 7
            emplytp7 | .0000173 .0085259 0.00 0.998 -.0166932 .016727
            > 7
            industrytp1 | .0121262 .0190663 0.64 0.525 -.025243 .049495
            > 5
            industrytp2 | .011996 .009479 1.27 0.206 -.0065825 .030574
            > 4
            industrytp3 | .0618417 .0377071 1.64 0.101 -.0120629 .135746
            > 4
            industrytp4 | .0017809 .0035058 0.51 0.611 -.0050904 .008652
            > 2
            industrytp5 | .0482305 .0346834 1.39 0.164 -.0197476 .116208
            > 7
            industrytp6 | 0 (omitted)
            industrytp7 | .012743 .0137588 0.93 0.354 -.0142238 .039709
            > 8
            industrytp8 | .0468663 .0278009 1.69 0.092 -.0076226 .101355
            > 1
            occtp1 | -.0042796 .0039301 -1.09 0.276 -.0119825 .003423
            > 4
            occtp2 | -.0393286 .016799 -2.34 0.019 -.072254 -.006403
            > 2
            occtp3 | -.0181441 .0124597 -1.46 0.145 -.0425646 .006276
            > 4
            occtp4 | -.0451201 .0144825 -3.12 0.002 -.0735053 -.016734
            > 9
            occtp5 | -.0599725 .0288689 -2.08 0.038 -.1165544 -.003390
            > 5
            occtp6 | -.0116132 .0027619 -4.20 0.000 -.0170265 -.006199
            > 9
            regiontp1 | .0035581 .0159989 0.22 0.824 -.027799 .034915
            > 3
            regiontp2 | 0 (omitted)
            regiontp3 | -.0193402 .010139 -1.91 0.056 -.0392124 .000531
            > 9
            experience | .299672 .1196937 2.50 0.012 .0650766 .534267
            > 5
            exper22 | -.0770965 .069974 -1.10 0.271 -.214243 .060049
            > 9
            _cons | .4263086 .2603282 1.64 0.102 -.0839252 .936542
            > 4
            -------------+---------------------------------------------------------------
            > -
            Reweight_err |
            educationy~s | -.0007808 .0037274 -0.21 0.834 -.0080864 .006524
            > 9
            edu1 | -.002962 .0060892 -0.49 0.627 -.0148967 .008972
            > 7
            edu2 | .0016917 .0054628 0.31 0.757 -.0090151 .012398
            > 5
            edu3 | .0006475 .0039166 0.17 0.869 -.007029 .008323
            > 9
            edu4 | 0 (omitted)
            emplytp1 | -.0001719 .0005545 -0.31 0.757 -.0012587 .000914
            > 9
            emplytp2 | -7.82e-06 .0012946 -0.01 0.995 -.0025451 .002529
            > 5
            emplytp3 | 0 (omitted)
            emplytp4 | .0000412 .0002189 0.19 0.851 -.0003878 .000470
            > 2
            emplytp5 | .0001167 .0004191 0.28 0.781 -.0007047 .00093
            > 8
            emplytp6 | .0002449 .0005807 0.42 0.673 -.0008932 .001383
            > 1
            emplytp7 | -.0009811 .0018391 -0.53 0.594 -.0045857 .002623
            > 5
            industrytp1 | -.0003389 .0006558 -0.52 0.605 -.0016243 .000946
            > 5
            industrytp2 | .0001129 .0004294 0.26 0.793 -.0007288 .000954
            > 5
            industrytp3 | .0004477 .0008378 0.53 0.593 -.0011943 .002089
            > 7
            industrytp4 | -3.04e-06 .000306 -0.01 0.992 -.0006027 .000596
            > 7
            industrytp5 | -8.34e-06 .0003394 -0.02 0.980 -.0006735 .000656
            > 8
            industrytp6 | 0 (omitted)
            industrytp7 | -.0000474 .0002426 -0.20 0.845 -.0005229 .000428
            > 2
            industrytp8 | .0000908 .0007842 0.12 0.908 -.0014462 .001627
            > 8
            occtp1 | 0 (omitted)
            occtp2 | .0007198 .0009357 0.77 0.442 -.0011142 .002553
            > 8
            occtp3 | -.0000349 .001458 -0.02 0.981 -.0028926 .002822
            > 8
            occtp4 | -.0014881 .0022907 -0.65 0.516 -.0059777 .003001
            > 5
            occtp5 | -.0005086 .0031077 -0.16 0.870 -.0065996 .005582
            > 5
            occtp6 | -5.23e-06 .0011362 -0.00 0.996 -.0022322 .002221
            > 7
            regiontp1 | .0010758 .0027431 0.39 0.695 -.0043005 .006452
            > 2
            regiontp2 | 0 (omitted)
            regiontp3 | -.0000452 .0002515 -0.18 0.858 -.0005381 .000447
            > 8
            experience | -.0094636 .0134498 -0.70 0.482 -.0358248 .016897
            > 5
            exper22 | .0071342 .0104363 0.68 0.494 -.0133207 .02758
            > 9
            -----------------------------------------------------------------------------
            > -
            .
            Thanks again for your generous help!

            Regards
            Yuanji JIANG

            Comment


            • #7
              I would suggest a couple of things.
              1. You have too many industries, occupations and employment types, groups. If you do simple tabulations of this against female, you will see which groups are too small. I would follow the literature and try to group them accordingly.
              2. the results from figure 2 in post 1 is what i name as pure explained and pure unexplained (structure) effects. What that figure calls residuals, is what i name as reweighting and specification errors.
              3. the Baseline group corresponds to whichever category you omit from your model specification.
              HTH

              Comment


              • #8
                Hi FernandoRios

                Thanks so much for your suggestion.
                For the figure 2, I'm still confused about "Constant" in the composition effect, cause there is no cons in pure explained.

                Bests
                Yuanji JIANG

                Comment


                • #9
                  There shouldn’t be one
                  perhaps it was a typo from the authors side

                  Comment


                  • #10
                    Hi FernandoRios

                    Thanks so much for your help! I really appreciate it!

                    Regards
                    Yuanji JIANG

                    Comment

                    Working...
                    X