Skip to content

Asset pricing

Factor regressions: CAPM to the six-factor model

An asset's excess returns regressed on the market (CAPM), the Fama-French three or five factors, Carhart's four or the six-factor model: alpha per period and annualized, each beta with Newey-West errors, R-squared, residual volatility and the CAPM's security market line.

Model id
asset_pricing.factor_regression, version 1
Domain
Asset pricing
Evidence
standard
Cost class
light: A short numerical method; a hosted run may take up to 10 seconds.

Formula

rt−rf,t=α+∑kβkfk,t+etr_t - r_{f,t} = \alpha + \sum_{k} \beta_k f_{k,t} + e_tβ^=(X′X)−1X′y,VNW=(X′X)−1S^(X′X)−1\hat\beta = (X'X)^{-1} X'y, \quad V_{\mathrm{NW}} = (X'X)^{-1} \hat S (X'X)^{-1}αannual=P α\alpha_{\text{annual}} = P\,\alphaCAPM: β^m=Cov^(r−rf,fm)Var^(fm)\text{CAPM: } \hat\beta_m = \frac{\widehat{\mathrm{Cov}}(r - r_f, f_m)}{\widehat{\mathrm{Var}}(f_m)}CAPM: E[r]=rf+β^mλm\text{CAPM: } E[r] = r_f + \hat\beta_m \lambda_mσe=e′e/(T−k),σe,annual=P σe\sigma_e = \sqrt{e'e / (T - k)}, \quad \sigma_{e,\text{annual}} = \sqrt{P}\,\sigma_e

Where

rtr_t
The asset's return in period t returns
rf,tr_{f,t}
The risk-free return in period t risk_free
α\alpha
The intercept: the average excess return the factors leave unexplained alpha
βk\beta_k
The beta on factor k
fk,tf_{k,t}
The return of factor k in period t
ete_t
The residual in period t
β^\hat\beta
The estimated coefficients: alpha and the betas
XX
The regressors: a constant and the factors' returns
yy
The asset's excess returns
VNWV_{\mathrm{NW}}
The Newey-West covariance matrix of the coefficients
S^\hat S
The Newey-West estimate of the long-run covariance of the regressors times the residuals
αannual\alpha_{\text{annual}}
Alpha for a year alpha_annualized
PP
Periods in a year periods_per_year
β^m\hat\beta_m
The estimated beta on the market's excess return market_beta
fmf_m
The market's excess return market
λm\lambda_m
The expected market excess return per period market_premium
E[r]E[r]
The security market line's expected return expected_return
rfr_f
The risk-free return per period risk_free_rate
σe\sigma_e
The residuals' standard deviation per period residual_volatility
σe,annual\sigma_{e,\text{annual}}
The residual volatility for a year residual_volatility_annualized
TT
Number of periods observations
kk
In the residual volatility, the number of coefficients; in the sum, the index of a factor

Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.

Variables

Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.

Inputs

CAPM: beta on the market and the security market line (capm): 9 inputs
Inputs of the calculation capm
NameDescription
CovariancecovariancetextStandard errors: 'newey_west' (heteroskedasticity and autocorrelation consistent), 'hc1' (heteroskedasticity consistent) or 'classical'
Lagslagscount · [0, 100]Newey-West lags; left out, Newey and West's rule floor(4 (n/100)^(2/9))
Returnsreturnsreturn (array) · length min 3, max 2520; each [-10, 10]The asset's return each period; its excess return when risk_free is left out
Risk freerisk_freereturn (array) · each [-10, 10]The risk-free return each period, subtracted from returns; leave it out when returns are already excess returns
Marketmarketreturn (array) · length min 3, max 2520; each [-10, 10]The return of the market's excess return (Mkt-RF) each period
Periods per yearperiods_per_yearcount · [1, 366]Periods in a year, to annualize alpha and the residual volatility: 12 for months, 52 for weeks, 252 for trading days
CalculationcalculationtextCAPM: beta on the market and the security market line
Market premiummarket_premiumreturn · [-10, 10]The expected market excess return per period, at which the security market line prices the asset's beta
Risk free raterisk_free_ratereturn · [-1, 10]The risk-free return per period the security market line starts from; at 0 its expected return is the excess return
Fama-French three factors: market, size and value (ff3): 9 inputs
Inputs of the calculation ff3
NameDescription
CovariancecovariancetextStandard errors: 'newey_west' (heteroskedasticity and autocorrelation consistent), 'hc1' (heteroskedasticity consistent) or 'classical'
Lagslagscount · [0, 100]Newey-West lags; left out, Newey and West's rule floor(4 (n/100)^(2/9))
Returnsreturnsreturn (array) · length min 3, max 2520; each [-10, 10]The asset's return each period; its excess return when risk_free is left out
Risk freerisk_freereturn (array) · each [-10, 10]The risk-free return each period, subtracted from returns; leave it out when returns are already excess returns
Marketmarketreturn (array) · length min 3, max 2520; each [-10, 10]The return of the market's excess return (Mkt-RF) each period
Periods per yearperiods_per_yearcount · [1, 366]Periods in a year, to annualize alpha and the residual volatility: 12 for months, 52 for weeks, 252 for trading days
CalculationcalculationtextFama-French three factors: market, size and value
Sizesizereturn (array) · length min 3, max 2520; each [-10, 10]The return of the size factor (SMB) each period
Valuevaluereturn (array) · length min 3, max 2520; each [-10, 10]The return of the value factor (HML) each period
Carhart four factors: the three and momentum (carhart): 10 inputs
Inputs of the calculation carhart
NameDescription
CovariancecovariancetextStandard errors: 'newey_west' (heteroskedasticity and autocorrelation consistent), 'hc1' (heteroskedasticity consistent) or 'classical'
Lagslagscount · [0, 100]Newey-West lags; left out, Newey and West's rule floor(4 (n/100)^(2/9))
Returnsreturnsreturn (array) · length min 3, max 2520; each [-10, 10]The asset's return each period; its excess return when risk_free is left out
Risk freerisk_freereturn (array) · each [-10, 10]The risk-free return each period, subtracted from returns; leave it out when returns are already excess returns
Marketmarketreturn (array) · length min 3, max 2520; each [-10, 10]The return of the market's excess return (Mkt-RF) each period
Periods per yearperiods_per_yearcount · [1, 366]Periods in a year, to annualize alpha and the residual volatility: 12 for months, 52 for weeks, 252 for trading days
CalculationcalculationtextCarhart four factors: the three and momentum
Sizesizereturn (array) · length min 3, max 2520; each [-10, 10]The return of the size factor (SMB) each period
Valuevaluereturn (array) · length min 3, max 2520; each [-10, 10]The return of the value factor (HML) each period
Momentummomentumreturn (array) · length min 3, max 2520; each [-10, 10]The return of the momentum factor (Mom, UMD) each period
Fama-French five factors: market, size, value, profitability and investment (ff5): 11 inputs
Inputs of the calculation ff5
NameDescription
CovariancecovariancetextStandard errors: 'newey_west' (heteroskedasticity and autocorrelation consistent), 'hc1' (heteroskedasticity consistent) or 'classical'
Lagslagscount · [0, 100]Newey-West lags; left out, Newey and West's rule floor(4 (n/100)^(2/9))
Returnsreturnsreturn (array) · length min 3, max 2520; each [-10, 10]The asset's return each period; its excess return when risk_free is left out
Risk freerisk_freereturn (array) · each [-10, 10]The risk-free return each period, subtracted from returns; leave it out when returns are already excess returns
Marketmarketreturn (array) · length min 3, max 2520; each [-10, 10]The return of the market's excess return (Mkt-RF) each period
Periods per yearperiods_per_yearcount · [1, 366]Periods in a year, to annualize alpha and the residual volatility: 12 for months, 52 for weeks, 252 for trading days
CalculationcalculationtextFama-French five factors: market, size, value, profitability and investment
Sizesizereturn (array) · length min 3, max 2520; each [-10, 10]The return of the size factor (SMB) each period
Valuevaluereturn (array) · length min 3, max 2520; each [-10, 10]The return of the value factor (HML) each period
Profitabilityprofitabilityreturn (array) · length min 3, max 2520; each [-10, 10]The return of the profitability factor (RMW) each period
Investmentinvestmentreturn (array) · length min 3, max 2520; each [-10, 10]The return of the investment factor (CMA) each period
Fama-French six factors: the five and momentum (ff6): 12 inputs
Inputs of the calculation ff6
NameDescription
CovariancecovariancetextStandard errors: 'newey_west' (heteroskedasticity and autocorrelation consistent), 'hc1' (heteroskedasticity consistent) or 'classical'
Lagslagscount · [0, 100]Newey-West lags; left out, Newey and West's rule floor(4 (n/100)^(2/9))
Returnsreturnsreturn (array) · length min 3, max 2520; each [-10, 10]The asset's return each period; its excess return when risk_free is left out
Risk freerisk_freereturn (array) · each [-10, 10]The risk-free return each period, subtracted from returns; leave it out when returns are already excess returns
Marketmarketreturn (array) · length min 3, max 2520; each [-10, 10]The return of the market's excess return (Mkt-RF) each period
Periods per yearperiods_per_yearcount · [1, 366]Periods in a year, to annualize alpha and the residual volatility: 12 for months, 52 for weeks, 252 for trading days
CalculationcalculationtextFama-French six factors: the five and momentum
Sizesizereturn (array) · length min 3, max 2520; each [-10, 10]The return of the size factor (SMB) each period
Valuevaluereturn (array) · length min 3, max 2520; each [-10, 10]The return of the value factor (HML) each period
Profitabilityprofitabilityreturn (array) · length min 3, max 2520; each [-10, 10]The return of the profitability factor (RMW) each period
Investmentinvestmentreturn (array) · length min 3, max 2520; each [-10, 10]The return of the investment factor (CMA) each period
Momentummomentumreturn (array) · length min 3, max 2520; each [-10, 10]The return of the momentum factor (Mom, UMD) each period

Outputs

CAPM: beta on the market and the security market line (capm): 15 outputs
Outputs of the calculation capm
NameDescription
Alphaalphareturn · [-1e+09, 1e+09]The intercept: the average excess return the factors leave
Alpha annualizedalpha_annualizedreturn · [-3.66e+11, 3.66e+11]Alpha times the periods in a year
Alpha standard erroralpha_standard_errorreturn · [0, 1e+09]The standard error of alpha per period
Alpha t statisticalpha_t_statisticratio · [-1e+09, 1e+09]Alpha over its standard error; None for a fit exact to rounding
Market betamarket_betaratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF)
Market beta standard errormarket_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the market's excess return (Mkt-RF)
Market beta t statisticmarket_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF) over its standard error; None for a fit exact to rounding
R squaredr_squaredratio · [0, 1]R-squared; None when the excess return does not vary
Residual volatilityresidual_volatilityvolatility · [0, 10000]The residuals' standard deviation per period, sqrt(e'e / (T - k))
Residual volatility annualizedresidual_volatility_annualizedvolatility · [0, 191311]The residual volatility times the root of the periods in a year
Observationsobservationscount · [3, 2520]Periods in the regression
HAC lagshac_lagscount · [0, 100]Newey-West lags used; 0 for the others
CalculationcalculationtextCAPM: beta on the market and the security market line
Expected excess returnexpected_excess_returnreturn · [-1e+10, 1e+10]The security market line's excess return for the beta: beta times the market premium, per period
Expected returnexpected_returnreturn · [-1e+10, 1e+10]The security market line's expected return: the risk-free rate plus the excess return, per period
Fama-French three factors: market, size and value (ff3): 19 outputs
Outputs of the calculation ff3
NameDescription
Alphaalphareturn · [-1e+09, 1e+09]The intercept: the average excess return the factors leave
Alpha annualizedalpha_annualizedreturn · [-3.66e+11, 3.66e+11]Alpha times the periods in a year
Alpha standard erroralpha_standard_errorreturn · [0, 1e+09]The standard error of alpha per period
Alpha t statisticalpha_t_statisticratio · [-1e+09, 1e+09]Alpha over its standard error; None for a fit exact to rounding
Market betamarket_betaratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF)
Market beta standard errormarket_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the market's excess return (Mkt-RF)
Market beta t statisticmarket_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF) over its standard error; None for a fit exact to rounding
R squaredr_squaredratio · [0, 1]R-squared; None when the excess return does not vary
Residual volatilityresidual_volatilityvolatility · [0, 10000]The residuals' standard deviation per period, sqrt(e'e / (T - k))
Residual volatility annualizedresidual_volatility_annualizedvolatility · [0, 191311]The residual volatility times the root of the periods in a year
Observationsobservationscount · [3, 2520]Periods in the regression
HAC lagshac_lagscount · [0, 100]Newey-West lags used; 0 for the others
Size betasize_betaratio · [-1e+09, 1e+09]The beta on the size factor (SMB)
Size beta standard errorsize_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the size factor (SMB)
Size beta t statisticsize_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the size factor (SMB) over its standard error; None for a fit exact to rounding
Value betavalue_betaratio · [-1e+09, 1e+09]The beta on the value factor (HML)
Value beta standard errorvalue_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the value factor (HML)
Value beta t statisticvalue_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the value factor (HML) over its standard error; None for a fit exact to rounding
CalculationcalculationtextFama-French three factors: market, size and value
Carhart four factors: the three and momentum (carhart): 22 outputs
Outputs of the calculation carhart
NameDescription
Alphaalphareturn · [-1e+09, 1e+09]The intercept: the average excess return the factors leave
Alpha annualizedalpha_annualizedreturn · [-3.66e+11, 3.66e+11]Alpha times the periods in a year
Alpha standard erroralpha_standard_errorreturn · [0, 1e+09]The standard error of alpha per period
Alpha t statisticalpha_t_statisticratio · [-1e+09, 1e+09]Alpha over its standard error; None for a fit exact to rounding
Market betamarket_betaratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF)
Market beta standard errormarket_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the market's excess return (Mkt-RF)
Market beta t statisticmarket_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF) over its standard error; None for a fit exact to rounding
R squaredr_squaredratio · [0, 1]R-squared; None when the excess return does not vary
Residual volatilityresidual_volatilityvolatility · [0, 10000]The residuals' standard deviation per period, sqrt(e'e / (T - k))
Residual volatility annualizedresidual_volatility_annualizedvolatility · [0, 191311]The residual volatility times the root of the periods in a year
Observationsobservationscount · [3, 2520]Periods in the regression
HAC lagshac_lagscount · [0, 100]Newey-West lags used; 0 for the others
Size betasize_betaratio · [-1e+09, 1e+09]The beta on the size factor (SMB)
Size beta standard errorsize_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the size factor (SMB)
Size beta t statisticsize_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the size factor (SMB) over its standard error; None for a fit exact to rounding
Value betavalue_betaratio · [-1e+09, 1e+09]The beta on the value factor (HML)
Value beta standard errorvalue_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the value factor (HML)
Value beta t statisticvalue_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the value factor (HML) over its standard error; None for a fit exact to rounding
CalculationcalculationtextCarhart four factors: the three and momentum
Momentum betamomentum_betaratio · [-1e+09, 1e+09]The beta on the momentum factor (Mom, UMD)
Momentum beta standard errormomentum_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the momentum factor (Mom, UMD)
Momentum beta t statisticmomentum_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the momentum factor (Mom, UMD) over its standard error; None for a fit exact to rounding
Fama-French five factors: market, size, value, profitability and investment (ff5): 25 outputs
Outputs of the calculation ff5
NameDescription
Alphaalphareturn · [-1e+09, 1e+09]The intercept: the average excess return the factors leave
Alpha annualizedalpha_annualizedreturn · [-3.66e+11, 3.66e+11]Alpha times the periods in a year
Alpha standard erroralpha_standard_errorreturn · [0, 1e+09]The standard error of alpha per period
Alpha t statisticalpha_t_statisticratio · [-1e+09, 1e+09]Alpha over its standard error; None for a fit exact to rounding
Market betamarket_betaratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF)
Market beta standard errormarket_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the market's excess return (Mkt-RF)
Market beta t statisticmarket_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF) over its standard error; None for a fit exact to rounding
R squaredr_squaredratio · [0, 1]R-squared; None when the excess return does not vary
Residual volatilityresidual_volatilityvolatility · [0, 10000]The residuals' standard deviation per period, sqrt(e'e / (T - k))
Residual volatility annualizedresidual_volatility_annualizedvolatility · [0, 191311]The residual volatility times the root of the periods in a year
Observationsobservationscount · [3, 2520]Periods in the regression
HAC lagshac_lagscount · [0, 100]Newey-West lags used; 0 for the others
Size betasize_betaratio · [-1e+09, 1e+09]The beta on the size factor (SMB)
Size beta standard errorsize_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the size factor (SMB)
Size beta t statisticsize_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the size factor (SMB) over its standard error; None for a fit exact to rounding
Value betavalue_betaratio · [-1e+09, 1e+09]The beta on the value factor (HML)
Value beta standard errorvalue_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the value factor (HML)
Value beta t statisticvalue_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the value factor (HML) over its standard error; None for a fit exact to rounding
Profitability betaprofitability_betaratio · [-1e+09, 1e+09]The beta on the profitability factor (RMW)
Profitability beta standard errorprofitability_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the profitability factor (RMW)
Profitability beta t statisticprofitability_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the profitability factor (RMW) over its standard error; None for a fit exact to rounding
Investment betainvestment_betaratio · [-1e+09, 1e+09]The beta on the investment factor (CMA)
Investment beta standard errorinvestment_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the investment factor (CMA)
Investment beta t statisticinvestment_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the investment factor (CMA) over its standard error; None for a fit exact to rounding
CalculationcalculationtextFama-French five factors: market, size, value, profitability and investment
Fama-French six factors: the five and momentum (ff6): 28 outputs
Outputs of the calculation ff6
NameDescription
Alphaalphareturn · [-1e+09, 1e+09]The intercept: the average excess return the factors leave
Alpha annualizedalpha_annualizedreturn · [-3.66e+11, 3.66e+11]Alpha times the periods in a year
Alpha standard erroralpha_standard_errorreturn · [0, 1e+09]The standard error of alpha per period
Alpha t statisticalpha_t_statisticratio · [-1e+09, 1e+09]Alpha over its standard error; None for a fit exact to rounding
Market betamarket_betaratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF)
Market beta standard errormarket_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the market's excess return (Mkt-RF)
Market beta t statisticmarket_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the market's excess return (Mkt-RF) over its standard error; None for a fit exact to rounding
R squaredr_squaredratio · [0, 1]R-squared; None when the excess return does not vary
Residual volatilityresidual_volatilityvolatility · [0, 10000]The residuals' standard deviation per period, sqrt(e'e / (T - k))
Residual volatility annualizedresidual_volatility_annualizedvolatility · [0, 191311]The residual volatility times the root of the periods in a year
Observationsobservationscount · [3, 2520]Periods in the regression
HAC lagshac_lagscount · [0, 100]Newey-West lags used; 0 for the others
Size betasize_betaratio · [-1e+09, 1e+09]The beta on the size factor (SMB)
Size beta standard errorsize_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the size factor (SMB)
Size beta t statisticsize_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the size factor (SMB) over its standard error; None for a fit exact to rounding
Value betavalue_betaratio · [-1e+09, 1e+09]The beta on the value factor (HML)
Value beta standard errorvalue_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the value factor (HML)
Value beta t statisticvalue_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the value factor (HML) over its standard error; None for a fit exact to rounding
Profitability betaprofitability_betaratio · [-1e+09, 1e+09]The beta on the profitability factor (RMW)
Profitability beta standard errorprofitability_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the profitability factor (RMW)
Profitability beta t statisticprofitability_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the profitability factor (RMW) over its standard error; None for a fit exact to rounding
Investment betainvestment_betaratio · [-1e+09, 1e+09]The beta on the investment factor (CMA)
Investment beta standard errorinvestment_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the investment factor (CMA)
Investment beta t statisticinvestment_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the investment factor (CMA) over its standard error; None for a fit exact to rounding
CalculationcalculationtextFama-French six factors: the five and momentum
Momentum betamomentum_betaratio · [-1e+09, 1e+09]The beta on the momentum factor (Mom, UMD)
Momentum beta standard errormomentum_beta_standard_errorratio · [0, 1e+09]The standard error of the beta on the momentum factor (Mom, UMD)
Momentum beta t statisticmomentum_beta_t_statisticratio · [-1e+09, 1e+09]The beta on the momentum factor (Mom, UMD) over its standard error; None for a fit exact to rounding

