|
楼主

楼主 |
发表于 2010-12-22 04:40:58
|
只看该作者
练手系列6: OLS regression in a rolling window
Can't input Chinese at workstation, but here is an interesting question. I have a solution I think that is the fastest so far, but I would like to see how you guys come up with noval solutions:
1. Easy One:
I have a dataset with 500K observations, one independent variable X and one dependent variable Y. I want to conduct an OLS regression sequentially in a 20-observation rolling window and obtain the slope coefficient for X, say \beta. Note that this Linear Normal regression model should have an intercept, but I am not interested in the intercept term.
2. Difficult One:
I have a dataset with 500K observations, M independent variables X1-Xm where m ranges from 2 to 10 and one dependent variable Y. I want to conduct a OLS regression in a 20 observation rolling window and obtain the slope coefficients for X1-Xm, a.k.a \beta_1 to \beta_m. Note that your linear normal regression model should have an intercept term but it is of no interets to me.
I will post my solutions to both questions after 5 followup posts or after this weekend, whichever comes first.
All solutions will be gauged on my PC or Shiyiming's machine based on total real time and memory consumption. Folks, fire up you knowledge on Stat and SAS! <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
|