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.

Thursday, September 12, 2013

Remembering the Collapse of Lehman Brothers



In the video above, Greg Ip and Zanny Minton Beddoes discuss the Lehman Brothers collapse five years later. Their question is whether the world economy is now sufficiently protected from future shocks. They conclude that the World Financial Crisis of 2007-2008 was caused by excessive debt and financial interconnectedness brought about by Globalization. As fallout from the Financial Crisis, problems still remain in the European Union as the weaknesses of a purely monetary union were exposed (individual countries had lost their ability to use monetary policy). They also point out that the role of Central Banks still remains unclear. Before the Financial Crisis, Central Banks had bought in to the Great Moderation, the assumption that wise monetary policy had eliminated the business cycle. Banks had failed to see that low interest rates fueled a housing bubble that eventually led to the Subprime Mortgage Crisis as the bubble popped. The Central Banks had insufficient focus on financial stability and too much focus on inflation. Monetary policy, even unconventional monetary policy at the zero-bound, may be too blunt an instrument to pop bubbles.

The conclusion from their argument, which they do not explicitly make, is that stronger financial regulation prior to the development of bubbles is needed in the future rather than hoping that monetary policy (or liberal fiscal policy, for that matter) can be counted on to recover from financial crises.

Friday, June 21, 2013

What's The Difference Between an Overvalued Stock and a Market Bubble?



June 4, 2013. In the video above (and here with transcript), CNBC stock analyst Jim Cramer is reacting to "bubble callers" (pundits saying that every overvalued stock is experiencing a bubble). It's not that Jim Cramer doesn't believe in bubbles (see the quote below), he just thinks there is a difference between overvaluation and a real bubble. My inclination would be to look at a significant departure from the attractor path (beyond the 98% bootstrap prediction interval, see an example for the SP500 here).

From the transcript:


Now, that's not to say the term is never appropriate. Looking back historically, there was a bubble in technology stocks back in 2000, and there was a bubble in housing back in 2007.
But lately, Cramer feels that the term has been thrown around far too casually.
"There's always somebody calling a bubble!" Cramer said. "Usually they're doing it to look smart." Unfortunately, those kinds of forecasts can be more harmful, than anything else.

Wednesday, March 6, 2013

What I've Learned About Bubbles: 2011-2012

In this post, I look back at results from two years of studying economic bubbles using state-space models and computer simulation. In the first part of the post, I give my definition of economic bubbles which differs from current definitions (I'll go through those definitions in future posts). Then, I analyze six bubbles; for one of the bubbles (Great Britain in the 2000's) I look at how forecasting models fail to see bubbles developing. The six bubbles studied include the German economy from the late 1990's, the Icelandic economy after 2000, the US economy starting in 2003, the SP500 during the Dot-com and Subprime Mortgage Bubbles and finally the Apple Computer Stock Price bubble. At the end of the post, I discuss the limitations of the analysis.

My statistical hypothesis about bubbles is very simple: when we make step-ahead predictions we cannot see bubbles. It doesn't matter whether you make step-ahead predictions with a complex econometric model, by drawing lines on graph paper (called technical analysis charting by stock market  analysts) or by expert opinion (guessing). The problem is that the current value of the time series you are trying to predict contains non-random, systematic errors that have accumulated over time.

To see the bubble (which itself is an accumulation non-random, systematic errors), you have to eliminate those errors from your forecast. To do that, you have to make your forecast over a long period of time, sometimes up to fifty years or more. You can't do that kind of forecast with expert opinion and long time periods are typically not used for technical analysis charting. For this purpose you need a model that can be run over time as a free simulation. In a free simulation, some initial condition is chosen and then the model is run forward in time without using the historical values of the dependent variable to reset the model at any point. If a model has exogenous variables, those variables must also be the result of a free simulation, that is, without input errors.

A free simulation produces the dynamic attractor path for the time series you are trying to predict. The bubble (sometimes called overshoot) is movement away from the attractor path. The collapse (bubble pop) is movement back toward the attractor. Over-correction is when the system collapses below the attractor path.

Any formal mathematical model can be used to generate an attractor path for the system it is modeling. Not all of these attractor paths will be very good (the system Q(t) = a, where a is a constant such as the mean generates one attractor path for the quantity Q but would not usually be very useful). To determine the best attractor path, we have to have multiple models and then apply some criterion to determine the best model. A useful criterion for this purpose is the Akaike Information Criterion (AIC) which takes the attractor path with the smallest residuals corrected for the number of predictor variables. The AIC chooses the simplest model that produces the best free simulation.

