Announcement

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

  • Question on RIF Decomposition Using Fernando Rios's RIF Package in Stata

    Hi everyone,

    I'm analyzing the formal/informal pay gap using the RIF decomposition from Fernando Rios's RIF package in Stata. Here’s the command I’m using:

    oaxaca_rif ln_wage experience experience_sq education_Below_primary education_Primary education_Tenth_grade education_Secondary education_Bachelor education_Masters_above female hh_size caste_group_6_Janajati caste_group_6_Adhibasi caste_group_6_Madhesi caste_group_6_Dalit caste_group_6_Others married voc_train migrated_fr_job tot_chores_hrs urban overtime_40 if year == 2018, by(formal_employment) rif(q(10)) wgt(1) rwprobit(experience experience_sq education_Below_primary education_Primary education_Tenth_grade education_Secondary education_Bachelor education_Masters_above) swap

    I'm facing a few issues and would appreciate your help:
    1. Global Options: Is it possible to use global macros for variables like education and caste_group_6? When I tried, the command seemed to ignore the global values.
    2. Multiple Quantiles: Can I calculate RIF for multiple quantiles at once, e.g., rif(q(10(10)90)) instead of just rif(q(10))?
    3. Selection Bias Adjustment: I have a variable HH_formal (number of formal employees in the household except self) that I want to use as an instrument variable. Can I adjust for selection bias using this variable?
    Thanks in advance for your help!

  • #2
    Hi Sanda
    some answers:
    1) Not sure what you mean with global macros. I don't see any on your code. If you meant to say...use a macro like $variables instead of the long list, yes its possible. Please provide more details to understand your problem otherwise.
    2) No, the command only works with one RIF at a time.
    3) The theory behind RIF does not really support correcting sample selection (heckman style), And the command does not support instruments either. If you want to do something like that, you may want to create the RIFs first, then use Oaxaca option "model"
    Best wishes
    F

    Comment


    • #3
      Respected Sir,

      Thank you for the prompt response.
      1. In the earlier one i tried with global option using the code

      global education "education_Below_primary education_Primary education_Tenth_grade education_Secondary education_Bachelor education_Masters_above"
      global caste "caste_group_6_Janajati caste_group_6_Adhibasi caste_group_6_Madhesi caste_group_6_Dalit caste_group_6_Others"
      global exp "experience experience_sq"

      oaxaca_rif $experience $education hh_size female $caste married urban voc_train migrated_fr_job tot_chores_hrs overtime_40 if year == 2018, ///
      by(formal_employment) rif(q(10)) wgt(1) rwprobit($experience $education) swap

      but the results in the figure didnt show anyof the global options variable ?

      2. Could you be kind enough to help me understand creating RIFs first and usin Oaxaca option "model" here

      Click image for larger version

