How to build a linear factor model