famafrench.FamaFrench.getFactorRegResults

FamaFrench.getFactorRegResults(self, ffmodel, boolRVar, scholeswilliams, roll_window, min_per, freq, dt_start, dt_end)[source]

Estimate factor-based quantities of risk (specifically, market betas) as well as residuals using rolling regressions. Rolling regressions require a fixed rolling window w/ a minimum number of observations within each window.

Parameters
  • ffmodel (str) –

    Possible choices include:

    • capm : Market (CAPM) model

      \(R_{t}^{i} - R_{t}^{f} = \alpha _{i} + \beta^{Mkt}_{i}\left(R_{t}^{M}-R_{t}^{f}\right) +\varepsilon _{t}^{i}\)

    • ff3 : Fama-French 3 factor model

      \(R_{t}^{i} - R_{t}^{f} = \alpha _{i} + \beta^{Mkt}_{i}\left(R_{t}^{M}-R_{t}^{f}\right) + \beta^{SMB}_{i}R_{t}^{SMB} + \beta^{HML}_{i}R_{t}^{HML} + \varepsilon _{t}^{i}\)

  • boolRvar (bool) – Flag for choosing whether to calculate the variance of residuals (boolRvar = True) or the market betas estimated from a specified factor model ffmode (boolRvar = False).

  • scholeswilliams (bool) –

    Flag for choosing whether to implement the Dimson (1979) methodology - based on Scholes-Williams (1977) - for estimating betas in the presence of infrequent trading. The methodology used here as well as in Fama-French (1993) estimates betas by summing coefficient estimates pertaining to lagged and coincident market return variables adjusted for auto-correlation of the market return variables:

    \[\widehat{\beta^{Mkt}}_{t, Dimson} = \frac{\left(\widehat{\beta^{Mkt}}_{t} + \widehat{\beta^{Mkt}}_{t-1}\right)}{\left(1 + 2\widehat{\rho}\right)}\]
    • \(\widehat{\beta^{Mkt}}_{t}\) : OLS beta with the contemporaneous return of the market portfolio

    • \(\widehat{\beta^{Mkt}}_{t-1}\) : OLS beta with the return on the market portfolio lagged one period

    • \(\widehat{\rho}\) : First-order autocorrelation coefficient of the return on the market.

    Otherwise, factor market betas are estimated in the usual sense using coincident market return variables.

  • roll_window (int) – Fixed size of the rolling (moving) window. This is the number of observations used for calculating the factor betas or the residual variances from factor models.

  • min_per (int) – Minimum number of observations in each window necessary to have an estimated value.

  • freq (str) –

    Observation frequency. Possible choices are:

    • D : daily

    • W : weekly

    • M : monthly

    • Q : quarterly (3-months)

    • A : annual

  • dt_start (datetime.date) – Starting date for the dataset queried or locally retrieved.

  • dt_end (datetime.date) – Ending date for the dataset queried or locally retrieved.

Returns

dfresVar, dfbeta – Dataset containing the panel of market betas OR residual variances estimated from rolling regressions.

Return type

pandas.DataFrame

Note

This routine uses Numba, an opens-source just-in-time (JIT) compiler that translates a subset of Python and NumPy into fast machine code using the LLVM compiler written in C++. Using Numba a gives us C++/Fortran-like speed when estimating the rolling regressions. More details in source code utilizing Numba.

Todo

Extend the Dimson (1979) methodology based on Scholes and Williams (1977) to other factor quantities of risk beyond the market (CAPM) beta (eg, SMB and HML quantities of risk)

References

  • Scholes, Myron and Williams, Joseph. (1977). Estimating betas from nonsynchronous data, Journal of Financial Economics, (5)3, pp.309-327

  • Dimson, Elroy. (1979). Risk measurement when shares are subject to infrequent trading, Journal of Financial Economics, (7)2, pp.197-226

  • Fama, Eugene F., and Kenneth R. French. (1992). The Cross-section of Expected Stock Returns, Journal of Finance, 47(2), pp.427-465