Announcement

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

  • HELP!!! Panel Diff-In-Diff Trouble

    Hello! Thank you for reading/helping! I have a panel dataset with multiple observations per company, looking at the 6 month average stock price pre/post election (years 2002-2012), calculating the percent change between them, and then I also have individual CEO data for each year on their campaign contribution data, as seen in the dataex output below. I am trying to answer the question if pre/post election, if there is a significant difference in the 6 month average stock price for a company, based on how much and to whom their CEO donated to. I am also trying to see if pre/post 2008, if there is an effect on the percent change in 6 month average stock price based on how much a CEO donated to the winning party. I have tried to run the following regressions:

    xtset companyid year
    xtreg percent_changestockprice towinner totaldem totalrep total_donated majority_dem numconts male age yrdum*, fe

    as well as

    xtset companyid post_2008
    xtreg percent_changestockprice winner post_2008 post_2008##winner total_donated numconts male age, fe vce(cluster companyid)


    however, I always run into this error: repeated time values within panel r(451);

    Do I have to collapse my dataset by companyid and year, and then take the mean and then set the panel structure with xtset companyid post_2008 year?

    [CODE]
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str8 ticker byte post str18 lastname str21 sector float(totaldem totalrep) long towinner float winner double _6moavg_ float(percent_changestockprice year post_2008)
    "AAPL" 1 "cook" "Technology" 2300 0 1 1 51.54999923706055 -.1081315 2002 0
    "AAPL" 0 "cook" "Technology" 2300 0 1 1 57.79999923706055 . 2002 0
    "AAP" 1 "jackson" "Services" 0 1000 1 1 41.2599983215332 -.03755542 2004 0
    "AAP" 0 "jackson" "Services" 0 1000 1 1 42.86999893188477 . 2004 0
    "AAP" 0 "jackson" "Services" 0 1000 1 1 38.11999893188477 . 2006 0
    "AAP" 1 "jackson" "Services" 0 1000 1 1 35.59999847412109 -.06610704 2006 0
    "AAP" 0 "jackson" "Services" 0 1000 1 1 40.29999923706055 . 2008 0
    "AAP" 1 "jackson" "Services" 0 1000 1 1 30.36000061035156 -.2466501 2008 0
    "AAP" 1 "jackson" "Services" 0 1000 1 1 65.98999786376953 .27492273 2010 1
    "AAP" 0 "jackson" "Services" 0 1000 1 1 51.7599983215332 . 2010 1
    "AAP" 0 "jackson" "Services" 0 1000 1 1 72.94000244140625 . 2012 1
    "AAP" 1 "jackson" "Services" 0 1000 1 1 73.1500015258789 .002879066 2012 1
    "ABC" 1 "Collis" "Healthcare" 3667 10750 12 0 48.90000152587891 -.10291684 2002 0
    "ABC" 0 "Collis" "Healthcare" 3667 10750 12 0 54.5099983215332 . 2002 0



  • #2
    Katherine:
    just -xtset- your data with -companyid- only.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo! Thank you so much for your help - that seems to work for the pre/post regular election variables, but when i attempt to run my regressions by running:

      xtset companyid
      xtreg percent_changestockprice winner totaldem totalrep total_donated i.post post##winner, fe vce(cluster companyid)

      xtset companyid
      xtreg percent_changestockprice winner post_2008 post_2008##winner total_donated numconts male age, fe vce(cluster companyid)

      every single regression the "post" variable of interest is omitted due to collinearity? as well as the dummy "winner" variable if they donated to a winner?

      If you have any advice, please let me know! Thanks!

      Comment


      • #4
        Katherine:
        are the omitted variables time-invariant?
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          For example,

          xtreg percent_changestockprice majority_dem post_2008 post_2008##majority_dem total_donated numconts male ag
          > e, fe vce(cluster companyid)
          note: majority_dem omitted because of collinearity.
          note: 1.post_2008 omitted because of collinearity.
          note: 1.majority_dem omitted because of collinearity.
          note: 1.post_2008#1.majority_dem omitted because of collinearity.

          this is the output I receive ^, the post_2008 variable is just my dummy to indicate my pre/post periods, so I'm confused as to why it would be omitted? The donation amounts, like majority_dem, do not change because I just have data on what the donation amounts were prior to the election, so for my pre/post election regressions, that makes sense why it would be collinear, but for pre/post 2008, like in the regression above, it doesn't make sense as to why it would be collinear, since for the years pre/post 2008 there are a variety of donation amounts?

          Comment


          • #6
            Katherine:
            what if you code without repeating -majority_dem- and -post_2008- twice? If I'm not mistaken, the conditional.main effect of boththese predictors is alredy included in the -fvvarlist- notation:
            Code:
            post_2008##majority_dem
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment

            Working...
            X