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.

Monday, January 31, 2011

Egypt Contagion Risks















Nouriel Roubini has a very interesting analysis (video clip above) of the 2011 Egyptian protests. Roubini has so far acquired a reputation for prescient forecasts and accurate analysis, especially when the conventional wisdom has failed (Roubini has become known as Dr. Doom for his pessimistic but accurate 2005 forecast of the 2007-2011 Subprime Mortgage Crisis).

Roubini's implicit theoretical model is displayed in the graphic on the right. He explicitly links the protests in Indonesia and Egypt to rising commodity prices in world markets. Egypt and Indonesia are peripheral countries in the world system and, as such, are subject strong market shocks.

When commodity prices (oil and food, particularly) rise (as is currently happening) they generate cost-push inflation and a direct negative affect on disposable income. Cost-push inflation reduces economic growth which also reduces income, especially in countries with high inequality, such as Egypt and Indonesia. The result is protest.

All these events lead to political contagion, geopolitical risk, risk aversion and negative effects on equity markets. The effect on equity markets can be seen from Market Vectors Egypt Index ETF (EGPT) -- the only ETF devoted entirely to Egypt. It's been trending down steadily all year and has suspended trading (but not redemptions) until the Egyptian bourse reopens.

If that's not enough to scare you away from this ETF, EGPT is also the first pure random walk I've displayed. The fund is neither a business-as-usual investment nor linked in to growth in the world economy. Although I can present confidence intervals for the fund, it is difficult to say where the price will go in the future. Because EGPT is a random walk, there is no attractor. The fund price can go anywhere. Indeed, from the confidence intervals, it has already made some excursions into improbable territory. We can only expect more in the future.

Friday, January 28, 2011

Likely Double Dip in U.S. Housing Market?














CNBC is reporting (here) that the S&P Case-Shiller composite housing price index is continuing to decline and David Blitzer, the S&P 500 Index Committee Chairman, is predicting that a double-dip could be confirmed before Spring (video above).

Another CNBC stock analysts, Jim Cramer, is not so sure. He doesn't think the widely reported Case-Shiller index is the most reliable index since it only measures 20 cities (here). Data from the Federal Housing Finance Agency (FHFA), the National Association of Realtors (NAR), the U.S Census Bureau and the housing-related stocks seem to be telling a different story of housing market recovery.

Completing a reliability/validity analysis of all these data sources will get in the way of making my own forecasts. However, I am interested in the Midwest Condominium market and have used NAR data to make forecasts. If you're interested, you can read the report here.
The bottom line is that the Midwest condominium market is soft. Prices will continue to decline in 2011 even though sales will start moving back toward trend. From the graphic above, you can see that Midwest condo prices dropped about 10% during 2010. Since the U.S. housing bubble is thought to have peaked in 2005, we've had 3-5 years of downward pressure on prices on top of the steep decline in 2010. Prices at 10, 20 or even 30 percent below list are not unreasonable given the NAR data.

It's a great time to buy a condominium, but be forewarned: you will be unable to get a first mortgage on any condominium within a project that is still controlled by the developer. Fannie and Freddie simply will not, after the government takeover, repurchase these mortgages from banks (think of the Florida and Las Vegas condo markets and all the recently-started but vacant units).

Thursday, January 20, 2011

Another Bad Day for Apple: Buy, Sell or Hold?

It was another bad day for AAPL with the stock closing down 6.16% from Tuesday when Steve job's medical leave was announced. What to do, if anything? Karen Finerman, president of Metropolitan Capital Advisors, thinks it's a buy (here). Jim Cramer, CNBC Mad Money, thinks that AAPL had just run up too much for a "blowout" quarter to propel the stock any higher (here).
The logic of my systems models suggests that if AAPL is below the dynamic attractor (displayed above) it's a buy opportunity since the stock price should eventually be drawn back to the attractor. Stock prices above the dynamic attractor present an opportunity to take excess profits.

