I have two dataframes.
Dataframe 1: "fincomp"
Dataframe 1 contains 890 acquisition bids with the following variables:
- Announcement date (ANDATE)
- Company ID (PERMNO)
- Bid ID (ID)
- ROUND ID used to identify bidding competition rounds(ROUND_ID)
structure(list(ANDATE = structure(c(9521, 6502, 6500, 12359,
14662, 5212), class = "Date"), PERMNO = c(81238L, 68806L, 68806L,
NA, 85739L, 39271L), ID = c(533016020, 122837020, 20106020, 1447113020,
2157920020, 154772043), ROUND_ID = c(26166, 50002, 50002, 16312,
39087, 50024)), row.names = c(NA, 6L), class = "data.frame")
Dataframe 2: "r"
Dataframe 2 contains daily abnormal returns for each company with the following variables:
- Company ID (PERMNO)
- Date (DATE)
- Daily abnormal return (AR_VM)
structure(list(PERMNO = c(10020L, 10020L, 10020L, 10020L, 10020L,
10020L), DATE = structure(c(5866, 5870, 5871, 5872, 5873, 5874
), class = "Date"), AR_VM = c(NA, NA, 0.016231, 0.056379, 0.042756,
-0.001765)), row.names = c(NA, 6L), class = "data.frame")
I want to compute the cumulative abnormal returns for the following event window:
- -20 days to +180 days
Where the event is the bid announcement date.
In the end, my goal is to produce something like this:
I will be also running a regression where the CARs will be the dependent variable.
In other words, I need to match the two dataframes by PERMNO and date, and compute the cumulative abnormal returns for each company in the period -20 to +180 surrounding each bid announcement. I would like to have a return series at the end, so that I can use it for regression later.
Any idea on how to do this?