Calculator

Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.

Live data runs on your own computer only

This model reads Market excess return, three-factor file, monthly, Size factor (SMB), three-factor file, monthly, Value factor (HML), monthly, Momentum factor (Mom), monthly, Risk-free return, monthly, Profitability factor (RMW), monthly and Investment factor (CMA), monthly. Their source, Ken French Data Library, lets pyeconomics read the data on your own computer but not serve them from this website.

Here, enter your own values, or bring them as a file with "Use my own data". To run this page with every profile's live data, install the local app and start it: pip install "pyeconomics[app]" then pyeconomics serve.

Loading the calculator…

Worked example

Ten months of returns, with a 0.5% monthly market premium.

Example capm_ten_months. Inputs:

{
  "calculation": "capm",
  "covariance": "newey_west",
  "lags": null,
  "market": [
    0.018, -0.02, 0.03, 0.006,
    -0.025, 0.012, 0.022, -0.006,
    0.009, 0.016
  ],
  "market_premium": 0.005,
  "periods_per_year": 12,
  "returns": [
    0.021, -0.013, 0.034, 0.008,
    -0.022, 0.015, 0.027, -0.004,
    0.012, 0.019
  ],
  "risk_free": [
    0.004, 0.004, 0.004, 0.0045,
    0.0045, 0.0045, 0.0042, 0.0042,
    0.0041, 0.0041
  ],
  "risk_free_rate": 0.004
}

