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, April 17, 2025

Boiler Plate

 


State Space Model Estimation

The Measurement Matrix for the state space models was constructed using Principal Components Analysis with standardized data from the World Development Indicators. The statistical analysis was conducted in an extension of the dse package. The package is currently supported by an online portal (here) and can be downloaded, with the R-programming language, for any personal computer here. Code for the state space Dynamic Component models (DCMs) is available on my Google drive (here) and referenced in each post.


Atlanta Fed Economy Now

My approach to forecasting is similar to the EconomyNow model used by the Atlanta Federal Reserve. Since the new Republican Administration is signaling that they would like to eliminate the Federal Reserve, the app might well not be available in the future.


While the app is still available, there have been some interesting developments. In earlier forecasts, the Atlanta Fed was showing GDP growth predictions outside the Blue Chip Consensus. Right now, after unorthodox economic policies from the Trump II Administration, the EconomyNow model is predicting a drastic drop in GDP (the Financial Forecast Center is only predicting a slight drop here).

Climate Change

Another comparison for what I have presented above are the IPCC Emission Scenarios. These scenarios are for the World System. Needless to say, (1) the new Right-Wing Republican administration plans on withdrawing the US from all attempts to study or ameliorate Climate Change and (2) the IPCC does not produce any RW modes for the World System (but seem my forecasts here).


World System

The longest running set of data we have for the World-System is the Maddison Project based on the work of Angus Maddison (more information is available here). Data on production (Q) and population (N) for most countries and regions runs from years 0-2000. More data becomes available as we near the year 2000. 


Available data were entered in a spreadsheet (see Population above, double click to enlarge). Missing data were interpolated with nonlinear spline smoothing using the R programming Language.


In cases where initial values were not available (see GDP above), the E-M Algorithm was used to estimate initial conditions.

From the graph of GDP above (W_Q) for the World System, it can be seen that economic growth from the year 0-1500 was basically flat. The period of British Capitalism (after 1500) had a small plateau of growth. Takeoff does not happen until the Nineteenth Century.



From a system's perspective, the only model that can be tested for the entire period is Kenneth Boulding's Malthusian Systems Model [Q,N] = f[Q,N].



When developed as a State Space model (measurement matrix above) there are two components: W1=Growth and W2=(Q-N), the Malthusian Controller. When more data is available, the Malthusian Controller can be generalized to other SocioEconomic theories.

What the Malthusian Controller shows (plotted as Q-N above) is that a long-developing Malthusian Crisis (Q<N) started in the Late Middle Ages and accelerated through the period of British Capitalism (Dark Satanic Mills) and was reversed spectacularly during the Nineteenth Century.  Takeoff in response to a deepening Malthusian Crisis would not be an unreasonable way to view Modern Economic Growth.

Error Correcting Controllers (ECC)


In another post (here), I presented Leibenstein's Malthusian Error Correcting Controller (ECC). It can be generalized to the dominant ECCs in most theoretical economic models (above). These controllers can be further generalized. For example, (X-U) and (L-U) can be generalized to (N-U), a more general Urbanization Controller which describes market expansion for economic growth. In countries and periods with limited data, (N-U) might subsume all these processes. ECCs describe important feedback processes in SocioTechnical System that are typically not recognized as such in academic literature.

Kaya Identity



The basic theoretical model underlying all the World-System models I crate is the Kaya Identity. There are a number of advantages to starting theoretical development with the Kaya Identity: (1) An "identity" is true by definition Adding other variables to the model ensure that theory construction is on a solid footing. (2) The Kaya Identity is also used as the foundation for the IPCC Emissions Scenarios allowing a linkage between World-Systems Theory and the work of the IPCC.


World Development Indicators (WDI)



After WWII, extensive data sets on all countries in the World-System became available from the World Bank (here). The indicators above where chose to construct the state space for each WDI-based model. Addition indicators can be added for specific forecasts and analyses.

Tuesday, April 8, 2025

World-System (1900-1950): Did the Smoot-Hawley Tariff Cause the Great Depression?

 




US President Donald Trump recently said (here) that low tariff's caused the Great Depression. But, the Smoot-Hawley Tariff Act of 1930 raised tariffs right after the Stock Market Crash of 1929 and GNP continued to collapse dramatically. Is Trump wrong about tariffs, as almost every economist claims?

Sorting causality out during the early Twentieth Century is difficult (so much was going on) and compounded by lack of agreement among economists and historians (see Fearon, 1987). When I was in Graduate School I was told not to wade into this area because it was way too controversial. Obviously, nothing has changed since the 1980s.