Of course, dynamic attractor theory is just a theory and it needs to be tested against actual models and actual data. In various places, I have been trying to do that for the last few years. I have not tried every possible mathematical model but have concentrated on state space models because they take a systems perspective. Any model will work as long as the model developer is willing to publish the AIC statistic for the free simulation. Here are some examples of the attractor paths generated by the models I have been using.
I analyzed the German Recession of 2000-2005 and the poor performance of the German Economy in 2010 (here). My argument was that our perspective on recessions is conditioned by extrapolating from current trends and thinking that bubble growth can go on forever. The graph above shows actual German GDP 1995-2010 (black line) compared to the attractor path and prediction intervals generated by the DE20 model (dashed lines). The solid red lines are the extrapolations based on short-run thinking. Between 1995 and 2000, an extrapolation would have shown explosive takeoff into sustained growth. Disappointing performance after 2000 would have led to a more modest extrapolation against which the 2001-2005 recession was measured. Against four years of recession, however, the collapse after the European Sovereign Debt Crisis of 2009 looks quite spectacular. From the standpoint of the DE20 model, however, the entire path of development starting in the late 1990's was a protracted bubble that eventually broke in 2009, a typical overshoot-and-collapse scenario.
Iceland provides another example of extrapolating growth from current trends without realizing that these projections are really the beginning of a bubble (here). As with Germany, Iceland also went through a period of Neoliberal reforms after poor performance from the mid-1980s to the mid-1990s (perpendicular red lines in the graph above). From the mid-1990s to the Financial Crisis of 2007-2008, Iceland's growth looked spectacular but was actually based on financialization rather than sustainable economic growth. In 2010, the Icelandic economy returned to its attractor path generated by the IS20 model (the attractor path is the result of simulating the model starting in 1960 rather than making year-to-year projections which are based on bubble-generated, nonrandom errors).

The same thing happened in the US starting in 2003 (here). The Bush II Administration (2001-2009) started out with a period of underperformance as a result of the 9/11 Terrorist Attack on the World Trade Center. However, starting in 2003 the economy took off and grew rapidly until the peak in 2007 and collapse in 2008. That this was a bubble can be clearly seen from the attractor path created by simulating the USL20 model starting in 1950. Growth during the Bush Bubble was clearly the result of Neoliberalism and financialization. The financial innovation of mortgage-backed securities (MBS, the acronym should giveaway what this was all about) created a bubble in the US housing market that was popped when low introductory-rate mortgages reverted to regular interest rates that borrowers were unable to pay.


If you only use a forecasting model, you might conclude that a country did not experienced a bubble during the 2007-2008 Financial Crisis and Great Britain provides a good example (here). The graph above shows the real GDP forecast for the United Kingdom. For most of the late 20th century, the British economy stayed within a very narrow range around the forecast line (the best attractor for the GB GDP model is driven by the North American economy, that is, the NAC20 model). My conclusion from this result is that the British Austerity experiment which generated so much pain for the country was largely unnecessary (it is another question whether Austerity is useful under any circumstances).

However, if you look at the attractor path for GDP in Great Britain, you can very clearly see the bubble developing after 2000 when the economy gets above the 98% prediction interval (upper dashed red line). You can also see that the return to the attractor line in late 2009 stayed within the lower 98% prediction interval (lower dashed green line). From this perspective, the Austerity experiment was still basically unnecessary. In general, the economy of the United Kingdom showed cyclical performance during the post-Neoliberal (post-Thatcher) period and did not seem to take-off until the early 1990's. However, the period from the early 1990's until the  2007-2008 Financial Crisis was both a return to the attractor line (around 2000) and then over-shoot from 2000-2007.

From the standpoint of attractor theory and the explanation of bubbles, the difference between the last two graphs is simply that in the forecast graph, step-ahead predictions are being made. In the attractor path, the model is given initial conditions in 1960 and then is simulated forward until 2015. Year-to-year cumulative errors, the kind of nonrandom errors that generate bubbles, are not include. The same model generated both graphs, the simulation methods were just different.

