Understanding Business Cycles
with Markov Chains

← Back to Home

Introduction

In macroeconomics, we often discuss how economies experience booms and recessions, with periods of normal growth in between. But what causes these cycles, and how can we simulate them? What insights can Markov models give us into what economists call an “equilibrium”?

One way to model business cycles is to use a Markov chain, in which the economy switches between states such as Weak, Normal and Strong growth with specified probabilities.

How do Markov models work?

The key assumption of a simple Markov model is that to predict the economy’s state in the next quarter, all you need to know is its current state. The entire history of how the economy arrived at its current state doesn’t matter. For example, if the economy is currently in a “Normal” state, the model uses a set of probabilities to determine if it will stay “Normal,” transition to a “Strong” phase, or slip into a “Weak” phase in the next quarter. It doesn’t care whether the economy was booming or in a slump two years ago - only its state today matters for tomorrow’s forecast.

This simple “memoryless” property makes these models easy to work with, allowing us to quantify the likelihood of staying in a boom, entering a recession, or recovering to a stable trend.

Why is a Markov model useful?

It helps identify hidden regimes. If you look at a chart of GDP growth over time, you will see that it rises and falls, but it is not always obvious when the economy has genuinely shifted into a new phase. A Markov model provides a rigorous way to estimate the statistical characteristics of each phase (for example, the average growth rate and volatility in a “Strong” phase compared with a “Weak” one) and to assign probabilities to the state the economy is most likely to occupy at any given time.

It provides a framework for simulations and “what-if” scenarios. Once we have estimated the probabilities of moving between states, we can run thousands of simulations to see what the future might look like. We can ask questions such as: “What is the probability of a recession in the next 12 months?” or “If we remain in a ‘Weak’ state for two quarters, what are our chances of recovery?” This is a powerful tool for forecasting and for testing different policy interventions. For example, a policymaker could use a simulation to examine how fiscal stimulus might affect the likelihood of moving from a “Weak” to a “Normal” state.

It quantifies uncertainty. Rather than giving a single forecast, a Markov model can provide a range of possible outcomes and their probabilities, producing a richer and more realistic picture of the future. This is particularly relevant in a world in which a single shock can generate highly uncertain and volatile outcomes.

Setting Up the Markov Model

Below is the R code to create a simple 3-state Markov chain and simulate the resulting GDP path.

In this example,

  • Weak = negative growth (on average, -1% year on year)
  • Normal = steady positive growth (on average, +2% year on year)
  • Strong = faster-than-normal growth (on average, +4% year on year)

The Transition Probability Matrix (TPM) is a table showing the probability of moving from one state to another in any given period. For example, our matrix specifies a 75% chance of remaining in a “Normal” state, a 15% chance of moving into a “Strong” state and a 10% chance of slipping into a “Weak” state. Taken together, the transition probabilities imply that the economy will spend 50% of the time in the “Normal” state in the long run.

The code enables us to simulate how these states influence real GDP growth over time, producing a growth series that fluctuates with the business cycle.

Code
knitr::opts_chunk$set(echo = TRUE)

# Load required packages
library(ggplot2)
library(dplyr)
library(tidyr)

# Set random seed for reproducibility
set.seed(123)

# State names for clarity
state_names <- c("Strong", "Normal", "Weak")

# Define the Transition Probability Matrix (TPM)
P <- matrix(c(
  0.70, 0.25, 0.05,
  0.15, 0.75, 0.10,
  0.05, 0.25, 0.70
), byrow = TRUE, nrow = 3, dimnames = list(state_names, state_names))

# Display the matrix and check its row and column sums
P
       Strong Normal Weak
Strong   0.70   0.25 0.05
Normal   0.15   0.75 0.10
Weak     0.05   0.25 0.70
Code
rowSums(P)
Strong Normal   Weak 
     1      1      1 
Code
colSums(P)
Strong Normal   Weak 
  0.90   1.25   0.85 
Code
# Calculate Stationary Distribution
eigen_result <- eigen(t(P))
target_eigen_value_index <- which.min(abs(eigen_result$values - 1))
stationary_dist <- Re(eigen_result$vectors[, target_eigen_value_index])
stationary_dist <- stationary_dist / sum(stationary_dist)
if (any(stationary_dist < 0)) {
  stationary_dist <- abs(stationary_dist) / sum(abs(stationary_dist))
}
names(stationary_dist) <- state_names

cat("Calculated Stationary Distribution (S, N, W):\n")
Calculated Stationary Distribution (S, N, W):
Code
print(stationary_dist)
   Strong    Normal      Weak 
0.2857143 0.5000000 0.2142857 
Code
cat(sprintf("Normal state long-run probability: %.2f%%\n", stationary_dist[2] * 100))
Normal state long-run probability: 50.00%
Code
# Define the economic characteristics for each state
mean_gdp_growth <- c(Strong = 4.0, Normal = 2.0, Weak = -1.0)
sd_gdp_growth <- 0.8

