Quant Investment — How I built my first Factor Model with panel data

Eric Chen, CFA, FRM
6 min readMay 20, 2024

Remember when I was doing my Quantitative Finance major at grad school, one of the very first model introduced was Fama-French (just in case you are not familiar with it, here is a link where they host the factors live to date.)

I thought it was too straightforward and not even worth a hands on lab session until years later in practice professionals are interviewing about factor models and smart beta. I would go into interviews thinking it’s a simple regression, but when it’s asked to the details about how one takes into account of historical time series returns and how do you ensure the series are not autocorrelated (when the error terms are correlated) or not heteroskedastic (when the variance of error terms is not constant), I realized it’s worth digging further. Not to mention these days you can see quite some strategies that are utilizing smart beta, so a hands on experience is definitely needed. In this article, I’m going to demonstrate how I built my factor model based on the Fama-Macbeth five factor model with panel data that’s vertically time series and horizontally cross sections.

Step 1 — Five Risk Factors

Fama-French provides the latest risk factors through their website API, and we are going to one of my favorite data collection package in Pandas to gather the data, pandas_datareader. In this example, I’ll be demonstrating using Fama/French 5 Research Factors (2x3).

--

--