State Space Models

All state space models are written and estimated in the R programming language. The models are available here with instructions and R procedures for manipulating the models here here.

Tuesday, May 14, 2013

ADR: Should Sony Be Broken Up?



In somewhat of a minor market bombshell announcement (here), Third Point Hedge Fund Investor Daniel Loeb called for the breakup of the multinational conglomerate Sony (the Sony group includes electronics, motion pictures, music and financial services). The argument, discussed in the Bloomberg video above, is that parts of Sony, particularly the US-based Sony Pictures Entertainment, doesn't really fit the rest of the company and should be spun off.

The issue that caught the attention of the Random Stock Walker was whether or not it would be best for Sony to disengage from the US economy. After WWII and until the 1980's (the beginning of Neoliberalism and Globalization), Sony was a dynamic company linked closely to the US market. They originally licensed transistor technology from Bell Laboratories and found a large US market for the Walkman. Sony acquired Columbia Pictures in 1989 and the CBS Record Group in 1989. The argument to divest the US-based business units seems to be based on culture fit. A more interesting question is whether Sony would be more successful as an electronics supplier to the World economy, allowing the company to be driven by the World economy as I have show Apple is (here).
To test the Sony break-up proposal, I ran two state space models. In the first one, the Sony stock price (ADR) was driven by the World economy and, in the second one, below, by the US economy (the testing was a little more far ranging, but these were the two best models). The attractor forecast for a world economy-driven Sony shows exponential growth for the future (the black line is the actual stock value, the dashed red line is the dynamic attractor path created from a free simulation, and the other two lines are the upper and lower 98% bootstrap prediction intervals). Although Sony stock has had some brief "bubble and trough" years around 2008, 2009 and 2001, the stock has generally followed the cyclical path of the world system.

The same can be said for the model driven by the US economy. In fact the attractor tracking seems to be somewhat better. However, the future projection does not look very good. In fact, the attractor path seems to suggest that tracking the US economy too closely is driving much of the cyclicality in Sony stock.

The obvious conclusion from these two simulations is that Sony must link its fortunes with the World economy and make sure it is insulated from cyclical forces transmitted from the US economy. Whether this means spinning off the US entertainment divisions, however, is another matter. Everything depends on how much of their revenue is driven by the world economy, and that would be require a detailed level of analysis that the Random Stock Walker does not pursue!

Monday, May 13, 2013

Are We In A Stock Market Bubble?

In a recent tweet (here), political economist Robert Reich issued a "Wall Street Bubble Alert" referencing a Business Week article (here) in which Goldman Sachs claims that "...the market is at or above where it should be trading." The CNBC technical analysts, however, don't see it that way.



In the video above, technical analyst Michael Harris claims that "..from a trend-channel perspective, this is one of the most beautiful patterns I have seen in some time."

I've duplicated the "trend channel" (sometimes called a price channel) in my forecast at the beginning of the post. The graph of ^GSPC (the S&P 500 index) shows the actual index path (black line), the dynamic attractor path (dashed red line) and the upper and lower 98% bootstrap prediction intervals (dotted green line and dot-dash blue line, respectively). The "trend channel is presented as solid heavy red lines. My attractor forecast shows that the S&P 500 index is above the 98% bootstrap prediction interval and this may be the start of a stock market bubble. Whether we are in for another massive bubble, such as the one centered on 2000, remains to be seen.

Technical analysis focused on trend channels misses all this because the time period considered is restricted to the start of the last upswing. The trend channel, to be clear, is simply constructed by connecting peaks and troughs from the start of the last upswing. That's it. There's nothing more to the trend channel than plotting lines by hand. Since this kind of analysis is quite common on Wall Street, it may actually contribute to the development of a market bubble if it is believed by enough investors. If you follow this type of technical investing model, your dilemma will be "when to get out of the market," that is, when will the bubble burst. Trend channel analysis doesn't have much to say about that issue and neither does attractor analysis, which is saying right now to start selling since the S&P 500 is above the 98% upper bootstrap prediction interval.

It will be an interesting summer in the stock market!


Wednesday, January 16, 2013

Stock Market Recap for 2012