For the month of January 2011 (the finest resolution for my models), an AAPL stock price of 332.68 is very close the attractor value of 331.01 (just a little over, actually). The models suggest that the stock could fall a little further before presenting a buy opportunity. In fact, Apple stock would have a long way to fall to reach improbable lows (290 brackets the lower 98% bootstrap prediction interval).

DISCLAIMER: I'm holding my Apple stock, but that has less to do with the models than with a wait-and-see attitude. Steve Job's medical leave cannot possibly have any effect on company fundamentals for many months into the future. It's a good time to watch what traders do to the stock and compare future time paths with model predictions.

Tuesday, January 18, 2011

A Rough Couple of Days for Apple Computer

On news that Steve Jobs, Apple CEO, is going on medical leave, Apple Computer has had a rough couple of days in the stock market and generated lots of speculation in the press (here and here). At the end of trading today (above), AAPL was trading down about 1/2 per cent at 338.84. Still, many analysts remained positive on Apple, especially as a result of a record earnings report (here). On CNBC, Jim Cramer increased his price target to $400 from $325 (here). How does this relate to my initially pessimistic forecast for Apple (here)?
First, in Burton Malkiel's terms (here), Steve Jobs medical leave is truly random, unpredictable news. The negative shock to Apple Stock, however, is predictable. In terms of my original pessimistic forecast (here), notice that the forecast is based on data ending in January 2010. Using all of 2010 (above) I get a much more optimistic forecast.
The new attractor plot (above) shows the stock peaks as the major attractor points.
Just projecting the attractor into the future (rather than using the actual stock data) shows strong growth for Apple through 2020. Just to be clear, the graphic above is the result of a free simulation starting in September 1984 and going forward to 2020. A forecast (second graphic above) uses step-ahead predictions from the actual data for each month starting in September 1984. Once the data runs out (January 2011), the forecast data is used for the prior month's stock value.
Returning to Jim Cramer's $400 price target, the attractor forecast suggests that $400 is somewhat unlikely until well into 2011.

DISCLAIMER: I have held Apple stock since 1988. None of the forecasts presented in this blog should be used to make buy or sell decisions. The usefulness of the models and the forecasts will have to be evaluated at some point in the future. My particular interest is to evaluate the models in terms of the random walk hypothesis and Burton Malkiel's persuasive view of the stock market (here). At this point, the models merely say that AAPL is not a random walk stock. What that results means for stock forecasting is unclear.

Friday, January 14, 2011

What Keeps The Markets Moving?


"Delusions" And Denials Keep the Markets Movin' Says Professor Malkiel @ Yahoo! Video A video that explains index funds and the efficient markets hypothesis from the founder of random stock walking and author of A Random Walk Down Wall Street, first published in 1973 and now in its seventh edition. A few interesting quotes:

THE RANDOM WALK IDEA
"... when news arises, the stock market reflects that news very quickly, without delay ... true news is random ... simply unpredictable. And, essentially the random walk idea is don't think you can predict the short term ups and downs of the market, it's essentially unpredictable ... because true news is unpredictable."

INDEX FUNDS: THE WAY TO INVEST
Wall street, in some sense, wants to insure that you tell people, this ... [investing] ... is too complicated, you can't do it yourself. The fact of the matter is you can do it yourself, do it very easily ... but you can do it with much less risk if the core of your portfolio is in low expense, very broadly-based index funds.

THE EFFICIENT MARKET HYPOTHESIS
"The efficient market hypothesis does not mean that prices are always right. How could they be. I teach a course in financial markets. I teach my students that the fundamental principle of valuation is that a stock ought to be worth the discounted present value of the whole stream of future cash flows, and that's the key word, future. Who knows what the future is going to be. The market is efficient enough so that it is unbeatable ... two-thirds of the active fund managers are always beaten by the indexes."

Monday, January 10, 2011

Can You Trust The Stock Market?

In today's NY Times (here), the editorial writers observed that many investors are avoiding the stock market for good reason. Since 1995, there have been two major bubbles and two major crashes for the S&P500 (^GSPC). Unless the Dodd-Frank reform law (FinReg) kicks in (and the new Republican Congress has vowed to block the law's implementation), "...investors are right to be leery."