Reading the transition matrix: rows and columns

Each row begins with the economy’s current state and shows all the states it could occupy next period. The first row, for example, asks: if the economy is Strong now, what could it be next quarter? It gives a 70% chance of remaining Strong, a 25% chance of moving to Normal and a 5% chance of moving to Weak.

These alternatives exhaust the possibilities, so every row must sum to one:

\[ 0.70+0.25+0.05=1. \]

This is the essential probability constraint on a transition matrix. Every entry must lie between zero and one, and every row must sum to one (or 100%). In plain language, given where the economy is today, it must be somewhere next period.

The columns should be read differently. A column collects the probabilities of arriving in a particular state from several different starting states. The Normal column contains:

  • a 25% probability of moving from Strong to Normal;
  • a 75% probability of remaining Normal; and
  • a 25% probability of moving from Weak to Normal.

These add to 1.25, but this does not imply a 125% probability of being Normal. The three probabilities answer different conditional questions because each assumes a different current state. Adding them is rather like adding the probability of passing an examination for students who studied extensively, studied moderately or did not study: the resulting total is not an overall pass probability unless we also know the proportion of students in each group.

Consequently, individual columns do not generally have to sum to one. With three states, each column sum must lie between zero and three, while the three column sums together must equal three because the three row sums each equal one. More generally, for an \(n\)-state transition matrix, all the column sums together equal \(n\).

Column sums can nevertheless offer a useful preliminary intuition. In this example, they are 0.90 for Strong, 1.25 for Normal and 0.85 for Weak. The relatively high Normal column suggests that Normal is accessible from all three starting states and acts as something of a gravitational centre. However, this comparison gives equal weight to each starting state, irrespective of how frequently it occurs.

To calculate genuine next-period probabilities, we must weight each row by the economy’s current probability of occupying that state. If the three current states were initially equally likely, the next-period probabilities would be the column sums divided by three: 30.0% Strong, 41.7% Normal and 28.3% Weak. This is only the distribution after one transition from an initially equal distribution; it is not the long-run distribution.

The stationary distribution calculated above repeatedly allows for the economy’s changing distribution across the three starting states. It is the distribution that reproduces itself after another transition. For this matrix, the long-run probabilities are approximately 28.6% Strong, 50.0% Normal and 21.4% Weak. Thus, if the economy already has these probabilities, applying the transition matrix leaves them unchanged.

If every row and every column sum to one, the matrix is described as doubly stochastic. An equal probability for each state is then a stationary distribution. If the chain is also irreducible and aperiodic, this distribution is the unique long-run distribution towards which the system converges. Our matrix is not doubly stochastic, so its long-run probabilities are not one-third each.

Simulate states over 200 periods

Code
num_periods <- 200
initial_state_index <- 2

# --- Simulation ---
states_sequence <- numeric(num_periods)
gdp_growth_sim <- numeric(num_periods)

current_state_index <- initial_state_index
states_sequence[1] <- current_state_index
gdp_growth_sim[1] <- mean_gdp_growth[current_state_index] + rnorm(1, 0, sd_gdp_growth)

for (t in 2:num_periods) {
  current_state_probs <- P[current_state_index, ]
  next_state_index <- sample(1:3, 1, prob = current_state_probs)
  
  states_sequence[t] <- next_state_index
  current_state_index <- next_state_index
  
  gdp_growth_sim[t] <- mean_gdp_growth[current_state_index] + rnorm(1, 0, sd_gdp_growth)
}

# --- Prepare data for plotting ---
sim_data <- data.frame(
  Time = 1:num_periods,
  State = factor(states_sequence, levels = 1:3, labels = state_names),
  GDP_Growth = gdp_growth_sim
)

# --- Simulated GDP Growth with states shown ---
p1 <- ggplot(sim_data, aes(x = Time, y = GDP_Growth, color = State)) +
  geom_line(aes(group = 1), color = "#002060", alpha = 0.8) +
  geom_point(alpha = 0.8,size=2) +
  scale_color_manual(values = c("Strong" = "darkgreen", "Normal" = "steelblue", "Weak" = "firebrick")) +
  labs(
    title = "Simulated Macroeconomic GDP Growth",
    subtitle = paste0("Long-Run Probability of Normal State: ", round(stationary_dist["Normal"] * 100, 2), "%"),
    x = "Time Period (Calendar Quarters)",
    y = "GDP Growth Rate (%)"
  ) +
  theme(plot.title=element_text(size=24,hjust=0.5,colour="#002060"),
        plot.subtitle=element_text(size=20,hjust=0.5,face="italic",colour="#002060"),
        axis.title.y=element_text(size=18,colour="#002060",vjust=2,
                                  margin=margin(t=0,r=10,b=0,l=0)),
        axis.title.x=element_text(size=18,colour="#002060",vjust=2,
                                  margin=margin(t=10,r=0,b=0,l=0)),
        axis.text=element_text(color="#002060",size=18),
        axis.ticks=element_blank(),
        legend.text=element_text(colour="#002060",size=18),
        legend.title=element_text(colour="#002060",size=18, face="italic"),
        legend.position="top",
        #legend.position.inside = c(0.5,0.9),
        #legend.key=element_blank(),
        panel.grid.major=element_blank(),
        panel.grid.minor=element_blank(),
        panel.background = element_rect(fill='transparent'), 
        plot.background = element_rect(fill='transparent',color=NA))

