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
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

Comment