Announcement

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

  • Proposed Matching Strategy

    I hope you're doing well.

    i need to make matching

    Here’s the setup with the variables I’m using:
    1. Freeze – Indicator variable equal to 1 for the year of the freeze and the two subsequent years, and 0 for all other years.
    2. ff_12 – Industry classification (Fama-French 12).
    3. Firm_Size_w – A measure of firm size.
    Objective:

    I want to perform a matching procedure at the firm-year level. Specifically:
    • For each treatment firm-year where freeze = 1,
    • I will identify a control firm-year that satisfies all of the following:
      • Belongs to the same industry (ff_12),
      • Is of similar size based on Firm_Size_w,
    Im not sure how can i did this in Stata

    this is prensetataion of my data
    this is
    HTML Code:
     ----------------- copy up to and including the previous line ------------------
    
    Listed 100 out of 8829 observations
    Use the count() option to list more
    
    . dataex id year  freeze Firm_Size_w
    
    ----------------------- copy starting from the next line -----------------------
    [CODE]
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long id float(year freeze Firm_Size_w)
    2 2004 0  8.861633
    2 2005 0  8.817446
    2 2006 0  8.905037
    2 2007 0  8.929832
    2 2008 0  8.914223
    2 2009 0  8.937481
    2 2010 0  9.179469
    2 2011 0  9.111293
    2 2012 0  9.262553
    2 2013 0   9.27669
    2 2014 0  9.290168
    2 2015 0  8.919854
    2 2016 0  8.962135
    2 2017 0  9.039078
    2 2018 0  9.052633
    2 2019 0  9.153981
    2 2020 0  9.172327
    2 2021 0  9.278466
    2 2022 0  9.262174
    3 2004 . 10.267193
    3 2005 . 10.291976
    3 2006 .  10.28004
    3 2007 . 10.260147
    3 2008 . 10.133607
    3 2009 .    10.144
    3 2010 0 10.130145
    3 2011 0 10.079455
    3 2012 1  10.06518
    3 2013 1 10.652022
    3 2014 1 10.686727
    3 2015 . 10.787565
    3 2016 .  10.84494
    3 2017 . 10.847316
    3 2018 .  11.01172
    3 2019 . 11.002016
    3 2020 .  11.03502
    3 2021 .  11.10446
    3 2022 . 11.077764
    4 2004 .  7.697104
    4 2005 .  7.840765
    4 2006 .  7.894572
    4 2007 .  7.939361
    4 2008 .  7.994317
    4 2009 .  8.030397
    4 2010 .  8.117973
    4 2011 .  8.204058
    4 2012 . 8.4368105
    4 2013 .  8.624211
    4 2014 .   8.98248
    4 2015 .  9.003878
    4 2016 .  9.025821
    4 2017 .  9.045737
    4 2018 .  9.109487
    4 2019 .  9.327992
    4 2020 .  9.379209
    4 2021 .  9.408716
    4 2022 .  9.394201
    5 2004 .  8.993427
    5 2005 .  9.354527
    5 2006 .  9.752955
    5 2007 . 10.140415
    5 2008 . 10.585877
    5 2009 . 10.768506
    5 2010 .  11.22768
    5 2011 . 11.664538
    5 2012 . 12.078603
    5 2013 . 12.240474
    5 2014 .   12.3538
    5 2015 . 12.579287
    5 2016 . 12.681332
    5 2017 .  12.83553
    5 2018 . 12.809637
    5 2019 . 12.732327
    5 2020 . 12.688153
    5 2021 . 12.768547
    5 2022 .  12.77353
    6 2004 0         .
    6 2005 0         .
    6 2006 0         .
    6 2007 0         .
    6 2008 0         .
    6 2009 0         .
    6 2010 0  9.958672
    6 2011 0  9.886197
    6 2012 0 10.203888
    6 2013 0 10.281856
    6 2014 0  10.22365
    6 2015 0  10.87899
    6 2016 0 11.098908
    6 2017 0 11.167417
    6 2018 0 10.991241
    6 2019 0 11.397683
    6 2020 0  11.92215
    6 2021 0 11.894979
    6 2022 0 11.840825
    8 2004 0    10.267
    8 2005 0 10.279908
    8 2006 0  10.49621
    8 2007 0 10.589458
    8 2008 0 10.655356
    end
    label values id id
    label def id 2 "A", modify
    label def id 3 "AAL", modify
    label def id 4 "AAP", modify
    label def id 5 "AAPL", modify
    label def id 6 "ABBV", modify
    label def id 8 "ABT", modify
    [/CODE]
    ------------------ copy up to and including the previous line ------------------
    
    Listed 100 out of 8829 observations
    Use the count() option to list more
    
    . 

  • #2
    One option is to use kmatch and propensity score matching (PSM).


    Code:
    ssc install kmatch, replace
    kmatch ps freeze Firm_Size_w, ematch(year ff_12) comsup nn(1) wor idgenerate replace
    The created variable _ID_1 contains the ID of the matched firm. Note that this code forces a matching with exactly one partner without replacement. To have multiple matches, remove the option wor.
    Last edited by Felix Bittmann; 05 Apr 2025, 01:53.
    Best wishes

    (Stata 16.1 MP)

    Comment


    • #3
      Hi Flex,

      Thanks a lot for your help!

      My supervisor suggested using propensity score matching, and I’d really appreciate your advice on how to implement it correctly in Stata.

      I tried using the following code:

      HTML Code:
      psmatch2 hard_final_Exact_new Fund_Status_w  ROA_w   Firm_Size_w  i.year i.ff_12  , out (hard_final_Exact_new) neighbor(1) noreplacement
      But I don’t think it’s matching correctly by year and industry (ff_12 – Fama-French 12). I’m not sure if I’m applying the code the wrong way or misunderstanding

      Could you please advise me on how to properly include exact matching on year and industry in the propensity score model?

      Many thanks again!

      Best regards,
      Hussein

      Comment


      • #4
        In your post you use a different command (psmatch2) and different variables. I am not sure if psmatch2 even supports exact matching. I suggest you try the code from my first post and see if this works for you.
        Best wishes

        (Stata 16.1 MP)

        Comment


        • #5
          I tried the code you gave me, and it worked very well—thank you!

          Actually, I’ve posted again regarding a different issue related to PSM using psmatch2. I'm currently facing a problem with it, and I would really appreciate your help in solving it. I also tried tagging you there, so you might recognize it and be able to assist.

          Thanks

          Comment


          • #6
            I have quickly checked the documentation of psmatch2 (help psmatch2) and it seems that there is no convenient way for exact matching. That is why your years are not exactly matched. While the documentation describes a way to do this (see "Matching within strata"), this requires some extra coding and becomes even more difficult as you have multiple variables to match on. I suggest you use kmatch and get this done in a second.
            Best wishes

            (Stata 16.1 MP)

            Comment


            • #7
              Thanks a lot professor Fleix

              Comment

              Working...
              X