0%

【Factor analysis】 Vol. 3. Construct your own factor

Previous reading

After we got the fundamental data we needed from any data source you preferred or paid as in the previous post, we’re now going to generate factors to be used in the factor analysis.

What is factor?

Do you still remember the survey data that was collected by the Minister in the story mentioned in our first post in the series?

Degree of Happiness (0~100) Gender Age Occupation Location Income Marital Status Number of social gathering per week
60 male 28 miner village A $2,000 single 2
80 female 32 housewife village B $100 married 5
77 male 63 retired village C $500 divorced 12
58 female 22 OL village A $1,300 in a relationship 7

The objective we’re trying to solve here is to understand how happy the people in the country are. Then the other data such as gender, age, occupation, location, … are what we called factors. Factors are quantified traits that we use to describe the objective. Take the survey data above as an example, you might come to the conclusion that the people from a certain location would be happier than the people from another location, or people whose income level is higher tend to be happier than people whose income level is lower. By combining all the influences of all factors, then we’ll get this final formula as below:

where

  • $b_1, b_2, … b_n$ are coefficients, could be any natural number (positive/negative)
  • *$\alpha$ stands for the part of degree of happiness that cannot be explained by given factors

Common factors in the stock market

The application of factor analysis to the stock market would be similar, and we have explained this in the first post in this series. The formula would look like this:

The existing factors can be categorized but not limited to the below types:

  • Fundamental factors
    • Fundamental factors are extracted directly from the company report. They directly present how the company operates from the official accounting book.
    • Ex: net working capital, total profit, EBIT, EBITDA, total asset, total debt, … etc.
  • Quality factors
    • Quality factors are derived from fundamental factors to represent the ability to make a profit for a company. The more profit a company can make, the better the quality of this company is the central assumption of this type of factors.
    • Ex: net profit ratio, debt to equity ratio, net profit to operate revenue TTM, … etc.
  • Momentum factors
    • The momentum factors is a relatively new type of factor comparing to the rest. According to the explanation of financial behavior, the high and low of this factor are actually generated by the behavior of the majority of the investors at the moment. In other words, it implicitly explains the trend of the stock price.
    • Ex: 60-day price rate of change, turnover rate, … etc.
  • Technical factors
    • This type of factor is produced from technical analysis and theory from scholars. The MACD indicator that we introduced before is also one of the technical factors.
    • MACD indicator, Bollinger bands, EMAC indicator, KDJ indicator, … etc.
  • Alternative factors
    • As the realm of machine learning started to thrive these years, there are more and more alternative data that we can utilize and analyze. From the area of the oilfield captured by satellite to every single tweet that tweets about certain stock on Twitter, they can all be captured and processed to quantified indicators to represent the change of emotion/economy over time.
    • Ex: Twitter sentiment data

How we can get the factors above?

  • Quantitative platforms would provide their proprietary tool or service for professional investors to access.
    • JQData is a China-based service that allows you to download the local python package for you to fetch data over the internet.
  • Paid data sources are also accountable services that provide a wild range of alternative data as well.
    • Quandl is famous for aggregating APIs from various data brokers.
    • Factset is a traditional data broker since 1978, and big companies such as Barclay and J.P Morgan are also using their service.
  • Build one yourself. You can download the raw financial data from anywhere and build the factors upon it.

Below, I’m going to quickly demonstrate the third way and build the factor data with the data we downloaded in the previous post.

Notebook: Build your own factors from the downloaded data

Enjoy reading? Some donations would motivate me to produce more quality content