There appear to be two conflicting views surrounding stock market bubbles. The Behavioral Finance view is that stock market bubbles are the result of irrational exuberance, that is, booms and panics are created by the irrational behavior of investors. The Efficient Market Hypothesis (EMH) holds that (1) prices contain all the information available about stocks so prices are rationally determined and (2) that future prices cannot be predicted because stocks follow a random walk model. These two premises imply that there cannot be bubbles, that is, the stock price is what it is and a random walk has no attractor value, that is, the stock price can be anything. I am exploring the EMH in another place (here). So far, using multiple state space models and the AIC criterion, I have found very few stocks that are best described by a random walk and, looking at the attractor path for the SP500 index (^GSPC in the graph above), we can very clearly see the Dot-com Bubble and the Subprime Mortgage Crisis. Interestingly, the best forecasting model for the SP500 is the US economy (the state variables of the USL20 model) while the best attractor model for the SP500 is the World economy (the state variables of the WL20 model).
One of the stocks that I have studied in most detail is Apple Computer (AAPL, here). My interest was driven not only by the constant barrage of attention given to AAPL on the financial news networks but also by my ownership of AAPL stock, that is, until September of 2012 when my models were screaming SELL, SELL, SELL (as were my financial analysts). From the dynamic attractor graph above we can clearly see that AAPL was, for much of 2012, in bubble land. Currently, the AAPL stock price is well below the lower 98% prediction interval for the stock and clearly undervalued. However, the time plot of the stock price is not a random walk--the best attractor model is being driven the WL20 model.

Dynamic attractor theory is unlikely to be accepted as an explanation for bubbles. The theory does not say when the bubble will start. The theory does not say when the bubble will pop. The theory does not say when the system will return to its attractor value. What dynamic attractor theory would be useful for is identifying when a bubble is developing. The information could be used by investors (start buying below the attractor path and start selling above the attractor path--the longer you stay in a bubble market the more likely the collapse and the more risk). For governments, economic policy actions could be based on departures from the dynamic attractor path (the US Federal Reserve, for example, could tighten interest rates to reduce the overshoot). Although it may not be possible to eliminate bubbles, it might be possible to reduce their magnitude and reduce the amount of societal damage that results from the collapse.

We are a long way from fully testing dynamic attractor theory. For the future, there are many historical examples of potential bubbles that could be investigated. I will also investigate in detail the existing ideas and theories of bubbles to lay a better foundation for dynamic attractor theory. Finally, all the models have be developed within the public domain R programming language and will also be placed in the public domain. In a future post, I will explain how to access and use the models.

TECHNICAL NOTE: Here are the AICs for the best attractor models presented above: (1) US GDP Model, AIC = 2469.259 (start=1950,n=241), (2) AAPL Stock Price Model, AIC = 3307.542 (start=1984.9,n=329), (3) The Iceland GDP Model, AIC = 2146.228 (start=1960,n=51), (4) The German GDP Model, AIC = 2714.087 (start=1960,N=51), (5) The United Kingdom GDP model, AIC = 2716.058 (start=1960,n=51),and (6) the SP500 model, AIC = 8037.028 (start=1950,n=733). All the AICs were computed from the free simulation, not from the statistical estimates.

Tuesday, February 19, 2013

Will There Always Be Bubbles?

Yale Economist Robert Shiller recently wrote an op-ed piece for Project Syndicate titled Bubbles Without Markets. His basic argument is that there will always be economic bubbles and that, at least in a market economy, these bubbles are far more mild than non-economic bubbles. But, just what are non-economic bubbles and what is the average person to do to protect themselves if economic bubbles are inevitable?

Shiller starts out the article with a nice definition of bubbles:

A speculative bubble is a social epidemic whose contagion is mediated by price movements. News of price increase enriches the early investors, creating word-of-mouth stories about their successes, which stir envy and interest. The excitement then lures more and more people into the market, which causes prices to increase further, attracting yet more people and fueling “new era” stories, and so on, in successive feedback loops as the bubble grows. After the bubble bursts, the same contagion fuels a precipitous collapse, as falling prices cause more and more people to exit the market, and to magnify negative stories about the economy.
Read more at http://www.project-syndicate.org/commentary/bubbles-without-markets#4luigKezyXrskezB.99 


The important points are the idea of positive feedback and contagion, two processes that create both the inflation and the deflation period in bubble formation.

Shiller looks at bubble formation as a general social process that describes not only market activity (the Mississippi Bubble 1719-20, the South Sea Company Bubble 1711-20 and the Tulip Mania of the 1630) but also non-market social epidemics (belief in alchemy, prophets of Judgement Day, fortune telling, astrology, magnet and crystal therapy, witch hunters and the Crusades). Some of these social epidemics, such as the Crusades, had much worse consequences for society than did the Subprime Mortgage Crisis (see Charles MacKay’s 1841 best seller Memoirs of Extraordinary Popular Delusions and the Madness of Crowds).

Shiller concludes that:

