1

I would like to perform a rolling window regression for panel data over a period of 36 months and get the monthly intercept as output. My data has 1397 Funds (ID) with 252 monthly returns each.

    ï..ID Period Return         RMRF         SMB5          HML          RMW
1-1     1      1   <NA>  0.027131614 -0.000206798 -0.021403548  0.017474395
1-2     1      2   <NA>  0.009564262  0.025552733 -0.011379760  0.022345710
1-3     1      3   <NA>  0.014315746 -0.002847203  0.014032642 -0.007219692
1-4     1      4   <NA>  0.048363609  0.008673535  0.019081777  0.003571456
1-5     1      5   <NA> -0.025923904  0.044332726  0.001115927  0.001927510
1-6     1      6   <NA>  0.026734862  0.001516872  0.005258489  0.003943867
             CMA
1-1 -0.036913366
1-2  0.018724877
1-3  0.016066358
1-4 -0.003265331
1-5  0.018159172
1-6 -0.014966470

         ï..ID Period       Return         RMRF         SMB5          HML
1397-247  1397    247  0.005945991 -0.002882396 -0.013501132  0.000409125
1397-248  1397    248 -0.015762253 -0.012668465 -0.006875024 -0.019310729
1397-249  1397    249   0.03603303  0.032361027 -0.006767910  0.031112181
1397-250  1397    250  0.001932212  0.009555836  0.008110662 -0.004983660
1397-251  1397    251  0.019284853  0.030316686  0.019022510 -0.023171037
1397-252  1397    252  0.013243989  0.022730605  0.026619563  0.003929087
                  RMW          CMA
1397-247 -0.011966912  0.000511407
1397-248  0.008897090 -0.000202207
1397-249 -0.004747638  0.012626697
1397-250  0.012410290 -0.015537292
1397-251  0.013356231 -0.016695288
1397-252 -0.003929087  0.001375180

```

So far I have tried the following code:

#Rolling Panel Regression
Roll_Alphas <- roll_regres(formula = plm(Returns ~ RMRF,data=pdata, model = "within"), width= 36)

but received the error message:

error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :  0 (non-NA) cases

I assumed the error was due to the NA values in my Return variable, but I tried replacing them with a random number (just to see whether it would work) and still got the same error.

Also how can I create this regression with robust standard errors?

Helix123
  • 3,502
  • 2
  • 16
  • 36
Lena
  • 11
  • 2
  • 1
    Thanks, this was a mistake I made when I wrote the question. My actual data has different names. – Lena May 26 '20 at 14:14
  • I assume function `roll_regres` is from package `rollRegres` and doubt if that package supports `plm`. Anyway, the specification of the formula argument in `roll_regres` seems wrong, please check its documenation. – Helix123 May 28 '20 at 19:36

0 Answers0