Outputs:

{
  "alpha": -0.0006540598290598281,
  "alpha_annualized": -0.007848717948717937,
  "alpha_standard_error": 0.0006274306085822509,
  "alpha_t_statistic": -1.0424416981150295,
  "calculation": "capm",
  "expected_excess_return": 0.004954886958919219,
  "expected_return": 0.008954886958919219,
  "hac_lags": 2,
  "market_beta": 0.9909773917838437,
  "market_beta_standard_error": 0.03415614849404933,
  "market_beta_t_statistic": 29.013148012179748,
  "observations": 10,
  "r_squared": 0.9918642476103335,
  "residual_volatility": 0.0017092684150280873,
  "residual_volatility_annualized": 0.005921079477202747
}

Assumptions

  • The factors are excess returns of traded portfolios over the same periods as the asset's returns, and the betas are constant over the sample.
  • The coefficients are least squares; Newey-West errors use Bartlett weights with no small-sample correction and, with no lag given, floor(4 (T/100)^(2/9)) lags.
  • Alpha is annualized by multiplying it by the periods in a year, the residual volatility by their square root: arithmetic scaling, not compounding.
  • Profiles: default binds 60 months of the Ken French three-factor file's market, size and value factors, the momentum factor and the risk-free return (capm, ff3 and carhart); ff5 binds the five-factor file's market, size, profitability and investment factors with the same value, momentum and risk-free series (ff5 and ff6). The asset's returns are the user's own: supply the same 60 months.

