Analyzing Factor Performance with Alphalens: The Value Factors Edition

Alphalens

Photo by Chris Liverani on Unsplash 

Key Highlights of This Article 

  • Introduction to Alphalens and Overview of Value Factors
  • Synthesizing Value Factors and Using Alphalens to Analyze Factor Performance

Introduction 

In investing, factor strategies are an indispensable tool, whether you’re an experienced professional trader or a newcomer to the market. The essence of factor strategies lies in leveraging quantitative analysis to distill the market’s complex movements into key driving forces. These strategies help investors capture market trends and enhance investment efficiency. Factors can analyze market behavior and serve as a reliable foundation for asset allocation and risk management strategies.

This series of articles uses Alphalens to examine the application and effectiveness of various factors in the market. In previous articles, we analyzed “foreign capital factors,” exploring how foreign investments influence the market. This article will focus on “value factors,” examining valuation-related indicators that reveal intrinsic value and affect long-term returns. The final article will discuss “price-volume factors,” delving into the relationship between price and trading volume and uncovering investment opportunities.

If you want to conduct similar factor analyses, you can use the alphalens-tej tool within TQuant Lab. This tool not only integrates TEJ data but also eliminates tedious data processing, allowing you to easily assess factor performance and further support the development of investment strategies.

What Are Value Factors? 

In the investment market, value factors are essential tools for measuring the intrinsic value of assets. They are typically associated with a company’s fundamental indicators, such as Price-to-Earnings ratio (P/E), Price-to-Book ratio (P/B), and Dividend Yield. These metrics reflect the market’s expectations of a company’s future growth and profitability and are widely used to determine whether an asset is undervalued or overvalued. By applying value factors in investment strategies, investors can analyze valuation differences across companies and potentially achieve excess returns by holding relatively undervalued assets.

Factors Used in This Article:

BPROE_quantile

Calculation Formulas:

  • Inverse PB Ranking: Rank each stock based on its Price-to-Book (PB) ratio using percentile rankings, then take the inverse of the ranking.
  • ROE Ranking: Rank each stock based on its Return on Equity (ROE) using percentile rankings.
  • Sum of Rankings: Add the inverse PB ranking and the ROE ranking to calculate the final composite factor value.

Inverse Price-to-Earnings Ratio

Calculation Formulas:

Company Market Capitalization Divided by Parent Company Net Profit (Inverse)

The PB and market capitalization data used in this article are sourced from the TEJAPI “Trading Data – Stock Price Data” table (TWN/APIPRCD), specifically the columns “Price-to-Book Ratio” and “Individual Stock Market Value (NTD).”

The ROE and parent company net profit data are sourced from the TEJAPI “Financial Data – CPA-Audited Financial Data” table (TWN/AINVFQ1), specifically the columns “Sustainable ROE” and “Parent Company Net Profit.”

The financial data for ROE and parent company net profit are based on a trailing twelve months (TTM) period.

Introduction to Alphalens

The Alphalens-tej package in TQuant Lab is a Python toolkit designed explicitly for factor analysis. Its primary function is to help investors review and evaluate factor performance, enabling the creation of more effective factor strategies. For a detailed introduction, refer to the Alphalens.ipynb notebook.

In quantitative investing, factors are indicators used to explain and predict asset returns. Common examples include price-to-earnings ratios, price momentum, and trading volume.

Alphalens offers a suite of powerful visualization tools and metrics, such as:

  • Mean Period-Wise Return by Factor Quantile
  • Information Coefficient (IC)
  • Cumulative Returns by Quantile

These features allow a deeper understanding of a factor’s predictive power and stability. Using Alphalens, investors can easily analyze the performance of various factors under different market conditions and identify the most suitable combinations for their strategies.

Alphalens integrates seamlessly with TEJ data, making it especially suitable for conducting factor backtesting and visualization using TQuant Lab. This integration significantly enhances the convenience and efficiency of factor research. 

Single-Factor Analysis

Due to space limitations, this section only calculates the factor’s IC (Information Coefficient) and IR (Information Ratio, risk-adjusted IC). It generates bar charts of the average returns for each factor quantile. The sample period for this article spans from 2014 to 2024, and the stock universe consists of the top 100 most extensive market capitalization stocks listed on the exchange.

Alphalens
The IC (Information Coefficient), IR (Information Ratio) values, and the weighted average returns of factor values (holding periods of 1 day, 5 days, 10 days, and 21 days) for each factor
  • Mean Return: This column shows the average return of the factor-weighted portfolio. A positive value indicates that the factor produced positive returns during the holding period.
  • IC Mean: The Information Coefficient (IC) mean reflects the correlation between factor values and asset returns. A positive IC Mean suggests a positive correlation, while a negative IC Mean indicates a negative correlation. Generally, the higher the absolute value of IC Mean, the stronger the factor’s predictive power.
  • IC Std: The standard deviation of the IC, representing the volatility of IC values. A higher IC Std indicates lower predictive stability, whereas a lower IC Std suggests more minor fluctuations and more stable predictions.
  • IR: The Information Ratio (IR) is calculated as the IC Mean divided by the IC Std. It represents the risk-adjusted performance of the factor. A higher absolute IR value indicates excellent stability and reliability in predicting asset returns.
  • IC > 0.03: This column represents the proportion of IC values with an absolute value greater than 0.03. A higher proportion indicates that the factor is more consistently correlated with returns over time, confirming its predictive effectiveness across different periods.
