Digging Into Portfolio Composition

1. Introduction

In this post I show how you can use D3.js to display properties of the 6 month ranking period momentum trading strategy outlined in Jegadeesh and Titman (1993) over the period from January 1965 to December 1989. I want to be able to display how the composition of stocks in the long and short legs of this position change over time. This is complicated because of the sheer volume of information this would entail. e.g., I would be drowning in PDFs if I created a new plot using R for each of the months in the sample. I also want to see how different the chosen stocks are in each month. e.g., if I am following this trading strategy and my portfolio turns over 100{\scriptstyle \%} in 12 months, are my new stocks hit by entirely different shocks in the future? In Section 2 below, I give a brief motivation for this exercise. In Section 3, I introduce my visualization and explain how it works. Finally, in Section 4, I conclude by discussing some interesting takeaways from this way of looking at the data. D3.js is a JavaScript library for creating interactive data visualizations created by Mike Bostock. Have a look here (link) for a bunch of cool examples. The key thing is that the resulting plots aren’t static. You can point and click and transform the representation of the data in real time.

2. Motivation

Generally, when you write down an asset pricing model you have in mind the prices of the stocks themselves. e.g., you might characterize how N stocks prices evolve:

(1)   \begin{align*} \frac{d}{dt} p_{n,t} &= \mu_p (p_{n,t}) + \sigma_p (p_{n,t}) \cdot \frac{d}{dt} W_t \end{align*}

where changes in each stock’s price tend to move by an amount \mu_p each period and have exposure \sigma_p to the Brownian motion shock W_t. However, in practice, traders and econometricians put together portfolios of stocks:

(2)   \begin{align*} \mathrm{A}_t[\mathbf{p}_t] &= \sum_{n=1}^N \alpha_{n,t} \cdot p_{n,t} \quad \text{where} \quad \sum_{n=1}^N | \alpha_{n,t} | = 1 \end{align*}

where \alpha_{n,t} denotes a trader’s holdings of stock n at time t. For instance, if \mathrm{A}_t denotes the momentum portfolio operator and there were N = 1000 stocks, then \alpha_{n,t} = 200^{-1} for the 100 stocks with the highest returns in the previous period and \alpha_{n,t} = - {200}^{-1} for the 100 stocks with the lowest returns in the previous period. Thus, in practice we really care about changes in portfolio prices:

(3)   \begin{align*} \frac{d}{dt} \mathrm{A}_t\mathbf{p}_t &= \mu_{\mathrm{A}p} (\mathrm{A}_t \mathbf{p}_t) + \sigma_{\mathrm{A}p} (\mathrm{A}_t \mathbf{p}_t) \cdot \frac{d}{dt} W_t \end{align*}

Obviously, the p_{n,t} and \mathrm{A}_t \mathbf{p}_t processes are related, but how exactly? The portfolio composition operator \mathrm{A}_t could be a really complicated object. For instance, the momentum portfolio composition rule depends on past price paths. I want a tool that allows me to poke around and inspect different portfolio composition rules.

3. Visualizing Composition

This section houses my visualization of the Jegadeesh and Titman (1993) momentum portfolio. Before I get started with the explanation, here’s a link to the code to create it (gist). To use the visualization, mouse over the lower panel displaying the momentum portfolio returns in the month. The number quoted gives the returns in units of \% per month to a portfolio that is long the 10{\scriptstyle \%} of stocks with the highest returns over the previous 6 months and short the 10{\scriptstyle \%} of stocks with the lowest returns over the previous 6 months. The sample average of this series is 0.84{\scriptstyle \%} per month corresponding to the “6 Buy-sell” row in Table 1 of Jegadeesh and Titman (1993). The top panel then displays the returns to each stock in either the long or short leg of this portfolio over the sample period—i.e., each line represents the entire history of returns for each of the stocks:

(4)   \begin{align*} \left\{ \ n \ : \  \alpha_{n,t} > 0  \ \right\}  \end{align*}

in the case of the long position. If you mouse over the lines in the top panel, you can see the name and PERMNO of the company in the upper left. To start with, the top panel displays only the stocks in the long leg of the momentum portfolio each month. To toggle between showing the stocks in the long and short legs of the portfolio, click on the “long position” and “short position” buttons in the upper right hand corner.

Let me talk through a couple of examples to make sure it’s clear exactly what this visualization is showing. First, note that when looking at the long position, there is a hump lasting roughly 6 months following the green bar in the upper panel. Likewise, in when looking at the short position, there is a trough lasting roughly 6 months following the red bar in the upper panel. These waves are mechanical. After all, the stocks in the long position of a momentum portfolio with a 6 month ranking period at time t had to have the highest returns over the previous 6 months. Likewise, all of the stocks in the short position of a momentum portfolio with a 6 month ranking period at time t had to have the lowest returns over the previous 6 months. Next, move the bar to either end of the time sample and watch the tails of the plot in the upper panel thin out. Again, this effect is mechanical. Look at the long position, push your time bar all the way to the right, and mouse over the constituent returns in 1964. There are only a few of them. These stocks (e.g., Wichita River Oil) have to both have extremely positive returns from June 1989 to November 1989 and also have existed in the CRSP database since 1964! There are very few of these. If you mouse over the stocks closer to the December 1989 holding period, you see that most of the stocks in the portfolio have only been around since the early 1980s. Finally, observe that while some firms in the top panel have broken histories in CRSP, any firm that you select will have at least 7 months of data around the portfolio holding date—i.e., the 6 months before and the portfolio holding month.

4. Portfolio Composition Facts

I conclude by outlining some interesting takeaways from the visualization above.

Factors vs. Characteristics. One of the first things that jumps out at you when you move the time bar around is that the bumps in the returns in the upper panel remain really stable. e.g., if you look at the long position of the portfolio and start scrolling from 1965, you see persistent downward spikes in 1979, 1980, and 1987 as well as persistent upward spikes in 1984 and 1985. What does this mean in words? This means that every stock in chosen into the positive leg of the momentum portfolio that lasted until, say, 1979 realized the same negative shock in 1979. What’s more, both legs of the portfolio tended to get struck by the same major shocks. Toggling between legs of the portfolio doesn’t really change the shape of the plots all that much. This observation suggests that the portfolio composition rule for momentum isn’t picking up differential exposure to long run risk factors.

Pre-Ranking Period Behavior. Toggle over to look at the short position. As you scroll the time bar from left to right, you see a trough following the red line as I mentioned above. However, just before the trough the returns are actually unusually high for all of the stocks in the portfolio. You see a bit of a wave pattern. This effect means that stocks included in the short leg of the Jegadeesh and Titman (1993) momentum strategy not only had really low returns over the previous 6 months, but also had unusually high returns during the 6 months before that. This pattern is not present in the long leg of the portfolio.

Short Position and Value. Finally, note that the y-axis range is determined by the maximum and minimum of the returns of individual stocks in the momentum portfolio. Toggle back and forth between the long and short positions of the momentum portfolio and scroll through the time series. All of the extreme events defining this y-axis range occur in the short leg of the momentum position. Computer INVS Group held in the short leg in 1969 determines the upper boundary. BancTexas Group (along with lots of other in 1987) determines the lower boundary. This observation highlights how the short leg of the portfolio conflates a directional bet with default risk. Put differently, firms that have had 6 months of really bad returns may be more likely to have poor returns in the following month, but this trend can’t go on forever. Something really bad (default) or really good (buy out) will put an end to it eventually.