Announcement

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

  • #16
    Thank you for the note.
    My point is that the pctile column includes only percentile scores for the control group, the ultimate goal of the procedure stated in #4 is to assign percentile scores for the treated based on the distribution of the scores for the control units. Here is the output after running the command in #12, as you can see the treated units are assigned . instead of percentile scores.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int year byte(country id x) float(treat ecdf_control) double pctile_among_controls
    2000 1 1 19 0       .25               .25
    2000 1 2 22 0       .75               .75
    2000 1 6 23 1         .                 .
    2000 2 3 23 0 .16666667 .1666666716337204
    2000 2 4 90 0  .8333333 .8333333134651184
    2000 2 5 88 0        .5                .5
    2000 2 7 15 1         .                 .
    2001 1 1 60 0       .75               .75
    2001 1 2 33 0       .25               .25
    2001 1 6 75 1         .                 .
    2001 2 3 53 0 .16666667 .1666666716337204
    2001 2 4 81 0        .5                .5
    2001 2 5 92 0  .8333333 .8333333134651184
    2001 2 7 44 1         .                 .
    2002 1 1 70 0       .75               .75
    2002 1 2 44 0       .25               .25
    2002 1 6 97 1         .                 .
    2002 2 3 56 0       .25               .25
    2002 2 4 85 0       .75               .75
    2002 2 5  . 0         .                 .
    2002 2 7 45 1         .                 .
    end
    The procedure I described in #4 would result, for example, in the year 2002 country 2, for units 4 (a control unit) and 7 (a treated unit) having a percentile score of .75. This is true for the control unit based on the percentile score formula ((w+(s/2))/a), and true for the treated unit because it falls in the same place as unit 4 in the distribution of the control group because both have the same x-score. While the code in #12 produces missing value for the treated, the one in #8 recalculates the percentile scores (pctile) rather than merely identify location then assign percentile score for the treated.

    Comment


    • #17
      The reason the code in #12 assigns missing values for pctile among controls for the treated people is because, as noted previously, in that example data, the values of x for the treated all lie outside the range of the values of x among the controls. So their percentiles among the treated are ill-defined. If you run the code in #12 with data where the x values for the treated are within the range of the x-distribution for the controls, which you said is the case with your real data, they will get interpolated values.

      Comment


      • #18
        Hi Clyde.
        You are correct, I was confused because I thought you used the modified dataset where all x-scores for the treated are within the range of the control units scores.
        The command in #12 works perfectly and integrates all the necessary procedures.

        Here is the output to confirm.

        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input int year byte(country id x) float(treat pctile) double control_rank float(control_count control_ecdf ecdf_control) double pctile_among_controls
        2000 1 1 19 0       .25 0 2        0       .25                .25
        2000 1 2 22 0       .75 1 2       .5       .75                .75
        2000 1 6 21 1         . . .        .         .  .5833333333333335
        2000 2 3 23 0 .16666667 0 3        0 .16666667  .1666666716337204
        2000 2 4 90 0  .8333333 2 3 .6666667  .8333333  .8333333134651184
        2000 2 5 88 0        .5 1 3 .3333333        .5                 .5
        2000 2 7 28 1         . . .        .         . .19230769689266497
        2001 1 1 60 0       .75 1 2       .5       .75                .75
        2001 1 2 33 0       .25 0 2        0       .25                .25
        2001 1 6 55 1         . . .        .         .  .6574074074074073
        2001 2 3 53 0 .16666667 0 3        0 .16666667  .1666666716337204
        2001 2 4 81 0        .5 1 3 .3333333        .5                 .5
        2001 2 5 92 0  .8333333 2 3 .6666667  .8333333  .8333333134651184
        2001 2 7 71 1         . . .        .         .  .3809523827263287
        2002 1 1 70 0       .75 1 2       .5       .75                .75
        2002 1 2 44 0       .25 0 2        0       .25                .25
        2002 1 6 59 1         . . .        .         .  .5384615384615383
        2002 2 3 56 0       .25 0 2        0       .25                .25
        2002 2 4 85 0       .75 1 2       .5       .75                .75
        2002 2 5  . 0         . . .        .         .                  .
        2002 2 7 85 1         . . .        .         .                .75
        end

        Comment

        Working...
        X