CNBC's optimistic Jim Cramer (here) "...gets it--you don't trust the market" but goes on to argue that "...in spite of everything, when it comes to growing your wealth, the stock market isn't just your best option, frankly, it's the only game in town..." So what does the Random Stock Walker think?
First, the S&P500 index at least is not a random walk. Removing the booms and busts from the basic attractor (above) shows that (1) the index has grown over time, (2) the crashes have been over-reactions to bursting bubbles and (3) the market was even underperforming somewhat during the early 1990's.
All the positive statistical analysis and a positive forecast for the future (above) doesn't mean a lot if your retirement savings (like your 401K) are locked up in a market that has just crashed. This is the problem with the argument that pensions and Social Security should be eliminated in favor of 401K plans (for example, here). Although the stock market is the only game in town, it is not the right game for individual retirement investment. People on modest incomes simply can't save enough and the market has too much (obvious) volatility to provide stable income in retirement.

A different approach, neither the classical company pension nor the 401K plan, is needed. I'll talk about my proposals in future posts. On the other hand, if you're young, have any surplus income and can ride out 10-year bubbles, the stock market is a great place to invest. If you had bought Apple Stock at about $30 per share in 1988 (luckily, I did), it turned out to be a pretty good deal at over $300 per share, even in today's market (here). It's just a good thing I didn't have to count on it for retirement.

Friday, January 7, 2011

DRWI: Dungeons and DragonWave

Tonight on CNBC's Mad Money, Jim Cramer commented on (here) speculation that DragonWave (DRWI), a small but world-wide wireless networking company, might be a takeover target given Qualcomm's (QCOM) recent acquisition of Atheros (ATHR). Cramer's comment was "Make no moves...this is just something to watch." What does the Random Stock Walker think of this rumor?

First, there's not a lot of data but, from what is available since the IPO, there is enough data to estimate a statistical model. The estimated model shows that DRWI is not a random walk being driven by pure market shocks. On the other hand, it is also not being driven by trends and cycles in the world economy. Rather, it is a company that is on its own growth path, what I call a "business as usual" (BAU) company. This isn't meant to be pejorative, just that the company is functioning in its own niche with a stock price that not only is affected by market shocks but also has its own positive growth dynamic. The step-ahead predictions of the BAU model (displayed above, click on the graphic to enlarge) are acceptable but clearly miss the shock-induced turning points.
DRWI has it's own growth path (dotted line above) that acts as an attractor for the stock price. The stock has had periods of being both under-valued (2008.5-2009.5) and over-valued (2009.5-2010.4). Right now, the stock is somewhat over-valued but very close to the attractor line.
For the future, DRWI can be expected to continue growing (the dotted lines above are the 98% bootstrap prediction intervals) but probably will not exceed the 2010.0 peak by very much, unless some market shock (like a takeover bid) comes along.

DISCLAIMER: I have a nephew by marriage who works for DragonWave. I do not own DRWI stock and have not talked with my nephew since hearing the potential takeover news on CNBC tonight. I have no insider information. Anyone who would buy or sell stocks based on the statistical analysis presented above would immediately be nominated for 2011's Greater Fool Award.

Monday, January 3, 2011

US GDP Forecast: Digging Out of A Deep Hole?

In today's NY Times, Paul Krugman took a pessimistic position on the U.S. economy (here). His Op-Ed got the attention of CNBC who compared it to the bullish outlook of Jan Hatzius, Goldman Sachs chief U.S. economist (here). Krugman was arguing that even though the economic indicators might look good, we are still a long way from bringing unemployment down.

If there’s one piece of economic wisdom I hope people will grasp this year, it’s this: Even though we may finally have stopped digging, we’re still near the bottom of a very deep hole.