ggsave("simulated_gdp_with_states.png",bg='white',width=140,height=120,units="mm",dpi=300)
p1

What does all this mean for economic equilibrium concepts?

In economics, static equilibrium refers to a place of rest where key endogenous variables remain constant over time unless disturbed. In an Econ101 supply and demand framework, for example, the market-clearing price and quantity represent a static equilibrium: there are no inherent forces pushing price or quantity away from that point, and the system remains at rest until an external shock intervenes.

By contrast, a dynamic (deterministic) equilibrium describes a situation in which variables change over time but in a balanced and predictable manner, so that crucial ratios remain constant despite growth or decline in absolute terms. The classic example is the Solow growth model, in which the economy moves towards a steady state where output, capital and technology-augmented labour all grow at the same constant rate. Despite these ongoing changes, the capital-to-effective-labour ratio, the marginal product of capital and the growth rate of living standards remain stable, reflecting an underlying balance within a system of perpetual movement.

A key insight of Markov models is that the real world can exhibit a so-called stochastic equilibrium, arising in models incorporating random shocks, such as Real Business Cycle (RBC) and New Keynesian Dynamic Stochastic General Equilibrium (DSGE) models. In these frameworks, the economy is constantly buffeted by unpredictable disturbances – for example, productivity or policy shocks – but nonetheless exhibits an underlying tendency for key ratios and variables to revert towards their long-run equilibrium paths. Here, equilibrium is defined not as a fixed point or a deterministic growth path, but as a probabilistic distribution around which the economy fluctuates.

Of course, in reality, there is no guarantee that a unique equilibrium exists. That is why societies value collective action and adaptability in the face of randomness.

If we want things to stay as they are, things will have to change. Giuseppe Tomasi di Lampedusa, Il Gattopardo (The Leopard)

No man ever steps in the same river twice, for it is not the same river and he is not the same man. Heraclitus

Do Markov models have limitations?

The core assumption of a basic Markov model is that the future depends only on the present. Although this is a powerful simplification, it might not always hold in the real world. This brings us to a crucial concept in economics: path dependence.

Path dependence suggests that “history matters” in a deeper way. It argues that the entire sequence of events that led to the current state is important, not just the state itself. Think of a “lock-in” effect, where an early choice or event makes it very difficult to switch to an alternative later on.

Macroeconomic examples of path dependence include:

  • Hysteresis (scarring). A deep and prolonged recession (a “bad path”) might cause long-lasting damage to the workforce, eroding skills and permanently increasing the unemployment rate. A return to the pre-recession “Normal” state may therefore be much harder than a simple Markov transition would suggest.
  • Permanent shocks. The abolition of slavery, the collapse of communism and the impact of a global pandemic such as COVID-19 are not merely temporary state changes. These events set economies on fundamentally new and often irreversible trajectories.
  • Industrial and technological revolutions. The advent of a major general-purpose technology (GPT), such as steam power, electricity, the internet or AI, can create self-reinforcing dynamics. Early adoption by some countries or firms may generate advantages that are very difficult for others to overcome.

So, while a Markov model is a useful starting point for understanding short-term fluctuations, it is less suited to capturing these deep, historical, and often irreversible shifts.

Other macro applications for Markov models?

Thinking about the labour market in simple terms, people are either employed, unemployed or absent from the labour force. They frequently move between these three states at different points in their life cycle. But what happens over the long run? Does the unemployment rate settle at a particular level, even with constant flows of people finding and losing jobs? This is where the concept of a steady state (or long-run equilibrium) using a Markov model can be useful.

Imagine a large economy with millions of workers. Each period (say, a month or a quarter), some employed people might lose their jobs and become unemployed, while some unemployed people might find jobs and become employed. Some people may become discouraged or leave the labour market because of age or illness. Others may reverse an early retirement, or leave education and obtain a job for the first time. A Markov model allows us to quantify these flows using transition probabilities.

The steady state represents a point where, despite these ongoing movements, the proportions of people who are employed, unemployed or outside the labour force no longer change. It is not that people have stopped moving between states; rather, the flows balance out and leave the overall proportions unchanged. It is like a bath in which water flows in and out continuously, but the water level remains constant because the inflow equals the outflow. Using matrix algebra and data on labour-market flows, we can calculate the long-run proportions, providing insight into the important macroeconomic concept of the natural rate of unemployment.