Following are the key highlights of the new version
1. Changes made to the window() option
Version 4.0 of asreg introduces a more flexible window to identify observation in a given range. Previously, the window() option of asreg would take two inputs: the first one as the range variable (such as date) and the second one as the length of the rolling window. In the older versions, the window would always look backward. This has changed in version 4.0.
The window argument can now take up to three arguments. The window can now look backward, forward, and both back and forward. More details can be read in the help file under the option window()
2. Improved algorithm for rolling window indices
This version of asreg (version 4.0) significantly improves the calculation speed of the required statistics, thanks to the development of a more efficient algorithm for extracting rolling window indices. This has resulted in a significant speed advantage for asreg compared to its previous versions or other available programs. The speed efficiency matters more in larger datasets.
3. Exclude observations with option exclude()
Option exclude() can be used to exclude specific observations from regressions. This option requires three arguments, with or without using the comma character. The first is the range variable such as daily, weekly, monthly or yearly date; the second and third arguments are the lower and upper bounds of the range variable. The definitions and working of option exclude(rangevar #low #high) are similar to that of the option window(rangevar #from #upto).
Examples:
Example 1: Regression for each company in a rolling window of last 10 years
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, wind(year 10)
Code:
. bys company: asreg invest mvalue kstock, wind(year -10 0)
Example 2: Regression for each company in a rolling window of 10 years; 5 past and 5 forward
Code:
. bys company: asreg invest mvalue kstock, wind(year -5 5)
Example 3: Regression for each company in a rolling window of 10 leading years
Code:
. bys company: asreg invest mvalue kstock, wind(year 0 10)
.
Code:
webuse grunfeld, clear . bys company: asreg invest mvalue kstock, wind(year 10) rec
Code:
. bys company: asreg invest mvalue kstock, wind(year 1000)
Example 5: Using option minimum - Limit regression to a minimum of 5 observations
.
Code:
webuse grunfeld, clear . bys company: asreg invest mvalue kstock, wind(year 10) min(5)
Example 6: Reporting standard errors
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, wind(year 10) se
Example 7: Newey-West standard errors, lag(1)
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, wind(year 10) se newey(1)
Example 8: Robust standard errors
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, wind(year 10) robust
Example 9: Reporting standard errors, fitted values and residuals
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, wind(year 10) se fit
Example 10: Regressions without constant
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, wind(year 10) noc
Example 11: No window - by groups regressions
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock
Example 12: Yearly cross-sectional regressions
Code:
. webuse grunfeld, clear . bys year: asreg invest mvalue kstock
Example 13: Rolling regression - reporting RMSE
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, w(year 10) rmse
Example 14: Fama and McBeth Regression
Code:
. webuse grunfeld, clear . asreg invest mvalue kstock, fmb
Code:
. webuse grunfeld, clear . asreg invest mvalue kstock, fmb newey(1)
Example 16: Fama and McBeth Regression - report first stage regression
Code:
. webuse grunfeld, clear . asreg invest mvalue kstock, fmb first
Example 17: Fama and McBeth Regression - save first stage results
Code:
. webuse grunfeld, clear . asreg invest mvalue kstock, fmb save(FirstStage)
Example 18: Exclude focal observation in cross-sectional regressions
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, exclude(year 0 0)
Code:
. webuse grunfeld, clear . bys company: asreg invest mvalue kstock, exclude(year -4 0)
0 Response to asreg : Updated 2021: new flexible window | Fastest rolling regressions in Stata
Post a Comment