ASREG: A powerful package for regressions in Stata


asreg is a Stata program, written by Dr. Attaullah Shah. The program is available for free and can be downloaded from SSC by typing the following on the Stata command window:

ssc install asreg

asreg was primarily written for rolling/moving / sliding window regressions. However, with the passage of time, several useful ideas were conceived by its creator and users. Therefore, more features were added to this program.  The primary uses of asreg can be summarized under the following three headings:

  1. Rolling window regressions
  2. by-group regressions
  3. Fama-MacBeth (1973) regressions


Speed Efficiency

asreg is an order of magnitude faster than estimating rolling window regressions through conventional methods such as Stata loops or using the Stata’s official rolling command. asreg has the same speed efficiency as asrol. All the rolling window calculations, estimation of regression parameters, and writing of results to Stata variables are done in the Mata language. Similarly, estimating Fama and MacBeth(1973) regression through asreg is several times faster than other available options.



asreg can be used for the following purposes. Click the following links for further details.

  1. Rolling window regression, rolling windows betas
  2. Recursive window regressions
  3. by-group regressions
  4. Fama-MacBeth (1973) regressions
  5. Rolling window regression with Newey-West standard errors
  6. Rolling window fitted values and residuals
  7. Getting rolling window t-statistics


Questions / Answers

Question:  How can I get similar results as produced by the Stata’s  rolling command
Answer: See a detailed answer here in this post.

Leave a Reply


Michel Steenhoven

October 2, 2018at 10:16 pm

I am currently trying to use the command asreg to estimate rolling beta’s for a large panel data set. I believe everything is working fine but as the dataset is quite large (260000 monthly observations) the computation takes a long time. I was wondering if there is a possibility to track the computation process, to be sure the command is actually processing.

Thank you in advance for your time and effort, kind regards,

Attaullah Shah

October 12, 2018at 4:10 pm

Dear Michel
I think 260000 observations should not take that much time unless your system is slow. As a suggestion, I have noted your point and shall consider this option in the next update.

Leave a Reply

2 + 10 =