Limitations

  • A factor that barely varies, or factors collinear to working precision, leave the betas unidentified: DomainError, as for an estimate beyond 1e9 in size.
  • Alpha measures performance against the chosen factors only; it says nothing about factors left out, and the t statistics are only as good as the error model behind them.
  • The Ken French factors are library-only: fetched at run time from the Data Library and never stored. A bound window ends at the library's latest month on or before the date; the asset's returns must cover the same months, which the data-source records name.
  • A profile binds the files' factors only for the calculations it names: bind ff5 and ff6 with profile='ff5', whose size factor is the five-factor file's.

Evidence

Status: standard. Textbook consensus, such as bond duration or the CAPM formula.

Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).

Syllabus

The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.

Data

This model can read its data for you: each bound field names a data series, and the sources listed can fill it, in the order they are tried. This website reads only the sources whose terms let it serve their data (marked "hosted"); every source is available when you run pyeconomics on your own computer.

Profile: Default
FieldConceptRead asSources (licence class; hosted)
marketMarket excess return, three-factor file, monthlyfactors.ff3_market.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
sizeSize factor (SMB), three-factor file, monthlyfactors.ff3_smb.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
valueValue factor (HML), monthlyfactors.ff3_hml.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
momentumMomentum factor (Mom), monthlyfactors.mom.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
risk_freeRisk-free return, monthlyfactors.risk_free.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
Profile: Fama-French five factors (ff5)
FieldConceptRead asSources (licence class; hosted)
marketMarket excess return, five-factor file, monthlyfactors.ff5_market.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
sizeSize factor (SMB), five-factor file, monthlyfactors.ff5_smb.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
valueValue factor (HML), monthlyfactors.ff3_hml.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
profitabilityProfitability factor (RMW), monthlyfactors.ff5_rmw.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
investmentInvestment factor (CMA), monthlyfactors.ff5_cma.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
momentumMomentum factor (Mom), monthlyfactors.mom.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)
risk_freeRisk-free return, monthlyfactors.risk_free.us.monthlythe last 60 observations on or before the date; real time: as published by the date
  • Ken French Data Library (library-only; not hosted)

