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
Defining logit dependent variableHi...perhaps you or someone can help me...I want to run a panel logit crisis model and not sure how …
Labeling Scatter plot in twowayDear all, I have a problem labeling plot using twoway command. I am plotting scatter with line of …
Pooled OLS and Panel Data AnalysisHello everyone, My question is rather simple but since i am very new to econometrics I am strugglin…
Graph to start at y-axisHi I have been reproducing the following graph (from "Sample size of 12 per group rule of thumb for …
append to fileI am sure I am missing something basic here... I want to save the memory data to a file like Code:…
Subscribe to:
Post Comments (Atom)
0 Response to Forecasting stockreturns following earnings annoucements
Post a Comment