The recent and ongoing world financial crisis pales in comparison with these events. And it is important to appreciate why. Modern economies have free markets, along with business analysts with their recommendations, ratings agencies with their classifications of securities, and accountants with their balance sheets and income statements. And then, too, there are auditors, lawyers and regulators.
All of these groups have their respective professional associations, which hold regular meetings and establish certification standards that keep the information up-to-date and the practitioners ethical in their work. The full development of these institutions renders really serious economic catastrophes – the kind that dwarf the 2008 crisis – virtually impossible.

Read more at http://www.project-syndicate.org/commentary/bubbles-without-markets#4luigKezyXrskezB.99 


Shiller doesn't say this in the article but in other places (here) he has argued that the expansion of insurance to cover a whole range of events (to include impacts from economic bubbles) would allow the average person to weather these catastrophes without further intrusion of the government in the market economy. Insurance would be great and might eventually happen in the distant future, but it would require a number of things to fall in place that seem unlikely: insurance companies would have to offer such vehicles and pay up during a general economic downturn, people with enough financial knowledge and foresight would have to buy such vehicles (rather than spending their money on immediate consumption) and people would have to have enough disposable income to devote a lot of it to all the possible things they might need insurance against (think about getting health insurance on the private market). In the end (just as with health insurance), the answer is still government intervention. The US does have unemployment insurance, food stamps and welfare assistance, as long as the Right-Wing does not destroy these New Deal achievements. Eventually, the US will probably end up with Single Payer health insurance. And, some of the financial abuses during the Subprime Mortgage Crisis certainly should be controlled with government regulation.

This still leaves open the question of whether economic bubbles can be controlled by some sort of government action such as monetary policy. The first problem on the way to controlling bubbles is to be able to identify them as they develop (the topic of this blog). Even if the government cannot do anything to prevent economic bubbles, it would be useful information to anyone interested in protecting themselves against catastrophes.

Monday, February 11, 2013

Should The Fed "Pop Bubbles"?


Recently, Matthew Yglesias posted a note on MoneyBox arguing that the US Federal Reserve should be trying to stabilize nominal GDP rather than attempting to "pop bubbles" (here). He was responding to a speech (here) by Jeremy C. Stein, a Harvard Economics Professor and member of the Board of Governors on the US Federal Reserve. Professor Stein was trying to figure out what caused the Financial Crisis of 2007-2008. Stein's hope was that some indicators of the developing "bubble" could be found that would signal the Fed to take some policy action. Yglesias, a Harvard alumnus and economics blogger, was arguing that the Fed should not pop bubbles but rather concentrate on stabilizing nominal GDP.

Yglesias bases his argument on the graph above. He feels that to characterize the Bush years as having launched with a "jobless recovery" is a mistake. Rather, he constructs a peak-to-peak trend line (the solid red line) and argues that the early Bush years were actually a period of "sub-trend GDP growth" and the supposed "bubble" is only a brief period between 2007 and the crash in 2008. A bubble this small and this brief would be hard for the Fed to recognize and monetary policy would not have been able to respond quickly enough to avert the crash. He concludes that the Fed should try to regulate guaranteed financial institutions, regulate fraudulent lending practices and "...stabilize the path of nominal GDP." To the last conclusion, my question is "Which nominal GDP path?"

If we construct a trough-to-trough GDP trend line we can see the end of the Clinton Bubble and the development of the Bush Bubble (the yellow line that I have placed in the graph above). The Obama years are simply a return to the linear trend line. This approach would have given the Fed five years to see the coming crash and potentially pop the developing bubble with tight monetary policy. In other words, whether we think the red line or the yellow line is the stabilized GDP path makes a lot of difference. How do we decide?

Proposals have been floated by analysts at Goldman-Sachs (GS, here) showing how to calculate a "nominal GDP target" that could be used by the Fed to guide monetary policy. It is also being argued (here) that Fed Chairman Ben Bernanke may have "capitulated" and now supports a nominal GDP target.

The graphic above is taken from the GS report. The "nominal GDP trend" line (target) looks very much like a peak-to-peak line. However, the GS line is drawn by extrapolation backwards from 2007Q4 assuming a 5.3% growth rate and extrapolating forward using a 4.5% growth rate. The forward projection is the sum of real potential GDP growth (2.5%) and inflation (2%). The report, however, argues that "The specific numbers matter less than the Fed's willingness to target a path that is anchored at a point like 2007, when the economy was near full employment..."

The peak-to-peak path is probably the path the most economists would say is correct or at least is the "full-employment GDP" line that policy should be directed at. It is obviously what the economy is capable of generating and must, in some sense, be optimal. If an economist believed that an economy could overheat, as Prof. Stein seems to in his speech, then maybe the trough-to-trough line provides a better "temperature" path for the economy.

