Announcement

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

  • One-to-one matching

    Dear all,

    I am using Stata 14 and I want to match treatment firms and control firms one-to-one through the following way: First, control firms have to be in the same two-digit SIC code as with the treatment firms and they should be in the same portfolio as well which is constructed based on the three firm characteristics (i.e. var2, var3 & var4). Then, control firms are chosen based on the smallest difference in var1 as compared to the treatment firms (i.e. treatment=0 if control firm and treatment=1 if treated firm). If there is any tie among control firms (i.e. Company 1 and Company 5 can be both matched to Company 6 in the below data-set based on the smallest difference in Var1), the one who has the lowest rank in terms of the smallest difference in the aforementioned firm characteristics as compared to the treatment firm is chosen.

    Up to now, I was able to construct the first part (i.e. more than 100 portfolios are constructed). However, I could not figure out how to match control and treatment firms based on the smallest difference in Var1 for each portfolio and do the ranking in case of ties. To illustrate my data-set (i.e. only 9th portfolio is demonstrated below), part of my data-set is provided below:
    Portfolio Company Name Treatment var1 var 2 var 3 var 4
    9 Company 1 0 6 39303.29 0.283071 0.300222
    9 Company 2 0 5 53535 0.27397 0.234608
    9 Company 3 0 32 96075.69 0.252854 0.234742
    9 Company 4 1 16 95403.36 0.288711 0.253231
    9 Company 5 0 6 4948.74 0.304504 0.25742
    9 Company 6 1 7 5943.369 0.315158 0.232289
    9 Company 7 1 15 7587.342 0.292909 0.274163
    9 Company 8 0 29 54537.61 0.269264 0.304528
    9 Company 9 0 27 23657.51 0.228177 0.33258
    9 Company 10 0 39 30194.24 0.253387 0.279335

    Since I have recently started to use Stata, I am a bit lost. I will appreciate any of your response.

    Regards,

  • #2
    I do not fully understand; also, you did not use -dataex- (see the FAQ) to show your data making it too much work (for me, at least) to put into Stata; however, there are a number of user-written routines for matching and you probably want to look at some of them; use -search- to find them and download them; some of the apparently relevant programs include: vmatch, iematch, calipmatch and kmatch

    Comment


    • #3
      Well, it has nothing to do with being new to Stata. The condition "the one who has the lowest rank in terms of the smallest difference in the aforementioned firm characteristics as compared to the treatment firm is chosen" is too vague to be implemented as an algorithm in any package you might choose. You have multiple characteristics. You could have a tie situation in which one of the potential matches is very close on var2 but not var3 and var4, another is very close on var3 but not var2 or var4, and another one which is moderately close on var2 and var4 but a wild miss on var3. Which would you consider to have the lowest rank in terms of the smallest difference in those characteristics? You need a specific set of rules. There are (infinitely) many different similarity metrics that can be used, and you have to settle on one. Once you resolve this conceptual problem, putting it into code will likely be simpler than the coding you have already done so far, though, of course you are welcome to post back for help on the coding should it prove more complicated.

      Comment


      • #4
        Dear Rich & Clyde,

        Thank you for your responses. I am stuck in the very beginning of matching. I have tried some of the commands that you proposed (i.e. vmatch, iematch and kmatch). I think kmatch suits better than the other two in my setting. However, the problem is that control firms match more than one treatment firm with this command. I want one-to-one matching; that is, each treatment firm should match with one and unique control firm. Although I searched for correcting this issue, I could not find the answer that I looked for. For illustrative purposes, I demonstrate the command used for matching below:

        kmatch md treatment var1, att nn ematch(group_portfolio) generate(stub)

        where group_portfolio is constructed based on the three firm characteristics that I mentioned in the first post (i.e. var2, var3, var4) as well as two digit SIC codes.

        Do you have any suggestions how I can fix this problem? Below I am sharing my data with dataex.

        Regards,

        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input float(group_portfolio treatment) long gvkey double var1 float(var2 var3 var4)
        31 1 61811 10 1172.0183 1.0920043 .2268924
        31 0 210607 4 1324.781 .92838 .1523701
        80 0 20548 11 391.2549 1.4347194 .16476972
        80 1 14633 7 414.2353 1.3749626 .15961675
        89 1 14359 15 1288.6755 .9310839 .20543145
        89 0 29873 2 1258 .8371637 .20498085
        89 1 22668 13 1032.304 .836772 .19765966
        89 1 22974 13 830.3805 .9802133 .191556
        94 1 25956 7 280.599 2.606157 .10822867
        94 0 22255 5 542.2042 1.622007 .13752659
        105 1 11038 27 10214.843 .8931121 .21275896
        105 0 14878 18 2598.329 .7447093 .3385013
        109 0 18756 5 3863.868 1.1203008 .17840184
        109 1 8549 22 11651.113 1.1628073 .20150575
        110 0 8468 9 2632.8435 1.566464 .12083858
        110 1 8068 17 7695.705 2.291408 .12566632
        203 0 7146 12 1925.798 .6888619 .1621985
        203 1 28895 13 2365.7344 .7208692 .1659508
        210 1 3144 18 130562.26 .12378003 .2933915
        210 0 2663 17 23758.75 .27185774 .28518346
        210 0 6375 16 13758.15 .36705515 .26663366
        318 1 23252 9 819.831 .52179533 .23904587
        318 0 5690 2 980.529 .5237112 .24974
        356 1 25305 9 750.6015 4.049102 .067214675
        356 0 18375 1 1853.64 2.396366 .05042773
        358 0 100806 2 2936.688 2.0893562 .08902459
        358 1 2917 15 4132.754 2.3761375 .09010832
        360 1 10426 13 3001.177 4.313974 .05298525
        360 0 31691 1 2275 4.346682 .05366953
        384 0 1468 3 2324.442 .9185517 .1585091
        384 1 14163 4 1057.3844 .8281435 .15798832
        390 1 10580 12 4812.3174 .7335057 .14874293
        390 0 5038 5 3555.95 .9354007 .15787114
        452 0 24908 9 2062.036 .24474356 .05541047
        452 1 2226 20 2810.3826 .2257956 .05966699
        452 0 13365 1 938.432 .2171729 .02405276
        452 0 13308 9 1190.0757 .2242832 -.11128678
        459 0 9472 4 822.2805 .7581087 .14057282
        459 1 29511 5 1848.1937 .6823419 .17112045
        459 0 30191 3 511.7857 .7968159 .14707245
        459 1 9772 14 1772.6074 .6062154 .15273008
        459 0 12233 12 1684.1235 .7300646 .10540789
        459 0 7936 6 302.8725 .6674162 .1041446
        459 0 6618 2 572.5311 .5119774 .12034197
        459 0 1239 4 1206.4756 .7536547 .1520358
        459 0 25870 5 926.6 .770409 .15913603
        459 0 13406 7 486.0187 .8173574 .13291596
        459 0 3026 4 444.9645 .6921248 .13101234
        460 0 24782 9 956.45 .5942569 .1981871
        460 0 3917 2 351.8224 .58837074 .21057284
        460 0 4213 8 2438.1 .4956355 .21557437
        460 0 29751 4 997.7087 .8482044 .194349
        460 1 12895 10 929.4719 .6326162 .28657192
        460 0 13542 7 1771.8552 .6771309 .19998616
        460 1 63500 5 1397.989 .6195513 .18003154
        465 0 5180 16 56285.77 .25258607 .3886896
        465 1 7257 32 96075.69 .25285378 .23474155
        465 1 1920 13 7587.342 .29290888 .27416307
        465 1 1078 21 39303.29 .28307047 .30022165
        465 0 6078 6 4948.74 .3045044 .25741965
        465 1 8762 16 95403.36 .288711 .2532312
        465 0 61567 7 5943.369 .31515795 .2322887
        465 1 8530 31 53535 .2739703 .2346083
        465 1 9459 27 23657.514 .228177 .33258
        465 0 30938 8 30194.236 .25338665 .27933517
        465 1 2403 29 54537.61 .26926374 .30452845
        465 0 6266 23 66291.08 .3018506 .26546726
        466 0 3121 9 6818.469 .4074158 .19700377
        466 0 28272 8 26513.59 .3229099 .2446
        466 1 6730 30 40356.08 .35452405 .1810487
        466 0 14261 18 37404.42 .3641281 .22070484
        466 1 11288 25 20340.3 .3538443 .20072804
        468 1 9667 12 4811.296 .6224082 .1743938
        468 0 7536 17 22717.62 .4926133 .16754535
        468 0 8020 4 6457.391 .57922775 .15990695
        468 1 16582 16 3874.47 .6438009 .1535335
        468 1 15426 13 4138.637 .6777351 .16546044
        468 0 1945 3 13532.4 .5362486 .16095774
        468 0 2086 17 11170.04 .6800334 .15863612
        468 1 11040 29 20140.715 .5547469 .1695158
        469 0 7679 8 2421.242 .57594407 .22344926
        469 1 4087 17 53043.86 .7161432 .2140206
        469 1 9217 13 5154.21 .7630655 .21332316
        469 1 3170 14 13573.11 .5821436 .18609124
        469 0 28169 12 1930.1837 .8187319 .287262
        469 0 5589 9 4385.6797 .54404336 .22129086
        469 0 8247 11 10282.94 .6264161 .25756824
        469 0 15708 6 2333.9006 .5783451 .1873611
        470 1 63637 7 1372.5188 4.0808187 .0998036
        470 0 13467 4 11119.4 2.4568214 .10174844
        470 0 31831 2 498.8734 3.594034 .06719529
        471 0 2085 6 1939.14 1.342554 .11465775
        471 0 4371 5 2751.227 .9068333 .13053207
        471 0 15334 4 9607.207 1.229874 .15867105
        471 0 11559 4 1731.2715 1.381473 .11337017
        471 0 8902 5 1490.037 1.096099 .13314308
        471 0 3558 4 2541.25 1.0882055 .1458392
        471 1 10857 15 5168.235 1.2665833 .1616254
        471 1 1794 12 2544 2.857311 .10799284
        471 0 1209 16 6437.499 1.0131265 .149954
        end
        [/CODE]


        Comment

        Working...
        X