Citations

  1. Sharpe, W. F. (1964). Capital Asset Prices: A Theory of Market Equilibrium under Conditions of Risk. The Journal of Finance, 19(3), 425-442. doi:10.1111/j.1540-6261.1964.tb02865.x (The expected return of an asset in equilibrium, linear in its beta)
  2. Lintner, J. (1965). The Valuation of Risk Assets and the Selection of Risky Investments in Stock Portfolios and Capital Budgets. The Review of Economics and Statistics, 47(1), 13-37. doi:10.2307/1924119 (Expected returns linear in the covariance with the market)
  3. Fama, E. F. and French, K. R. (1993). Common risk factors in the returns on stocks and bonds. Journal of Financial Economics, 33(1), 3-56. doi:10.1016/0304-405X(93)90023-5 (The three-factor time-series regressions of excess returns)
  4. Carhart, M. M. (1997). On Persistence in Mutual Fund Performance. The Journal of Finance, 52(1), 57-82. doi:10.1111/j.1540-6261.1997.tb03808.x (The four-factor model: the three and one-year momentum)
  5. Fama, E. F. and French, K. R. (2015). A five-factor asset pricing model. Journal of Financial Economics, 116(1), 1-22. doi:10.1016/j.jfineco.2014.10.010 (The five-factor time-series regression)
  6. Fama, E. F. and French, K. R. (2018). Choosing factors. Journal of Financial Economics, 128(2), 234-252. doi:10.1016/j.jfineco.2018.02.012 (The six-factor model: the five and momentum)
  7. Newey, W. K. and West, K. D. (1987). A simple, positive semi-definite, heteroskedasticity and autocorrelation consistent covariance matrix. Econometrica, 55(3), 703-708. doi:10.2307/1913610 (Bartlett weights 1 - j / (L + 1))
  8. French, K. R. Data Library: the Fama/French factors and the momentum factor, monthly. Tuck School of Business, Dartmouth College. https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html (Fama/French 3 Factors, Fama/French 5 Factors (2x3) and Momentum Factor)