But, here's my attempt to explain the period in the US. The graphic above shows actual GNP (dark black line) and the World System attractor path for GNP (dashed red line) based on the USGD model (and WGD Model here). What you are looking at is the mother of all bubbles caused by WWI (a similar Bubble happened during WWII but GNP was below the attractor path at the start of the War) and the Roaring Twenties. The Bubble was popped by the Stock Market Crash of 1929 (not the Smoot-Hawley Tariff). Once the Bubble had been popped, GNP had no where to go but back to the attractor path (dashed red line) where it stayed until well into WWII. 

Part of the problem with my explanation is that Free-Market Economists will not admit that Economic Bubbles exist (the market is always perfect). From the perspective of World-Systems Theory, the assumption of market perfection makes it impossible to understand the Great Depression. Economic collapse should never happen; bubbles shouldn't happen. Keynesian Economics threw out market perfection, but Neoliberalism is the dominant ideology today and we are blinded by it.

Tuesday, March 18, 2025

World-System (1970-2020) The Bubbly Economy of Argentina

 



The Economy of Argentina has been through some things: Military Coups, Recessions, Inflation, Neoliberal Austerity measures, IMF interference, Protests, etc. etc. The graphic above shows actual GDP (dark line) compared to the attractor path (dashed red line) and the 98% prediction intervals. It's not a pretty picture. For most of the late 20th Century, the economy was underperforming. After 2000, there was an Economic Bubble that eventually popped and allowed the economy to return to the attractor path (you can read the details here).


Looking at the 2003-2008 Expansionary Monetary Policy Bubble more closely, the bubble began after 2005 and was popped by the 2008 Global Financial Crisis. By 2012, the economy had returned to the attractor path (dashed red line) with growth ranging from1-2%.


The period from 1975-1990 was not good for the Argentinian economy and is sometimes describe as a period of stagflation. From 1989 to 1990, Argentina endured a hyperinflation shock. Minister of the Economy Domingo Cavallo instituted Austerity measures (trade liberalization, deregulation, and privatization) in addition to pegging the Peso to the US Dollar. Inflation has been well below the attractor path (dashed red line above) since then.

The Austerity measures (AUST1 above, see Shefner et. al.) kicked in after the hyperinflation and extended well into the 21st Century.


And, poor economic performance leads to hardship (HARD2 above, see Shefner et. al.).




Monday, August 18, 2014

War and 'Normalcy': 1914-29


Peter Fearon has written a great book on the US Great Depression titled War, Prosperity & Depression: The U.S. Economy 1917-45. It's an excellent summary of the literature up to 1987, when the book was written. Prof. Fearon is a British historian. He writes from a very broad perspective and is not wedded to any one pet theory of the US Great Depression, as are many US economists. If we're going to understand the Inter-War years and the Economic Bubble Machine, Fearon's book is a great place to start. I'm going to go through every chapter in the book in upcoming posts and compare results from my own State Space models of the period. The intent is to see whether the theory of Complex Dissipative Systems will provide any insight into the causes of the US Great Depression.

Fearon starts out Chapter 1 by describing growth from 1870 as having been strong enough to make the US the "world's leading industrial power" in 1914 on the eve of WWI. After WWII, the US would clearly be the dominant world power. To understand this period of hegemonic succession (Great Britain was the dominant power in the 19th Century being challenged in Europe by Germany), we will have to, at some point, look back at the 19th Century. For now, it is enough to say that the InterWar period was chaotic and that the future dominance of the US was not preordained. The Great Depression could well have crippled the US. Two Wars had to be fought to decide that Germany would not succeed Great Britain as the dominant power in Europe. The Wars did not have to turn out the way they did. There will be no simple, monocausal explanation for the period; randomness and uncertainty will always remain dominant factors.

On the eve of WWI, Fearon lists a number of attributes of the US Economy: growing monopoly power, spread of mass production methods, vertical integration of firms, the ascendancy of professional managers, the use of scientific management (Taylorism), the growth of new technologies, economic specialization (division of labor), standardization and use of the continuous assembly line (Fordism), urban expansion, growth of retailing, and a large agricultural sector producing surplus output. In summary "...the US was a vigorous, high wage economy, capable of either taking European inventions, such as the automobile, and adapting them to the American market or exploiting to the full the ideas of her own people" (p. 6).

The outbreak of WWI, however, was a shock to the US economy. European markets were closed. War financing was needed. Workers had to be shifted from agriculture to industry and labor shortages developed. The War created inflationary pressures and prices began to rise. In the graph at the top of this page, the US Wholesale Price Index (P.WPI.) is plotted from 1913-1923 (Fearon presents price data for six industrial commodities on page 10). The dashed red line in the figure is the attractor path for P.WPI. From the start of WWI well into the 1920, the price bubble is quite evident. However, in 1923 wholesale prices had returned to the dynamic attractor path.


