Factor models

Introduction to Portfolio Analysis in Python

Charlotte Werger

Data Scientist

Using factors to explain performance

$$

  • Factors are used for risk management.
  • Factors are used to help explain performance.
  • Factor models help you relate factors to portfolio returns
  • Empirical factor models exist that have been tested on historic data.
  • Fama French 3 factor model is a well-known factor model.
Introduction to Portfolio Analysis in Python

Fama French Multi Factor model

$ $

  • $ R_{pf} = \alpha + \beta_m MKT + \beta_s SMB + \beta_h HML $

  • MKT is the excess return of the market, i.e. $R_m - R_f$

  • SMB (Small Minus Big) a size factor
  • HML (High Minus Low) a value factor
Introduction to Portfolio Analysis in Python

Regression model refresher

Fitting a line to data points using linear regression

Introduction to Portfolio Analysis in Python

Difference between beta and correlation

Table comparing beta to correlation

Introduction to Portfolio Analysis in Python

Regression model in Python

import statsmodels.api as sm
# Define the model
model = sm.OLS(factor_data['sp500'],
               factor_data[['momentum','value']]).fit()
# Get the model predictions
predictions = model.predict(factor_data[['momentum','value']])
b1, b2 = model.params
Introduction to Portfolio Analysis in Python

The regression summary output

# Print out the summary statistics
model.summary()

Linear regression model summary

Introduction to Portfolio Analysis in Python

Obtaining betas quickly

# Get just beta coefficients from linear regression model
b1, b2 = regression.linear_model.OLS(df['returns'], 
                          df[['F1', 'F2']]).fit().params
# Print the coefficients 
print 'Sensitivities of active returns to factors:
                \nF1: %f\nF2: %f' %  (b1, b2)
Sensitivities of active returns to factors:
F1: -0.0381
F2: 0.9858
Introduction to Portfolio Analysis in Python

Let's practice!

Introduction to Portfolio Analysis in Python

Preparing Video For Download...