Announcement

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

  • Storing the p-values and t-stat from Paul Geertsema's regression code

    Hi guys! I need to conduct rolling regressions to estimate the betas of Fama-French's 3 factors. I am using daily data so this is going to take ages! I bumped into Paul Geertsema's paper where he advocated an alternative method that was '367' times faster than Stata's regress command. I tested his code on a random sample of stocks in excel and it gets a pass from me!

    His .do file and .ado file can be accessed from here: http://poseidon01.ssrn.com/delivery....106090&EXT=pdf

    The problem that I have is there is no option to store the p-value and t-stat after each regression. How would I do this?
    Last edited by Tuyen Dinh; 30 Sep 2016, 03:18.

  • #2
    From a quick glance the mentioned program neither computes a t-statistic nor a p-value. If want these you will have to implement it.

    In case you are not familiar with the formulas, see Buis (2007).

    Best
    Daniel

    Buis, M. L. 2007. Stata tip 53: Where did my p-values go? The Stata Journal, 7(4): pp. 584-586.
    http://www.stata-journal.com/sjpdf.h...iclenum=st0137
    Last edited by daniel klein; 30 Sep 2016, 04:16.

    Comment


    • #3
      Originally posted by daniel klein View Post
      From a quick glance the mentioned program neither computes a t-statistic nor a p-value. If want these you will have to implement it.

      In case you are not familiar with the formulas, see Buis (2007).

      Best
      Daniel

      Buis, M. L. 2007. Stata tip 53: Where did my p-values go? [i]The Stata Journal[i], 7(4): pp. 584-586.
      http://www.stata-journal.com/sjpdf.h...iclenum=st0137
      Thanks for your prompt reply Daniel. I am not familiar with MATA. Will I need to learn MATA to implement this? Or can the change be done in his .do file?

      Comment


      • #4
        As far as I have seen, fastreg will give you all components needed (coefficnets, covariance matrix and degrees of freedom). Aside form the DF which seem to be returned in e(dof) instead of e(r_df), you can merely copy the couple of lines of code in Maarten's article.Please do read this, as I do not think you have done so in the four minutes you needed to reply.

        If you need more/other assistance, please be more precise in terms of what exactly you mean by

        store the p-value and t-stat after each regression
        and give code examples.

        Best
        Daniel
        Last edited by daniel klein; 30 Sep 2016, 04:29.

        Comment


        • #5
          Hello,
          I have a similar problem as Tuyen. I have a panel data set with daily stock returns across a bunch of firms. I would like to estimate daily alphas (constant) and betas using the Fama French 3-Factor model with a rolling window of 250 days. As the rolling command in STATA takes ages, I also use the -fastreg- command from Geertsema (see https://papers.ssrn.com/sol3/papers....act_id=2423171).
          My problem is similar to Tuyen: I do not manage to adjust the code in that it stores standard errors or t-stats after each regression. I had a look at Buis (2007). However, it still doesn't work for me.
          Can anyone help me how to do that in STATA? The code that I use is as follows:

          **rolling window betas**
          gen mktrf_beta = .
          gen smb_beta = .
          gen hml_beta = .
          gen _cons_beta = .
          gen mktrf_beta_f = .
          gen smb_beta_f = .
          gen hml_beta_f = .
          gen _cons_beta_f = .

          local maxobs = 400000
          local window = 250

          timer clear
          timer on 1
          forvalues k = `window'/`maxobs' {
          local first = `k'-`window'+1
          local last = `k'
          if permno[`last'] == permno[`first'] {
          * if window covers same permno, then do estimation
          qui fastreg eret mktrf smb hml in `first'/`last'
          * save coefficients
          foreach x in mktrf smb hml _cons {
          qui replace `x'_beta_f = _be[`v'] in `last'
          }
          }
          }
          timer off 1
          timer list 1

          Thank you so much for your help.
          Best,
          Luce
          Last edited by Luce Mock; 18 Oct 2016, 03:56.

          Comment

          Working...
          X