Hello everyone on Statalist,
I’m running into an issue regarding forecasting realized volatility using an AR(1) model after the announcement of quarterly earnings by a selection of SP500 companies.
The dataset I have consists of around 100 S&P-500 listed companies with the following variables: Date, Adjusted Closing Price, Earnings (takes value 1 if earnings announcements were done that specific day and zero otherwise) and Returns (simple stock return: D.AdjClose/L.AdjClose). The variables are daily observations over the period 1996 – 2020.
I want to forecast stock returns for the 30 days following the announcement of quarterly earnings using an AR(1) model. The rolling window must be 1000 observations, so the 1000 observations prior to a specific earnings announcement will be used to forecast the stock returns over the 30 days following that announcement.
I am looking for a way to create a code that automatically does the forecasts as described above, but the only way I can see a solution is to do it manually. The code down below is the best I have been able to do so far. The numbers 201, 250 and 50 are just examples to illustrate.
gen AR1_Forecasts = .
forvalues s = 201/250 {
reg Y L.Y if t>=`s'-50 & t<`s'
predict temp if t==`s'
replace AR1_Forecasts = temp if t==`s'
drop temp
}
Any advice is welcome and appreciated.
Thanks in advance,
Stijn Ouwehand
Related Posts with Forecasting stockreturns following earnings annoucements
Hello! How to create flowchart diagramm?My STATA version 13.0 …
Margins command error: at values for factor wavefirst do not sum to 1Hi. I am using a dynamic random effects model to study the effect of health insurance on self-employ…
Help Sorting Data by State and yearDear all, here is a screenshot of my data. My dataset includes GDP for all 50 states over a period …
Installing Stata Scheme on Offline ComputerHi, I'm trying to install the 538 scheme ("g538schemes") onto an offline computer that I'm not able …
Dialog box script: if condition on chosen combo box value?This is my first time creating a dialog box, and I am struggling to create conditions based on chose…
Subscribe to:
Post Comments (Atom)
0 Response to Forecasting stockreturns following earnings annoucements
Post a Comment