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 attaullah.shah@imsciences.edu.pk
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    www.FinTechProfessor.com
    If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

  • #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.
    Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    www.FinTechProfessor.com
    If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

    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.
        Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        www.FinTechProfessor.com
        If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

        Comment


        • #5
          Thank you so much Mr. Shah for your help.

          Comment

          Working...
          X