Alphalens
Bar Chart of Mean Returns by Quantile for BPROE_quantile
Alphalens
Bar Chart of Mean Returns by Quantile for the Inverse P/E Ratio Factor
  • Horizontal Axis:The horizontal axis represents the factor groupings (Quantiles), where the sample stocks are divided into 10 groups based on their factor values. Group 1 corresponds to the stocks with the lowest factor values, while Group 10 corresponds to those with the highest.
  • Vertical Axis:The vertical axis indicates the average return for each group, measured in basis points (bps), where one bps equals 0.01%. This value reflects the average return over specific holding periods (e.g., 1 day, 5 days, 10 days, 21 days).
  • Explanation:This chart illustrates the average returns for each quantile over various holding periods. If the factor has predictive power, the returns are expected to exhibit a monotonic trend. For example, higher average returns in Group 10 and lower average returns in Group 1 suggest that the factor can be used to construct a long-short portfolio.

The table “IC, IR Values, and Weighted Average Returns of Factor Values” shows that these two factors underperformed in terms of IC and IR across most holding periods. Generally, a factor with an IC greater than 0.05 and an IR greater than 0.3 is considered to have strong predictive power. However, these factors only met this standard during the 21-day holding period, indicating that their correlation with asset returns becomes more apparent over longer holding periods. Additionally, the table shows that the overall predictive ability of “BPROE_quantile” surpasses the “Inverse P/E Ratio” as its IC and IR values are consistently higher.

In the “Mean Return by Factor Quantile Bar Chart,” “BPROE_quantile” does not exhibit clear monotonicity, especially with inconsistent performance in the middle quantiles, suggesting a lack of pronounced monotonicity. In contrast, the “Inverse P/E Ratio” factor shows a stable and significant upward trend in higher quantiles, though its monotonicity is less evident in the lower quantile groups. Thus, the average return monotonicity of both factors is not sufficiently consistent.

Factor Synthesis 

In the previous section, we observed that both “BPROE_quantile” and “Inverse P/E Ratio” achieved more favorable IC values over more extended holding periods. However, the monotonicity across different quantiles was not consistent. This section will attempt to synthesize these two factors and explore whether their predictive power can be further enhanced through the combination.

Calculating Factor Weights 

When synthesizing multiple factors, assigning appropriate weights to each factor is essential since their explanatory power for future returns can vary. Proper weighting enhances predictive accuracy and stability.

In this article, rank IC_IR is used to calculate factor weights. Rank IC_IR is determined by dividing the IR ratio of each factor over the past month by the total IR ratios of the two factors. This method of weight calculation, based on risk-adjusted IC, assigns greater weights to factors with more substantial predictive power and stability.

We applied a lag (shift) to the final weight data to simulate the signal delay in actual trading. By shifting the weights by one day, we ensured that only prior-period data was used, avoiding the use of future information in the model.

Alphalens
Daily Factor Weights

Factor Synthesis Method

The method for calculating the composite factor involves weighting each individual factor based on its assigned weight and then computing a weighted average to create a composite factor that represents the overall factor effect.

Alphalens
Raw Factor Data
Alphalens
Composite Factor Data

Analysis of Composite Factors

As with single-factor analysis, we similarly import the new composite factor data into Alphalens.

Alphalens
Mean Returns By Quantile For Composite Factor
  • Horizontal Axis: Represents each quantile (1 to 10), with higher quantiles indicating larger factor values.
  • Vertical Axis: Represents the average return for each quantile, measured in basis points (bps).
Alphalens
Cumulative Returns By Quantile For Composite Factor
  • Horizontal Axis: Represents the time (e.g., years), showing the changes in cumulative returns over the period.
  • Vertical Axis: Represents the logarithmic cumulative returns, where higher values indicate greater cumulative returns.
  • Color Legend: Different colored lines represent the cumulative returns for each quantile. 
Alphalens
IC, IR Values, and Weighted Average Returns for the Composite Factor (Holding Periods: 1 Day, 5 Days, 10 Days, 21 Days)

The table “IC, IR Values, and Weighted Average Returns for the Composite Factor” shows that the composite factor slightly outperforms the original individual factors in terms of IC, IR, and average returns. Notably, the performance significantly improved during the 21-day holding period, with IC exceeding 0.07 and IR surpassing 0.4.

Furthermore, from the “Mean Return by Quantile Bar Chart”, it is evident that the composite factor demonstrates a more pronounced monotonic increasing effect across the quantiles. Compared to using individual factors alone, the composite factor exhibits more excellent stability and superior performance.

Conclusion

Through this analysis, we demonstrated how to use Alphalens to evaluate the performance of value factors and apply them to practical investment strategies. The value factors analyzed were “Inverse P/E Ratio” and “BPROE_quantile.” Based on the IC and IR results from single-factor analysis, the predictive ability of these factors was significant only during the 21-day holding period.

We synthesized the two value factors using weighted averages in the composite factor analysis. The results showed that the composite factor improved predictive power and monotonicity, with the most notable performance during the 21-day holding period. Based on these findings, future strategies could consider using the composite factor with a 21-day holding period.

Overall, this article presented a complete process, from single-factor analysis to constructing and backtesting composite factors. For future applications, consider incorporating additional value factors and experimenting with different weighting methods to enhance the efficiency of factor synthesis. Additionally, transaction costs, such as slippage and fees, should be included to evaluate the practical feasibility of the strategy further. With these improvements, multi-factor strategies will be better equipped to handle market volatility and consistently generate value in dynamic market conditions.

Start Building Portfolios That Outperform the Market!

Further Reading 

Relevant Links

Back
Procesing