I'd like to pick a little at the quote above from Krugman's Op-Ed. Are we actually digging out of a hole? Is this the right analogy? It isn't and choosing a better analogy does have implications for future policy responses.
The first graphic above plots U.S. GDP as a function of trends and cycles in the World economy (a model based on trends and cycles in the U.S. economy was a close second in terms of predictive power). The model fits the data pretty well (it was actually estimated from 1950 to Q3 2010 using data from the BEA, here) although it didn't catch the turning point of the global financial crisis.

The second graphic above shows the long-run equilibrium position (the GDP dynamic attractor) predicted by the model for GDP. Notice that the dot-com bubble, usually dated from 1995-2000 (the model doesn't show the bubble starting until 1998), is visible (one step ahead predictions above the equilibrium line) while the subprime mortgage crisis (usually dated from 2007-2010) started to develop in 2004.

In other words, the model does not show the U.S. economy "digging out of a hole" but rather returning to a more sustainable growth path based on growth in the world economy. There was a period of "overshoot" (the hole?) between mid-2009 and mid-2010, but the overshoot was in response to the massive bubble that developed after 2005. The Economic Stimulus Act of 2008 and the American Recovery and Reinvestment Act of 2009 may have prevented the overshoot from being larger, but that counterfactual is clearly debatable (even Paul Krugman thinks the stimulus was too small to have made a difference).
For the future, the model definitely predicts that GDP has recovered (the dotted lines in the graphic above are the 98% bootstrap prediction intervals) with a high degree of confidence. Notice that the model shows the recession ending in June of 2009, exactly the date picked by NBER's Business Cycle Dating Committee.

Although the last graphic above looks a little like a "hole we were digging out of", the model shows the bubble developing over a longer period of time starting in 2005. And, if it's possible to identify an economic bubble, it's theoretically possible to control it's growth before it pops. Rather than more stimulus right now, more regulation back in 2005 and going forward would have been the better solution (everyone seems to agree that regulation slows things down). Dealing with unemployment is another matter and will have to be covered in another post.

NOTE: You can compare my forecast with one produced by the Financial Forecast Center (here). The forecasts are very similar although the Financial Forecast Center does not provide prediction intervals or any information about historical predictions.

Saturday, January 1, 2011

Will the Apple "Run Up" Continue?

For the first post on this blog, I thought I'd analyze one of the current market darling stocks, Apple Computer (AAPL). The analysis in the "Random Stock Walker" will be based on a simple idea: as an investment, you probably want to stay away from stocks that are a random walk (you can read more about the well-known random walk hypothesis here and here). On the other hand, you probably would want to own a stock that was strongly linked to the secular and/or cyclical growth of the U.S. or world economy (if you follow Jim Cramer on CNBC, for example here, you've probably heard this pitch before).

I have a statistical technique that can be used to tell whether a stock is a random walk or whether the stock is being driven by secular and/or cyclical trends in the economy. I have used the approach to analyze stock market bubbles (here) and a few stocks (GM--here and here--and Cummins, here). Let's see how it applies to Apple Computer.

Apple's stock price history and the step-ahead predictions of the best model are displayed above. The AAPL stock price is not a random walk (GM is) and is well-predicted by secular and cyclical trends in the US economy.
The Apple stock price is also affected by random events. If we eliminate error variation from the model and simulate the model (solve the model over time) from 1985, we get the graph displayed above. There were times when AAPL was over-priced relative to its long-run growth path (e.g., around 2000) and times when it was under-valued (2001-2005). Right now, AAPL is slightly over-valued. Will the stock price continue rising in 2011?
We can't know the future but we can run the model forward in time and add 98% bootstrap prediction intervals to the forecast (above). The model suggests that AAPL will return to a lower equilibrium growth path and remain there for the next few years.

DISCLAIMERS: Whether a stock is or is not a random walk might prove to be a useful screening device for drawing your attention to investment grade stocks, but the analysis and the forecasts I will provide in this blog are not meant to be used for purchase or sell decisions. For that, you will have to do a lot more homework about the company and consult the many other sources that are available on the Internet (here, for example).

My main purpose for starting this blog is to see, over the next year, how happy I am with the forecasts and analysis generated by the models. Hopefully, we can look back in a year or two and learn something about how skillful the techniques are.