Changelog

  • Version 1: First version.

Use it elsewhere

Documentation
The model's reference page
REST API
GET or POST /v1/models/asset_pricing.factor_regression/run
MCP tool
run_model with the model's id, asset_pricing.factor_regression. Connect an assistant
Command line
pyeconomics models run asset_pricing.factor_regression --help

The worked example, from Python and from the command line:

Python
import pyeconomics

inputs = {
    "calculation": "capm",
    "covariance": "newey_west",
    "lags": None,
    "market": [
        0.018, -0.02, 0.03, 0.006,
        -0.025, 0.012, 0.022,
        -0.006, 0.009, 0.016,
    ],
    "market_premium": 0.005,
    "periods_per_year": 12,
    "returns": [
        0.021, -0.013, 0.034, 0.008,
        -0.022, 0.015, 0.027,
        -0.004, 0.012, 0.019,
    ],
    "risk_free": [
        0.004, 0.004, 0.004, 0.0045,
        0.0045, 0.0045, 0.0042,
        0.0042, 0.0041, 0.0041,
    ],
    "risk_free_rate": 0.004,
}
result = pyeconomics.run("asset_pricing.factor_regression", inputs)
print(result.to_json())
Command line
pyeconomics models run asset_pricing.factor_regression --inputs - <<'JSON'
{
  "calculation": "capm",
  "covariance": "newey_west",
  "lags": null,
  "market": [
    0.018, -0.02, 0.03, 0.006,
    -0.025, 0.012, 0.022, -0.006,
    0.009, 0.016
  ],
  "market_premium": 0.005,
  "periods_per_year": 12,
  "returns": [
    0.021, -0.013, 0.034, 0.008,
    -0.022, 0.015, 0.027, -0.004,
    0.012, 0.019
  ],
  "risk_free": [
    0.004, 0.004, 0.004, 0.0045,
    0.0045, 0.0045, 0.0042, 0.0042,
    0.0041, 0.0041
  ],
  "risk_free_rate": 0.004
}
JSON