The attractor path for P.WPI. is being driven by the overall price level (P.GDP.) which is plotted above along with it's attractor path. The attractor path for overall inflation was stable and was driven by Gross Domestic Product. The inflationary bubble popped in 1920 but inflation was still not on the attractor path by 1923. Fearon (page 11) seems to attribute the continuing inflationary pressures to the US Federal Reserve, which had been founded in 1913 and was still pushing expansionary monetary policy in 1919. What is somewhat interesting about the period is that many regulatory agencies were founded to deal with War mobilization and the War Industries Board (WIB) did have "wide-ranging powers to set priorities and even fix prices," but seemed to have little actual impact on controlling inflation.


Fearon devotes a section of Chapter 1 (starting on page 15) to the Post-War Boom and Bust which can be seen clearly from the time series plot above. The attractor path (dashed red line) is being driven by the state of the US economy generated by the US20E model (a simple Kaya Identity model, all in real variables). The red and the green dashed lines are the upper- and lower-98% bootstrap prediction intervals for GNP. What is interesting about the attractor path is that the US economy under-performed during the years before WWI and really did not start to take off until 1915 (World War I lasted from 1914-1918) a year after the war had started. After 1917, the US economy moved into highly improbable territory and was not on the attractor path even after the Post-War Bust.

The Post-War bust is conventionally described as a recession made worse by inept monetary policy:

There can be little doubt that the actions of the Federal Reserve made the ensuing recession a good deal worse. The restriction in credit hit business generally but especially the construction industry and also automobile sales, which depended upon the ability of consumers to borrow cheaply. In addition, commodity dealers and speculators panicked when faced with the rising cost of borrowing and quickly unloaded their stocks, causing massive price falls. (Fearon, 1987: 17)

The argument is based simple straight-line extrapolation from historical data points. In the graphic above, a straight-line extrapolation from some historical data point defines the "slump" afterwards. Lines A and C make the slump look particularly "severe" while lines B and D a little less so. Each extrapolation line assumes that some historical trend (however short) can be maintained into the future. Taking a longer perspective and deriving a model-based attractor path gives a different picture, a return to normalcy after WWI (in Warren G. Harding's words) that was never really completed (if "normalcy" means the dynamic attractor path which was not Harding's definition of "normalcy").



Over the entire Roaring Twenties, as seen from the GNP attractor plot from 1919-1930 above, the US Economy never really returned to the attractor path until the start of the Great Depression. And, rather than a soft landing, the economy crashed. Partly, these are definitional issues. A recession should be defined as a drop below the lower 98% confidence interval not just any drop in production from some level. Partly, these are modeling issues. Any historical GNP point reflects the sum of prior "errors" in the model. GNP(t3) = f[(GNP(t2) + E(t2)+GNP(t1) + E(t1)) + E(t3) while the attractor path starts at (t1) and moves forward without including modeling errors. If the errors are predominantly positive, as they were from 1914 to 1919, we have an Economic Bubble (the Roaring Twenties). The Age of Prosperity, as the 20's was also called, really was a bubble and was not prosperous for farmers, working-class laborers, African Americans and other minorities.



What is also unusual after WWI is that there was no unemployment crisis even though the economy was in "recession". The time series plot for the US Labor Force (L.US.E. above) shows that employment was below the attractor path until 1923. After 1924 until the start of the Great Depression, employment was actually above the dynamic attractor path. Fearon presents data (page 24) to show that the jobs were created mostly in the Wholesale and Retail sectors in response to a strong period of consumption expenditure. What is important to point out here is that Economic Bubbles create employment bubbles. The "bubble" jobs are lost when the bubble pops and will not return unless the bubble is reflated.

In Chapter 1, Fearon brings up many issues in passing that, hopefully will be dealt with in future chapters: (1) the impact of the New Deal vs. WWII, (2) the growth of Inequality, (3) the role of economic growth and competition in the 19th Century, (4) Weakness in Agriculture, (5) the role of Urbanization in expansion of the internal market, (6) the impacts of Federal Reserve "stop-and-go" monetary policy, (7) Price inflation and deflation, (8) Bank Failures and financial markets, (9) Stock Market speculation, (10) the end of European Immigration during the Inter-War years and (11) Crisis in the Housing Market. All of these issues and the analysis above should ring bells for those of us who have lived through the current Great Recession and Financial Crisis of 2007-2008. The difficult task will be to disentangle what is common and what is different about the two periods.

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.