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
weighted averageHi, I have a database of donations and I want to use it to generate a new var to indicate donors ide…
Effect size logit regression with sqaure terms and interactionsDear STATA users, I am running a model with a logit regression (binary DV), in which I include my I…
Getting STATA to loop phrases (2 or more words with spaces in between)Hello, I'm trying to construct a foreach loop where I am using a few words as the phrase to loop o…
Stata Version and MEOLOGIT Model ConvergenceBasic question here, but when collaborating on analysis with a colleague with a different version of…
adding 100 rows in a matrix from different 100 matricesHello, I am trying to make a column matrix (100X1) using different 100 matrices? What is the best po…
Subscribe to:
Post Comments (Atom)
0 Response to Forecasting stockreturns following earnings annoucements
Post a Comment