因子模型

Python 投資組合分析入門

Charlotte Werger

Data Scientist

用因子解釋績效

$$

  • 因子用於風險管理。
  • 因子可用來解釋績效。
  • 因子模型將因子與投資組合報酬連結。
  • 有以歷史資料驗證的經驗因子模型。
  • Fama-French 三因子模型是著名的因子模型。
Python 投資組合分析入門

Fama-French 多因子模型

$ $

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

  • MKT 為市場超額報酬,即 $R_m - R_f$。

  • SMB(Small Minus Big)為規模因子。
  • HML(High Minus Low)為價值因子。
Python 投資組合分析入門

回歸模型複習

使用線性迴歸為資料點擬合直線

Python 投資組合分析入門

Beta 與相關的差異

比較 beta 與相關係數的表格

Python 投資組合分析入門

用 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
Python 投資組合分析入門

回歸摘要輸出

# Print out the summary statistics
model.summary()

線性迴歸模型摘要

Python 投資組合分析入門

快速取得 betas

# 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
Python 投資組合分析入門

一起來練習吧!

Python 投資組合分析入門

Preparing Video For Download...