In a number of other postings on "economic bubbles" (I will try to bring them together in a summary post) I have argued that drawing lines on graphs, whether based on peak-to-peak or growth-rate projections (exercises commonly done by financial analysts and economists) is arbitrary. We need a statistical model that can both fit the data and generate a path for the economy that is independent of shocks, bubbles and other random (or nonrandom) events that generate the data we are looking at (GS offers a "toy" model in their paper, it is not statistically estimated, has no error terms and does not produce prediction intervals for the policy experiments). If 2007 is the peak of the bubble then using 2007Q4 as the full-employment target is the same as arguing that the Fed should use monetary policy to generate another bubble.


My attractor path for real GDP (GDPC96*) was presented in an earlier post (here) and a close-up view of the Subprime Mortgage Bubble is presented above. How this graph was constructed is described in a technical note below. What is important to understand is that the lower 98% confidence interval (dashed blue line) for the model-based attractor path is very close to the trough-to-trough line while the peak-to-peak line is well outside the upper 98% prediction interval (dashed green line). It also should be pointed out that in 2010Q1, real GDP was right on GDPC96*.

This exercise makes a number of points about whether Fed policy should be directed a popping bubbles: (1) Bubbles are clearly visible if you draw a conservative trend line for target GDP. (2) Professor Stein's concerns then over finding other indicators (see the Technical Note below for the list of Stein's potential indicators) to tell whether credit markets are "over heating" would only be useful if you are trying to determine when the bubble will pop. (3) The politics of setting conservative target GDP trend lines are horrible. Financial pressure groups, such as Goldman-Sachs, will not accept conservative GDP targets and neither will any other member of the US political or economic elite. Everyone wants maximum economic growth and no one was happy with economic performance in 2010 when the economy was on the model-based attractor path. (4) The current problems the Fed is having with the zero-bound (interest rates are near zero, real interest rates are negative and the Fed funds rate is no longer a useful policy instrument) is the result of letting the bubble develop without gradually increasing interest rates starting in 2004. When we get to the peak of the bubble with low interest rates, there is no where to go when the bubble pops.

In summary, if the Fed could set a conservative path for target GDP (nominal or real) and if interest rates start increasing as the bubble starts forming (GDP above the target path), then the Fed has a chance of stabilizing GDP. If the Fed follows Mr. Yglesias, Goldman-Sachs and others who call for a peak-to-peak target path for GDP, the Fed doesn't have a chance of either stabilizing GDP or popping any bubbles.

TECHNICAL NOTE: The GDPC96* forecast was generated in a number of steps. First, five competitor time series models were estimated: (1) a random walk model, (2) a business as usual (BAU) model (similar to the GS forecasting approach), (3) a full-employment structural model (similar to a Keynesian full-employment model or a full-employment economic growth model) predicting GDPC96 from CE160V (Civilian Employment data from the St. Louis Fed), (4) a system model where GDPC96 is driven by the state of the US economy (state variables from the USL20 model) and (5) a system model where GDPC96 is driven by the state of the World economy (state variables form the WL20 model). The best model, based on step-ahead predictions and using the lowest AIC criterion was the BAU model.

The BAU model, however, was not that useful for defining GDPC96*. The AIC comparison was made using step-ahead predictions which are subject to error from the last period. To eliminate that error, each model was simulated starting in 1950 only using initial conditions and predicted input variables, if any. This is called a free simulation and produces an attractor path free of year-to-year error.  The best attractor model, again using the AIC criterion, was now the WL20 state-variable model. The time series graph above was constructed using a bootstrap free-simulation procedure to generate the 98% prediction intervals.

The input variables in the GDPC96 WL20 model contain none of the variables that Jeremy Stein looks at in his paper (here): high-yield share of corporate bond issuance and excess returns, syndicated leverage loan issuance, credit spreads on high-yield corporate bonds, payment-in-kind (PIK) bond issuance, covenant-lite loan issuance, dividend recapitalization loan issuance, average debt multiples of large corporate LBO loans, dealer financing of corporate debt, inflows into high-yield mutual funds, inflows into high-yield ETFs, total agency REIT assets, and collateral transformation transactions). These are all interesting dependent variables that could be forecast in the same way that GDPC96 was. If attractors can be found for these financial variables, departures from attractor values could be correlated with departures from GDPC96*. However, from a causality perspective, if the same bubble forces are pushing financial variables away from equilibrium there is likely to be a lot of confounding in such an analysis. From a control perspective, we need to take departures from GDPC96* and feed them back to control the input variables so that the bubble never happens.

The GDPC96 model was developed entirely in the public domain using the R programming language. Instructions for using the model are available here, here and here. The GDPC96 model is available to download here.