Tag: quant

Principal Component Analysis, Part II

This post is an update to Part I of applying PCA to NASDAQOMX India TR indices.

Daily returns tends to be noisy. One way to smooth things out is to use rolling returns over a certain period of days. Rolling returns also allows a bit of slack in terms of variable response times. We wanted to check if using rolling returns would help shake out any obvious regime shifts that daily returns could not.

To recap, we split the NASDAQOMX India TR Index (NQINT) into two regimes. One above SMA-200 (A SMA_200) and the other below (B SMA_200.) The idea was to use PCA on the component indices to see if we could develop a “good times” and “bad times” portfolio based on the regime we are in.

NQINT 200-day SMA chart:
NQINT SMA 200

Factor loadings of indices when NQINT is above its 200-day SMA:
loadings above 200-day SMA

Factor loadings of indices when NQINT is below its 200-day SMA:
factor loadings below 200-day SMA

And finally, factor loadings through out:
factor loadings

Unfortunately, neither using daily returns nor lagged rolling returns resulted in PCA being useful in chalking out a regime specific portfolio.

Code and more charts are on github.

Principal Component Analysis, Part I

Introduction

Principal Component Analysis (PCA) is a way of summarizing data. For example, if you take financial services, there are quite a few sector indices that cover it: Bank, Pvt. Bank, Public Bank, Financial Services, etc… There will be overlap between all these indices, so the question is, in what proportion should one invest in these individual indices in order to get the most optimal exposure to financial services? PCA is one way to answer this question. To get a better understanding of what it is, see: stats.stackexchange.

NASDAQ OMX India TR Indices

To start this series on PCA, we will first look at the USD denominated Total Return indices published by NASDAQ-OMX. Choosing these indices helps us avoid a lot of data pre-processing steps. First, they are Total Return, so they incorporate dividends, etc. Second, they are US dollar denominated, so we don’t have to worry about being long USDINR while looking at tech stocks. And third, they start from 2001, which goes way farther than the TR indices published by the NSE.

We use the following sector indices:
NASDAQ India Basic Matls TR Index (NQIN1000T),
NASDAQ India Cnsmr Goods TR Index (NQIN3000T),
NASDAQ India Financials TR Index (NQIN8000T),
NASDAQ India Health Care TR Index (NQIN4000T),
NASDAQ India Inds TR Index (NQIN2000T),
NASDAQ India Tech TR Index (NQIN9000T),
and the NASDAQ India TR Index (NQINT) to further divide time periods when it is above and below 50-, 100- and 200-day SMA.

The question we are trying to answer is that are the factor loadings stable? If they are not, then how do they change over time and across different market regimes. To answer this, we setup a sliding window of 5-year daily returns that is incremented by one year at a time. That gives us 11 datasets, starting from 2002-2007 through to 2013-2017. We run PCA on the daily returns of the sector indices listed above. We then plot the loadings of the first principal component.

NASDAQOMX India Sector Index PCA

A few things stand out:

  1. Dominated by Basic Materials, Financials and Industrials.
  2. Relative importance of IT has dropped.
  3. Financials dominate the below-SMA200 market regime implying that most of the time, the market is below 200-SMA because of financials.

What we had hoped to find was some sort of stability in the loadings either in the entire dataset or in specific SMA regimes. We could have then constructed a “good times” and “bad times” portfolio and switched between them based on SMA. But it looks like it is not possible with these indices.

Code and more charts are on github.

Relative Momentum Back-test

Daily data of over 35,000 global indexes published by NASDAQ OMX including Global Equity, Fixed Income, Dividend, Green, Nordic, etc. are available for free download on Quandl. Out of which about 1000 indices are USD denominated Total Return (TR) indices. We were curious to find out the result of applying our Relative Momentum algorithm on this subset. We also wanted to know if the rank of the Indian TR Index within this subset can be used to time NIFTY or MIDCAP investments. To know more, download the pdf Relative Momentum Back-test.

The charts in the document are low-res. Whatsapp us on +918026650232 for the high-res ones.

Can Beta Dispersion be used for Market-Timing?

The paper Beta Dispersion and Market-Timing (SSRN) argues that one can predict crashes by tracking the dispersion of betas of the constituents of an index. The intuition presented in the paper is that when beta dispersion is high, any shock to the high beta stocks could spill over to the low beta stocks and create a broad market correction.

Although the paper proceeds to present a back-test on the US S&P 500 index, there some questions that need to be answered before deploying this strategy:

  1. What is the performance if you remove 2000 and 2008 from the data? Perhaps most of the out-performance can be attributed to skipping these two periods purely due to chance?
  2. Are the results robust over different markets? Perhaps it is unique to the US?
  3. What happens if you change the look-back period of beta calculations? Perhaps it is being data-mined?
  4. What happens if the calculations are continuous rather than sampled at the end of the month? Perhaps its an end-of-the-month effect?

Unfortunately, we don’t have a robust data-set to put this theory to test. However, the chart of the cumulative returns of the NIFTY 100 index vs. the beta-dispersion of its components does not lead to the same conclusion made in the paper.

The code for this analysis is on github.

An Equity, Bond and Gold Portfolio

How did diversification across Midcap equity, bonds and gold work out for Indian investors over the last 10 years? Not too shabby, as it turns out:

Combined portfolio – Annualized: 12.16%; Max drawdown: -42.42%
Gold only portfolio – Annualized: 9.69%; Max drawdown: -21.49%
Equity only portfolio – Annualized: 12.55%; Max drawdown: -59.39%
Bond only portfolio – Annualized: 7.99%; Max drawdown: -8.52%
*Not including transaction charges/taxes.

The Setup

  • Annual rebalance.
  • Bonds start at 1%, the rest is divided between Gold (10%) and Equities.
  • The total return index for the 5-10 year tenure published by CCIL is used as a proxy for Bonds.
  • The MID100 FREE index is used as a proxy for Equities.
  • The GOLDBEES ETF is used as a proxy for Gold.
  • Period under observation: 2007-04-01 through 2017-03-31.

The idea is that you start with mostly Equity and Gold in the portfolio and rebalance at the end of every year so that at the end of 10 years, you end up with mostly Bonds.

Returns

Notice the drawdown of the equity vs. that of the portfolio. You end up with similar returns but with lower volatility.

If you remove Gold from the equation and go with only Equity and Bonds:

Combined portfolio – Annualized: 11.38%; Max drawdown: -49.90%
Equity only portfolio – Annualized: 12.55%; Max drawdown: -59.39%
Bond only portfolio – Annualized: 7.99%; Max drawdown: -8.52%

Even though a diversified, rebalanced portfolio makes sense on the surface, the tax treatment on Gold and Bonds make an annual rebalance an expensive affair.

Code and detailed results are on Github.