It's time to look back at last year's Stock Market and see what, if anything, the Random Stock Walker learned. This blog is largely based on ideas from Burton Malkiel's book A Random Walk Down Wall Street. I first read Malkiel's book in 1975 and it has always been a big influence on my views of the Stock Market and of investing. However, I have also been a little uncomfortable with the lessons I took from the book and last year I set out to give some of the ideas a test.

Malkiel's basic hypothesis is that the Stock Market is a random walk, that is, today's stock price is given by yesterday's stock price plus random error P(t) = P(t-1) + E. If this is true, the implications for investing are shocking. Since you cannot predict the movement of a random walk, investing is just gambling. Your financial analyst and commentators on CNBC are basically selling snake oil. The counter argument is that stocks do seem to have trends over time and minimally might perform like a random walk with drift, P(t) = a + P(t-1) +E, where a is the drift parameter. As long as a is positive, you can expect to make a little money over time as long as your profits aren't eaten up by taxes, trading fees and investment fees (this argument is made by Andrew Lo and Archie MacKinlay in their book A Nonrandom Walk Down Wall Street, follow the link to read the free on-line pdf file).

After reading these two books and living through a few financial crises (Savings and Loan CrisisDot-com bubble, Subprime Mortgage Crisis, etc.), I have to admit that Malkiel's book is more fun to read and very appealing. However, I have always had nagging doubts. Maybe some stocks aren't random walks. If you could identify them, maybe they would be good investments. Also, being a statistician, I knew I could write a program that could test to see whether or not a stock or some market index was a random walk. The strategy would be to do this for a few years and see how the models perform. I now have a few year's worth of data.


The most important stock I had to watch last year was Apple computer (AAPL) since I owned it from 1988 to September of 2012. I sold the stock just short of the peak in September of 2012. Why?


The basic answer is the graph above taken from a February 2012 post (here) when CNBC commentators were speculating that AAPL would hit 500 within the week. My models were showing two things: AAPL was not a random walk and 500 would not be reached until half way through 2013. We are two weeks into 2013, and AAPL is 509 today, still a little over-valued given my models.

The dotted red line in the graph above is the attractor path for AAPL while the dotted green and blue lines are the upper and lower 98% prediction intervals, respectively. Anytime AAPL gets out of the upper 98% prediction interval, my models start screaming SELL and when the stock price gets below the attractor value, the models say BUY. As for AAPL, I haven't bought back in and there wouldn't be much reason to until the stock starts trending over 500. Currently, some CNBC analysts are saying that AAPL has bottomed out (here) while others are saying that the company's problems that are not going away anytime soon (here). The next few years will tell.

Unlike individual stocks, Malkiel argues that index funds provide great investment opportunities because of low fees and consistent performance, that is, they are not random walks, supposedly because the index usually consist of the best stocks on a particular exchange. In October of 2012, I took a look at the Dow Jones Industrial Average (DJI) in terms of the 1987 Flash Crash (here). The DJI was of interest because flash crashes appear to be a new feature of investing driven by program trading. Can we be sure the DJI is not a random walk?

My models suggest that the DJI is not a random walk but rather that it's attractor path is being driven by the US economy. Unfortunately, for long periods during the late 1980's, the DJI was well below its attractor path. If you had your savings in a DJI index fund, had retired during this period and needed the money, you might be taking some losses. Investing in index funds are, evidently, no guarantee of good performance at any given point in time.

In summary, the Random Stock Walker investigations for 2012 are inconclusive. Some stocks are not random walks and some index funds are not random walks. This doesn't mean that you can simply identify a stock that is being driven by the world economy (as is AAPL) or an index who's attractor is being driven by the US economy (as is the DJI), and do some log-term buy-and-hold investing. If a stock gets too far above its attractor, it would be smarter to sell. The bubble may not last forever and who knows what might happen in the future. Index funds can also also be subject to bubbles (as was true of the DJI during 1987) and the return to the attractor (the bubble-popping "Flash Crash") can be rapid. What's worse, the index can under-perform for years afterward.

If I look back a littler further, into 2011, the are some other lessons about identifying stocks that I will cover in a future post.