I am quite new to programming and I am trying to perform an event study on m&a announcement returns. My data(DF1) consists of 186 companies that participated in a m&a. These companies are the column names 2:186 with their daily returns in those columns. The first column is the date. the other dataset(DF2) consists of the companies and the date on which the m&a was announced for that company.
So there are 186 companies with different event dates. I have tried programming it in a for loop like the code below:
for (i in Event$event_dates[1:195]) {
firms <- Event$acquiror_name[Event$event_dates==i]
hh2[[i]] <- evReturn(y= Returns, firm = firms, event.date = i, y.date = "date",
index = "sp500", event.win = 1, est.win = 199, digits = 4)
}
This gives me the abnormal return of the companies at the announcement date. However, I can not retrieve the aggregated cumulative abnormal return and its p-, or t-value. I think it needs a second for loop but i don't know how to program it.