# How to calculate Fama-French factors?

How do I calculate the three factors? The first "market" factor seems straightforward. However the SmB and the HmL factors seem to require accounting data. Also, how does one calculate the momentum factor? Can you write down explicit formulas with clearly defined notation, or provide a reference that describes the canonical calculations?

• To calculate Fama French factors as Fama and French do, you'll need CRSP stock market data and Compustat accounting data. Between their papers and Ken French's website, they're fairly clear. Commented Aug 22, 2017 at 19:37
• @MatthewGunn which paper is this? Commented Aug 22, 2017 at 20:48
• @MatthewGunn also, it is still possible to replicate their calculations even if the data is coming from a different source. I am interested in formulas, and if nobody is willing to provide that, then a specific title of the paper. Then maybe I'll write up something myself. Commented Aug 22, 2017 at 21:15
• The tricky part if you're coming at it from a different data source is matching their universe of stocks precisely. Commented Aug 22, 2017 at 21:18
• @MatthewGunn ah I can see how that'd be a problem Commented Aug 22, 2017 at 21:22

I don't have time to give you a complete, precise answer, but this may help you get going. I'm pulling stuff from various notes I have in places. It's a bit trickier than someone naively might think.

### Ken French's description of their methodology:

The details section of various points in their data library has a bunch of material.

You may also look for papers where Fama and French discuss their three or five factor model. For the three factor model, you might look at "Common Risk Factors in the Returns on Stocks and Bonds," 1993, Journal of Financial Economic.

### Some Compustat calculations to get you going:

• The SQL code I have to calculate book equity from the Compustat annual file is: seq - COALESCE(pstk, 0) + COALESCE(txditc, 0) as be. (Be aware that the last part, adding back deferred taxes txditc has a substantial effect.)
• The SQL code I used to calculate operating profitability is (revt - cogs - COALESCE(tie,0) - COALESCE(xsga,0)) as op_numerator
• Market equity I calculate as csho * prcc_f as me.
• The book to market ratio would then be CASE WHEN (me is NULL) OR (me = 0) THEN NULL ELSE be /me END as beme
• Find some Compustat manual to find what those variables are.

### Sanity checks:

You can see if you're computing market equity, book equity, etc... and oper ating in the same universe of securities by checking whether you can match the percentile breakpoints they compute:

http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html

Canonical references are