Digging Into Portfolio Composition

1. Introduction

In this post I show how you can use D3.js to display properties of the 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 in 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 stocks prices evolve:

(1)

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

(2)

where denotes a trader’s holdings of stock at time . For instance, if denotes the momentum portfolio operator and there were stocks, then for the stocks with the highest returns in the previous period and for the stocks with the lowest returns in the previous period. Thus, in practice we really care about changes in portfolio prices:

(3)

Obviously, the and processes are related, but how exactly? The portfolio composition operator 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 of stocks with the highest returns over the previous months and short the of stocks with the lowest returns over the previous months. The sample average of this series is per month corresponding to the “ 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)

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 months following the green bar in the upper panel. Likewise, in when looking at the short position, there is a trough lasting roughly 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 month ranking period at time had to have the highest returns over the previous months. Likewise, all of the stocks in the short position of a momentum portfolio with a month ranking period at time had to have the lowest returns over the previous 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 . 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 months of data around the portfolio holding date—i.e., the 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 months, but also had unusually high returns during the 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 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.