Announcement

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

  • ASREG update : Rolling window regression with robust standard errors, newey-west standard errors, and noconstant options

    I am posting version 3.0 of asreg here for testing purposes. This version can be installed by:

    Code:
    net install asreg,  from(http://FinTechProfessor.com) replace
    This version has two new features:

    1. Robust Standard errors

    2. regressions without a constant (intercept)

    Examples:

    Code:
    webuse grunfeld, clear
    
    * full sample regression, without constant
    asreg invest mvalue kstock, noconstant
    
    * Regression for each company, without constant
    bys company: asreg invest mvalue kstock, noconstant
    
    * Regression for each company in a rolling window of 10 years without constant
    bys company: asreg invest mvalue kstock, noconstant wind(year 10)
    
    * Regression for each company in a rolling window, reporting robust standard errors
    bys company: asreg invest mvalue kstock, robust wind(year 10)
    I shall appreciate if programming bugs are emailed to [email protected]
    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.

  • #2
    Version 3 of asreg is now available on SSC, thanks to Kit Baum. Older version can be updated by:

    Code:
    ssc install asreg, replace
    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


    • #3
      Dear Mr. Shah,
      I really appreciate the command asreg, it is extremely useful and fast.
      I would like to ask you how I can achieve the following: I would like to run a rolling regression with a window of 252 daily data but I would like to exclude all the observations for which a specific variable (say, returns) is available for a number of observations which is less than 90% of the required window(252). So for example, let's say I have a a time series of returns for different permnos (i.e. identifiers). The rolling regression command asreg produces a slope coefficent that is based on the specified window (252) of observations. I want to exclude a certain permno (i.e. get missing values for the output of the asreg slope coefficient) for the day such that in the previous 252 observations of returns there are actually less than 90% of 252 non-missing values for the variable returns.

      Comment


      • #4
        You have not provided an example data set. Here is one way to do it.

        Code:
        * Generate a dummy data set
        clear
        set obs 10
        gen id = _n
        expand 500
        bys id: gen date = _n+21000
        format date %td
        gen ri = uniform()
        gen rm = uniform()+ri/uniform()
        
        * Create missing values
        drop in 100/200
        
        
        * Since 90% of 252 is 226.8, we can use the option minimum of asreg to specify minimum observations of 227
        bys id: asreg ri rm, window(date 252) min(227)
        Last edited by Attaullah Shah; 04 Jul 2018, 16:34.
        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
          Thank you so much Mr. Shah for your help.

          Comment


          • #6
            Hi,

            I'd like to run a FMB regression without constant. Here is what I have tried:

            Code:
            asreg Ret_P_test _b_DOL _b_CAR _b_IMB, fmb noconstant
            Here is what I'm getting, including an intercept. Would you be able to help? Thanks!
            Code:
            . asreg Ret_P_test _b_DOL _b_CAR _b_IMB, fmb noconstant
            
            Fama-MacBeth (1973) Two-Step procedure           Number of obs     =     15538
                                                             Num. time periods =       444
                                                             F(  3,   443)     =      3.33
                                                             Prob > F          =    0.0195
                                                             avg. R-squared    =    0.2659
                                                             Adj. R-squared    =    0.2200
            ------------------------------------------------------------------------------
                         |            Fama-MacBeth
              Ret_P_test |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                  _b_DOL |  -.2814507   .2185134    -1.29   0.198    -.7109025    .1480011
                  _b_CAR |   .4344408   .1485923     2.92   0.004     .1424073    .7264742
                  _b_IMB |   .2116963   .1234914     1.71   0.087    -.0310054     .454398
                   _cons |   .3097895   .1810607     1.71   0.088    -.0460551    .6656342
            ------------------------------------------------------------------------------

            Comment


            • #7
              nocons option is not for use with fmb and hence it is ignored.
              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


              • #8
                asreg version 4.2 is now available. To get the new version, type
                Code:
                ssc install asreg, replace
                Thanks to Kit Baum, the updated version of asreg is now available on the SSC. The new version is version: 4.2; Date Jan 31, 2021.
                Following are the key highlights of the new version

                1. Changes made to the window() option
                Version 4.0 of asreg introduces a more flexible window to identify observation in a given range. Previously, the window() option of asreg would take two inputs: the first one as the range variable (such as date) and the second one as the length of the rolling window. In the older versions, the window would always look backward. This has changed in version 4.0.

                The window argument can now take up to three arguments. The window can now look backward, forward, and both back and forward. More details can be read in the help file under the option window()

                2. Improved algorithm for rolling window indices
                This version of asreg (version 4.0) significantly improves the calculation speed of the required statistics, thanks to the development of a more efficient algorithm for extracting rolling window indices. This has resulted in a significant speed advantage for asreg compared to its previous versions or other available programs. The speed efficiency matters more in larger datasets.

                3. Exclude observations with option exclude()
                Option exclude() can be used to exclude specific observations from regressions. This option requires three arguments, with or without using the comma character. The first is the range variable such as daily, weekly, monthly or yearly date; the second and third arguments are the lower and upper bounds of the range variable. The definitions and working of option exclude(rangevar #low #high) are similar to that of the option window(rangevar #from #upto).

                For more discussion and example, visit the asreg webpage https://fintechprofessor.com/2017/12...ions-in-stata/
                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

                Working...
                X