Announcement

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

  • Saving t-stats in rolling regression with Newey-West se

    I have to perform a rolling regression with Newey-West se over 1135 obs with a window of 52. I run it over the "rolling" window and enter there the code
    Code:
    newey PBQ1 MKTRF SizeTLS momLS, lag(7)
    I can then tick "Model coefficients" and "SE of model coefficients". In the next line I could enter other statistical expressions. What do I have to put in to also get the t-statistics, i've already tried what i thought would make sense, e.g. _t, _tstat, ....

    The code which i get in the end from the rolling window is this:

    Code:
    rolling _b _se, window(52) clear : newey PBQ1 MKTRF SizeTLS momLS, lag(7)
    Ideally, I'd also like to get the adj. r2, for this I now use:

    Code:
    rolling e(r2_a), window(52) clear : regress PBQ1 MKTRF SizeTLS momLS
    But it always deletes my initial variables, is there a way for stata to save the coefficients, se and t-stats from the newey regression and the adj. r2 from the normal regress?

  • #2
    Ok I figured out how to do the last steps with a loop but still don't know how to tell stata that I also want the t-statistics saved in the rolling newey regression. So if _se gives me standard errors and _b the coefficients I need to know which command gives me the t-stats...

    Comment


    • #3
      The new beta version of asreg 3.1.1 can handle newey regressions in a rolling window. This version is still for testing purpose. You can install it from my website www.FinTechProfessor.com. After the testing phase, asreg will be uploaded to SSC.

      Code:
      * Install asreg
      net install asreg, from(http://fintechprofessor.com) replace
      
      * Use example data
      webuse grunfeld, clear
      
      * newey regressions in a rolling window of 20 observations and using 4 lags
      
      bys company: asreg invest mvalue kstock, window(year 20) newey(4)
      For knowing other capabilities of asreg, please read these Statalist posts
      https://www.statalist.org/forums/for...nstant-options

      https://www.statalist.org/forums/for...-rolling-betas
      Last edited by Attaullah Shah; 25 Jul 2018, 19:04.
      Regards
      --------------------------------------------------
      Attaullah Shah, PhD.
      Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
      FinTechProfessor.com
      https://asdocx.com
      Check out my asdoc program, which sends outputs to MS Word.
      For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

      Comment


      • #4
        Update: asreg version 3.1.1 is now available on SSC. To install,
        Code:
        ssc install asreg, replace
        Since post #1 in this thread is asking for getting t-statistics, here is a short blog entry on how to get t-states with asreg.
        http://fintechprofessor.com/2018/03/...tics-se-stata/
        Last edited by Attaullah Shah; 31 Jul 2018, 19:06.
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        FinTechProfessor.com
        https://asdocx.com
        Check out my asdoc program, which sends outputs to MS Word.
        For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

        Comment


        • #5
          Hi, I am also working on the same method: rolling window (asreg) with Newey-West correction. My code is: bysort PERMNO: asreg EXCOMP MktRF, window(mofd 36) newey(6). Then I generate betas and constants for each time period in each PERMNO. I would like to ask how you interpret the result? How do you calculate the t-value? Do you average the coefficients and standard errors, and then divide the average coefficients with average standard errors?

          Comment


          • #6
            You would like to read this post, where I show how to generate t-values and p-values using asreg.
            Regards
            --------------------------------------------------
            Attaullah Shah, PhD.
            Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
            FinTechProfessor.com
            https://asdocx.com
            Check out my asdoc program, which sends outputs to MS Word.
            For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

            Comment


            • #7
              Dear Professor Shah,
              I am so glad to receive your reply. However, when I run the code in the post, I have the error: <istmt>: 3499 ASREGW() not found. What is the cause of this and how I can solve it?

              My code is:
              Code:
              bysort PERMNO: asreg EXCOMP MktRF, window(mofd 36) min(36) se
              Besides, is the commend applicable to the Newey-West correction? Such as:
              Code:
              asreg EXCOMP MktRF, window(mofd 36) min(36) newey(6)
              Last edited by Wen-Hung Hsu; 16 Jul 2021, 03:36.

              Comment


              • #8
                The error: the error: <istmt>: 3499 ASREGW() not found. is followed by the following code:
                Code:
                bysort PERMNO: asreg EXCOMP MktRF, window(mofd 36) min(36) se

                Comment

                Working...
                X