Event Studies in Matlab

Description of the MatLab code provided herearrow.

The program imports three files: (1) a request file, (2) closing prices of company stocks, and (3) closing prices of indices. The files are imported as text, with columns separated by semicolons. Each record of the request file represents a firm-event to be analyzed, described by an event id, the name of the company, and parameters of the estimation window and the event window.

The Matlab function transforms each file into the arrays of structures. At the same time, each date is transformed from a text format into a single identifying number, and the prices are replaced with calculated returns. The index file with the beginning of each company record is created to speed up the analysis. The function loops through the records of the request file. For each event, it finds all the records for the event window in the dataset for companies and the dataset for index data. It calculates regressions between the returns of the company and the index in the same estimation window and applies coefficients of this regression to calculate the expected returns of the company in the event window based on the value of the index return in this time period. The differences between the actual and expected returns yield the ARs for each given day within the event window.