Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Regress in fixed time period

    I have a dataset from 2004-2022 and want to form a regression every rolling 6 months so jan 2004-jun2004, jul-2004-dec2004, all the way to 2022. Is there a way to do this?

  • #2
    I would call that working with a moving window of fixed length, and it is supported by many commands, such as rolling, rangestat (SSC) and asreg (SSC).

    Comment


    • #3
      The regression I am using is used to regress a search term with the fama french factor model. I only want it to keep words that are negatively correlated with the market.

      Code:
      . foreach var of varlist ldiffcost_w - ldiffexpense_w {
        2. rolling _b, window(6/12*`=_N') : regress `var' rmrf, robust
        3.     if e(b)[1,1] < 0 local negvars `negvars' `var'
        4. tsset date, daily
        5. }
      time variable not set, use tsset varname ...
      r(111);
      I am having issues with the tsset command to create my 6 month rolling regression. Not sure if this is right?

      Comment


      • #4
        I think we've mentioned this to you before. Please don't ask the same or similar questions in two or more threads.

        That won't raise your chances of getting good answers. It will be more likely to reduce them if people find your posts repetitive and disorganized and back off.

        Comment

        Working...
        X