Name:	Screenshot 2024-06-26 at 08.44.15.png
Views:	1
Size:	91.1 KB
ID:	1757196

      Comment


      • #4
        Respected FernandoRios,

        I was able to solve the aforementioned problem using macro variables.

        Using the code
        bootstrap, reps(100): oaxaca_rif ln_wage $exp $education $caste hh_size female ///
        married child_12 voc_train migrated_fr_job tot_chores_hrs urban overtime_40 ///
        $class_5, by(formal_employment) wgt(1) rif(q(90)) rwlogit(HH_formal dep_ratio $exp $education ) swap

        I was able to get the following results, but my unexplained components seems to be because of rwg_error. How do i explain these results?

        Model : Blinder-Oaxaca RIF-decomposition
        Type : Reweighted
        RIF : q(90)
        Scale : 1
        Group 1: formal_employment = 1 x1*b1 N of obs 1 = 3934
        Group c: X1~>rw~>X2 or x2*b1 N of obs C = 3934
        Group 2: formal_employment = 0 x2*b2 N of obs 2 = 9611

        -----------------------------------------------------------------------------------------
        | Observed Bootstrap Normal-based
        ln_wage | Coef. Std. Err. z P>|z| [95% Conf. Interval]
        ------------------------+----------------------------------------------------------------
        Overall |
        group_1 | 5.067668 .00948 534.57 0.000 5.049088 5.086248
        group_c | 4.804999 .0323876 148.36 0.000 4.741521 4.868478
        group_2 | 4.746465 .008618 550.76 0.000 4.729574 4.763356
        tdifference | .3212031 .0123806 25.94 0.000 .2969376 .3454687
        t_explained | .2626685 .0323214 8.13 0.000 .1993197 .3260173
        t_unexplained | .0585346 .0331028 1.77 0.077 -.0063456 .1234148
        ------------------------+----------------------------------------------------------------
        explained |
        total | .2626685 .0323214 8.13 0.000 .1993197 .3260173
        p_explained | .1904816 .0116029 16.42 0.000 .1677404 .2132228
        specif_err | .0721869 .0282784 2.55 0.011 .0167623 .1276115
        ------------------------+----------------------------------------------------------------
        p_explained |
        experience | -.0047758 .0050854 -0.94 0.348 -.0147429 .0051913
        experience_sq | .011546 .0050143 2.30 0.021 .0017181 .0213738
        education_Below_primary | .0035275 .003347 1.05 0.292 -.0030326 .0100876
        education_Primary | -.0121284 .0067355 -1.80 0.072 -.0253297 .0010729
        education_Tenth_grade | .0089924 .0036236 2.48 0.013 .0018901 .0160946
        education_Secondary | .034596 .0073364 4.72 0.000 .0202168 .0489752
        education_Bachelor | .0649243 .0073943 8.78 0.000 .0504316 .0794169
        education_Masters_above | .0682549 .0080218 8.51 0.000 .0525325 .0839774
        caste_group_6_Janajati | -.0002648 .0009929 -0.27 0.790 -.0022109 .0016814
        caste_group_6_Adhibasi | -.0018221 .0020026 -0.91 0.363 -.0057472 .002103
        caste_group_6_Madhesi | -.000053 .000419 -0.13 0.899 -.0008742 .0007682
        caste_group_6_Dalit | .0012466 .0021478 0.58 0.562 -.0029629 .0054562
        caste_group_6_Others | -.0005618 .0015989 -0.35 0.725 -.0036956 .002572
        hh_size | .0013207 .0014373 0.92 0.358 -.0014963 .0041377
        female | -.0008591 .0007308 -1.18 0.240 -.0022914 .0005732
        married | -.0008637 .0035311 -0.24 0.807 -.0077847 .0060572
        child_12 | -.0031829 .0025443 -1.25 0.211 -.0081696 .0018038
        voc_train | .0049811 .0021725 2.29 0.022 .000723 .0092392
        migrated_fr_job | -.0008788 .0009504 -0.92 0.355 -.0027415 .0009839
        tot_chores_hrs | -.0005168 .000892 -0.58 0.562 -.0022651 .0012315
        urban | .0007571 .0014649 0.52 0.605 -.0021141 .0036282
        overtime_40 | .0162423 .0036001 4.51 0.000 .0091862 .0232984
        ------------------------+----------------------------------------------------------------
        specif_err |
        experience | -.2525198 .1921172 -1.31 0.189 -.6290626 .1240229
        experience_sq | .1086923 .12228 0.89 0.374 -.130972 .3483566
        education_Below_primary | .0206193 .0144623 1.43 0.154 -.0077263 .0489648
        education_Primary | -.0220972 .0316848 -0.70 0.486 -.0841983 .0400038
        education_Tenth_grade | -.0287745 .0199767 -1.44 0.150 -.0679282 .0103792
        education_Secondary | -.044881 .0160603 -2.79 0.005 -.0763587 -.0134034
        education_Bachelor | -.0431565 .0116825 -3.69 0.000 -.0660538 -.0202592
        education_Masters_above | -.0205794 .005423 -3.79 0.000 -.0312082 -.0099506
        caste_group_6_Janajati | -.0080032 .02525 -0.32 0.751 -.0574923 .0414858
        caste_group_6_Adhibasi | .0017737 .0106761 0.17 0.868 -.019151 .0226984
        caste_group_6_Madhesi | .0018976 .0102879 0.18 0.854 -.0182663 .0220614
        caste_group_6_Dalit | .0104654 .0075088 1.39 0.163 -.0042516 .0251824
        caste_group_6_Others | .0060804 .0038681 1.57 0.116 -.001501 .0136618
        hh_size | -.0702909 .0840586 -0.84 0.403 -.2350428 .0944609
        female | .0065985 .0176907 0.37 0.709 -.0280745 .0412716
        married | .0145613 .0478601 0.30 0.761 -.0792427 .1083653
        child_12 | .0649284 .0329254 1.97 0.049 .0003959 .129461
        voc_train | -.0075139 .0141116 -0.53 0.594 -.0351722 .0201444
        migrated_fr_job | .024735 .0187609 1.32 0.187 -.0120356 .0615057
        tot_chores_hrs | .0345042 .0153636 2.25 0.025 .0043921 .0646164
        urban | .0220398 .0447773 0.49 0.623 -.0657221 .1098017
        overtime_40 | .1000314 .0427643 2.34 0.019 .016215 .1838479
        _cons | .1530761 .2033535 0.75 0.452 -.2454895 .5516417
        ------------------------+----------------------------------------------------------------
        unexplained |
        total | .0585346 .0331028 1.77 0.077 -.0063456 .1234148
        rwg_error | .0591314 .0176128 3.36 0.001 .024611 .0936517
        p_unexplained | -.0005967 .0278452 -0.02 0.983 -.0551722 .0539788
        ------------------------+----------------------------------------------------------------
        p_unexplained |
        experience | .1843201 .2026105 0.91 0.363 -.2127893 .5814295
        experience_sq | -.0705743 .1274907 -0.55 0.580 -.3204514 .1793028
        education_Below_primary | -.0494321 .0180199 -2.74 0.006 -.0847504 -.0141138
        education_Primary | -.0113247 .0350248 -0.32 0.746 -.0799721 .0573227
        education_Tenth_grade | .0082796 .0213674 0.39 0.698 -.0335998 .050159
        education_Secondary | .0270716 .0166596 1.62 0.104 -.0055805 .0597238
        education_Bachelor | .0223758 .0124007 1.80 0.071 -.0019291 .0466807
        education_Masters_above | .0118625 .0055761 2.13 0.033 .0009337 .0227914
        caste_group_6_Janajati | .0067591 .0274324 0.25 0.805 -.0470075 .0605256
        caste_group_6_Adhibasi | .0207149 .0141563 1.46 0.143 -.007031 .0484608
        caste_group_6_Madhesi | .0155193 .011343 1.37 0.171 -.0067126 .0377513
        caste_group_6_Dalit | -.0112718 .0114743 -0.98 0.326 -.0337611 .0112174
        caste_group_6_Others | .0021749 .0040045 0.54 0.587 -.0056738 .0100237
        hh_size | -.000825 .099804 -0.01 0.993 -.1964372 .1947873
        female | .0247833 .0161223 1.54 0.124 -.0068158 .0563825
        married | -.0720443 .0497996 -1.45 0.148 -.1696497 .0255611
        child_12 | -.0379877 .0379743 -1.00 0.317 -.1124158 .0364405
        voc_train | .0157376 .0116607 1.35 0.177 -.0071171 .0385922
        migrated_fr_job | -.0127601 .0128728 -0.99 0.322 -.0379903 .0124702
        tot_chores_hrs | -.0172621 .0150423 -1.15 0.251 -.0467445 .0122202
        urban | .0450509 .0447755 1.01 0.314 -.0427074 .1328092
        overtime_40 | -.1160712 .0553688 -2.10 0.036 -.224592 -.0075504
        _cons | .0143069 .2128732 0.07 0.946 -.4029168 .4315306
        ------------------------+----------------------------------------------------------------
        rwg_error |
        experience | -.0124304 .0089372 -1.39 0.164 -.0299471 .0050863
        experience_sq | .0076593 .0080572 0.95 0.342 -.0081326 .0234512
        education_Below_primary | .0015351 .0013197 1.16 0.245 -.0010514 .0041217
        education_Primary | .0019948 .002249 0.89 0.375 -.0024132 .0064027
        education_Tenth_grade | .0018398 .0017182 1.07 0.284 -.0015278 .0052073
        education_Secondary | .0012097 .0018796 0.64 0.520 -.0024743 .0048936
        education_Bachelor | .0044832 .0022615 1.98 0.047 .0000507 .0089156
        education_Masters_above | .0014743 .0012272 1.20 0.230 -.0009309 .0038795
        caste_group_6_Janajati | -.0005822 .0025124 -0.23 0.817 -.0055064 .004342
        caste_group_6_Adhibasi | -.0005554 .0032702 -0.17 0.865 -.0069649 .005854
        caste_group_6_Madhesi | .0000311 .0011247 0.03 0.978 -.0021732 .0022355
        caste_group_6_Dalit | .0068043 .0038806 1.75 0.080 -.0008015 .0144101
        caste_group_6_Others | .0018378 .0015812 1.16 0.245 -.0012614 .0049369
        hh_size | .0026571 .0081153 0.33 0.743 -.0132487 .0185628
        female | -.0008137 .0015791 -0.52 0.606 -.0039087 .0022814
        married | -.0001292 .0010145 -0.13 0.899 -.0021175 .0018592
        child_12 | .0047858 .0035477 1.35 0.177 -.0021675 .0117391
        voc_train | .0040873 .0035942 1.14 0.255 -.0029572 .0111318
        migrated_fr_job | -.0114658 .0059964 -1.91 0.056 -.0232185 .0002869
        tot_chores_hrs | -.0038975 .0019915 -1.96 0.050 -.0078008 5.74e-06
        urban | -.0002638 .0014127 -0.19 0.852 -.0030325 .002505
        overtime_40 | .0488701 .0117921 4.14 0.000 .0257579 .0719823

        Comment


        • #5
          You need to work on your re weighting model.

          Comment

          Working...
          X