Home Forums ASREG : Rolling window and Fama-MacBeth Regressions asreg missing values in the dependent variable Stata

Viewing 2 posts - 1 through 2 (of 2 total)
• Author
Posts
• Molnar
Guest
Post count: 118

I am Stata-user working on a problem involving rolling-window regression and I came across the „asreg“ command written by you. First, I want to thank you for contributing to improve the versatility of Stata and making programmer’s life easier. However, I am pondering about an estimation result using the “asreg” command. In an example estimation, I run a 5-year linear rolling window regression on 1 independent variable. As a test, I deliberately created a series 10 consecutive missing values in the dependent variable. Surprisingly, “asreg” is able to give me non-zero, non-missing estimates for this series, so I wonder what technique is used in the background as even if less than 5 observations are sufficient to run a regression, by moving the estimation over 10 consecutive missing observations, there are definitely estimation windows where all dependent observations are missing, thus the resulting coefficient estimates should be missing as well. I tried learn more on the “asreg” command using the Stata-help file and your webpage, but I didn’t find any material going into this detail. So I kindly ask you elaborate on this matter and provide me with more information.

Best regards

Attaullah Shah
Keymaster
Post count: 69

Hello Molnar
Since I cannot replicate the problem you are referring to. For the record, asreg does not do any extrapolation. If the dependent variable is missing, it shall create missing output.

Please identify any unexpected results in the following code and the results shown below the code.

*Create some dummy data
set obs 100

gen company_id = _n
expand 20
bys company_id : gen year = _n + 1980
gen dep_var = uniform()
gen x1 = uniform()
gen x2 = uniform()
gen x3 = uniform()
replace dep_var = . in 10

*rolling window regression
asreg dep_var x1 x2 x3, window(year 5) by(company_id )

*Note that the results are missing for observation 5 as I set the dep_var equal to missing in observation 10

. list company_id year dep_var x1 x2 x3 _b_x1 _b_x2 _b_x3 _b_cons in 1/20

+-----------------------------------------------------------------------------------------------------------------+
| compan~d   year    dep_var         x1         x2         x3        _b_x1        _b_x2        _b_x3      _b_cons |
|-----------------------------------------------------------------------------------------------------------------|
1. |        1   1981   .9472316   .4128598    .722326   .5578895            .            .            .            . |
2. |        1   1982   .0522234   .7549242   .5103776   .7870066            .            .            .            . |
3. |        1   1983   .9743183    .552299   .8967206   .7550112            .            .            .            . |
4. |        1   1984   .9457484   .5891278   .3083104   .3083135            .            .            .            . |
5. |        1   1985   .1856478    .697482    .909019   .1549393   -3.0732114   -.33335542    .01013383    2.6870112 |
|-----------------------------------------------------------------------------------------------------------------|
6. |        1   1986   .9487334   .4505732   .3013251   .9282259   -3.6761877   -.03146574   -.21259752     3.002839 |
7. |        1   1987   .8825376   .3878326   .1245625   .0175663   -1.0323297    -.3133134    .40717164    1.3231022 |
8. |        1   1988   .9440776   .4846907   .2986447    .337576    1.1819022   -1.4298679    .25653229    .63017369 |
9. |        1   1989   .0894259   .4338235   .3440744    .758045    13.829088   -6.3155436    .27149413   -3.7996463 |
10. |        1   1990          .   .8449519   .6950497   .3233008            .            .            .            . |
|-----------------------------------------------------------------------------------------------------------------|
11. |        1   1991   .9484983   .4248196   .3894849   .6740687     2.953628   -.73021252   -.22957358   -.18853085 |
12. |        1   1992   .1121626   .2664079   .2287498    .327188    2.3396352    6.3272919    -2.740214   -.93388601 |
13. |        1   1993   .4809064   .5369344   .9809995    .649418    3.8529128   -.62252069   -.68318142    -.4848008 |
14. |        1   1994   .9763448   .3829168   .1949201   .9513145   -2.8998911    .73232787    1.7772335    .19997632 |
15. |        1   1995   .1254975   .0192644   .8068066   .2702817   -.05386859   -.11403092    1.3741806   -.18383902 |
|-----------------------------------------------------------------------------------------------------------------|
16. |        1   1996   .7655026   .0001751   .4510984   .3024662   -1.1119095   -.02674897    1.5406791    .00390702 |
17. |        1   1997   .0358593   .1630308   .9948465    .944969    .89422509   -1.0497158   -.30523184    1.1898735 |
18. |        1   1998   .0702359   .7856113   .7915192   .5903638   -.28049067   -1.3305861     .1390848    1.2473779 |
19. |        1   1999   .2101787    .177225   .2381918   .0603619   -.36437884   -.75992844    .31518871    .68711351 |
20. |        1   2000   .6616006   .0859762   .7393021   .1151739   -.54199642    .46124685   -.71506168    .47141122 |
+-----------------------------------------------------------------------------------------------------------------+

Viewing 2 posts - 1 through 2 (of 2 total)
• You must be logged in to reply to this topic.