Deep learning in Macroeconomics — Treasury Bonds (2024)

Deep learning in Macroeconomics — Treasury Bonds (3)

How will US treasury rates move over the in the coming year? Next financial quarter? What about next month? These questions play an essential role in the decision making of both financial market investors and policymakers. Investors aim to search for higher investment returns, to estimate longer-run returns, and to model risk premia. Policymakers attempt to predict future rates to help drive appropriate monetary and fiscal measures in order to maintain a healthy market and macroeconomy.

In this article, I compare the forecasting performance of a Convolutional-LSTM Neural Network to the aggregate forecast performance of the Philadelphia Federal Reserve’s Survey of Professional forecasters. This model and approach are similar to that used in my previous article on predicting US inflation rates. Historically such survey aggregated approaches to forecasting have been utilized to improve performance by aggregating the results of many economists models and predictions of future performance. This is a similar approach to what is used by the Blue Chip Economic Indicators forecast as well as the Dow Jones/Wall Street Journal Economic Forecast survey to name a few. I find that through the use of a neural network prediction algorithm, forecast performance can be improved over all time horizons tested.

Treasury yields are not only important in signaling the state of the stock market and general economy but are also a driver of many other interest rates and security pricing.

The 10-year Treasury Bond is in effect a share of US debt. By purchasing a bond you make a small loan to the U.S. federal government. The 10-year bond is one that matures ten years after its issuance from the US Department of the Treasury. These notes are auctioned by US Treasury allowing their price to be, in part, determined by demand.

These bonds are typically viewed as a risk free debt instrument. That is they determine the rate of return for debt with no risk of default. This is because all Treasury bonds are backed by the by the guarantee of the US economy. Relative to many countries there is very little perceived risk of the US defaulting on its debt.

This perception of Treasury bonds as a risk-free investment is part of what drives their importance in understanding economic perceptions and what drives their influence over other debt instruments.

When the economy is performing well and perceptions of future performance are high, then investors will look to find the highest rate of return for their investment and demand for treasury securities will diminish. In this type of expansionary period of the business cycle, there are many other investment instruments which will yield higher returns than what can be achieved from a Treasury bond. As a result, demand declines and purchasers are only willing to below face value for the bond. This drives the yield higher as the market balances to compete with other investment instruments.

The opposite is true in times of economic contraction or when there is a perceived risk of recession. Investors shift their assets away from instruments perceived as higher risk in search of a safe and stable investment, like a Treasury bond. This high demand drives up the price of bonds and reduces the rate of return. Investors are willing to accept this lower return in exchange for the knowledge that their investment is safe. This is why in times of expansion we see treasury rates fall and in during times leading up to contractions we can see rates increase.

In contractionary periods, this decrease in the risk-free rate leads bank lending rates and other interest rates to fall as well in order to compete in the market place. Less safe investments such as mortgages must reduce rates in order to draw in investors. This provides an added liquidity boost to the market. Lower mortgage and loan rates drives up borrowing by making it cheaper to buy a home and take on debt.

By better understanding the future movements of bond rates individuals, policy makers, and market participants can improve their decision making. Investors can achieve higher returns and act before the market moves rather than reacting to it. Similarly, policy makers can make decisions about monetary policy and liquidity before the economy falls into crisis. Perhaps most importantly, by predicting movements in bond rates, we can better understand the broader sentiment about the economy. Large shifts in rates over a period can indicate changes in perceptions about risk and serve as an indicator for recession.

For data, I use the GS10 series from the FRED-MD database. FRED-MD is a database maintained by the Federal Reserve Board of St. Louis which was “designed for the empirical analysis of “big data.” The data is updated in real-time through the FRED database.

The GS10 variable represents the constant maturity yield at the end of the month for a 10-year Treasury Bond. This rate is calculated based on information provided by the US Department of the Treasury. The data is also available from FRED here.

For this analysis, I forecast the bond rate in each month. As bonds are traded daily, this corresponds to the rate calculated at the end of each month. The series is first differenced to produce stationarity and then structured in a tensor of rolling 24-month periods with a single feature. While there is debate whether data must be stationary before being used in a non-linear forecasting model, in this case, I found results were improved after differencing. The rolling average input is similarly structured. After differencing the series the moving averages are calculated and then structured in a tensor of rolling 24-month periods with each of the three moving averages serving as a feature.

I developed a Convolutional-LSTM Neural Network (CNN-LSTM) to predict bond rates at the end of each of the next twelve months.

Convolutional Neural Networks are a series of deep learning algorithms that were originally designed for the classification of images. The network takes an image, passes that image through a set of filters applying weights to different aspects of the image and ultimately provides a prediction. This works as a feature engineering system whereby, over time, the network “learns” what aspect filters are most important in classifying an image.

A similar method can be applied to time series. Although a time series does not have “physical” features in the same way an image does, time series data does contain time dimensional features. If we think of our time series data like an image we can think of the convolutional network like a spotlight, or window, which scans across the time period illuminating the shape of our series in that period and then filtering it to find the feature shape that it most represents. A simple illustration of this model is below:

This convolutional model can be extended with a Long Short Long short-term memory (LSTM) layer set in order to better learn which of these historic time dimensional features impact rates when. An LSTM is an artificial recurrent neural network (RNN) architecture used in deep learning. Unlike other feed-forward neural networks, an LSTM network has feedback connections. These feedback connections allow the network to learn what past information is important and to forget what is not.

The cell is made up of a few gate functions which determine whether new information is important to the prediction problem and whether old information remains relevant. This memory is referred as the cell state and can keep all previously learned relevant information for the full processing of the time series sequence. This allows for information learned much earlier in the sequence to be maintained through the full processing.

As information is processed through the LSTM it passes through a series of gates which determine whether the information is maintained, updated, or forgotten entirely. This is the benefit of the LSTM architecture over other RNN structures. The LSTM is able to carry information from earlier in the processing through to the end where other RNN networks simply update their understanding with each additional input in the sequence. This makes the LSTM network very powerful for the analysis of sequence data like time series.

The CNN-LSTM network that I utilize for this analysis is diagrammed below. First, we begin with two inputs, the raw time series and three moving average smoothed series. The smoothing series each represent the prior three month, six month, and one year moving averages for any given observation.

These inputs are then fed into separate convolutional layers to extract the relatively important feature weights of each input series. These results are then merged together and passed to a series LSTM networks and then finally to a set of fully connected blocks. Each subsequent block in the stack of fully connected blocks contains fewer nodes than in the previous stack. Between each block a residual, or skip, connection is used allowing the model to use the information learned in earlier layers to continue training the later ones. This prevents the information which was output from the convolutional layer from being too quickly lost or obscured by subsequent layers of the model. This also helps to prevent the vanishing gradients problem and allows for some smaller details from the original series to be maintained further in the model structure. Finally, a dropout is applied to the final layer before outputting the final predictions.

After differencing the data, I split the dataset into a training and test set (70/30 split). The data is trained on all months up to June 2001 and then predictions are made on for July 2001 through September 2019. I use a one step rolling prediction. For every month in the test set the bond rate corresponding to the end of each of the next twelve months is predicted and then the observed bond rate is used to predict the next set of twelve months. Predictions are made in a multivariate fashion, predicting each of the subsequent twelve months simultaneously, and validated on every tenth observation in the series.

This is a fairly realistic approach, as in forecasting the next period of bond rates the analyst will have access to all prior observed rates. By using a one step prediction we maintain this increasing stock of modeling information. By using a stateful LSTM model the model weights are adjusted with each new forecast iteration. This allows the model to pick up any structural changes in the series that may occur over time. The error rates for the model are presented in annualized percentage points.

As a benchmark to the model, I present the error rates over the test period of the Survey of Professional Forecasters (SPF) and the Federal Reserve of Philadelphia’s DARM model (their highest performing benchmark for the SPF). The SPF is the longest running forecasting survey of macroeconomic indicators in the United States. The error rates for these benchmarks are calculated from the SPF official error rate documentation.

Below is a summary of the model results:

We can see that the multivariate convolutional-LSTM model far outperforms the Direct Autoregressive Model and the survey aggregated forecasts. While there are some differences in how these forecasts are run and thus how the error performs, we can see that the convolutional model outperforms these more traditional methods at every time period. The SPF forecasts are performed on a quarterly basis in the middle of each quarter and are then forecast for the end of current quarter and subsequent quarters rather than on a monthly basis. These can still be compared by treating each quarterly forecast as a three month out forecast and the current quarter forecast as an approximately one month forecast.

Below, we can see the model’s performance across the full time series. In general, we can see the model fits the data well with some slightly higher error over periods of greater variance or when the trend changes quickly. This is particularly true at the highest historic rate values during the 1980s.

If we look more closely at only the test period, we can see that the model nearly exactly matches the actual bond rate. Some of this is due to the model gaining additional information at each subsequent forecast. Treasury rates have been declining steadily since the peak in 1984. Recent economic theory has suggested that bond rates may have changed structurally to a lower steady state. This is particularly interesting when considering the Treasury yield curve. The model, however, seems to have had little trouble adjusting to this change in structure.

While there is a clear improvement over the benchmarks in terms of error, another key benefit that can be seen is in the models ability to forecast without lag. Typical econometric model forecasts often show a lag in their predictions and have difficulty quickly adapting to changes in trend. In looking at the additional benchmark forecasts below we can see that, particularly for medium and longer run forecasts there is a clear lag in the forecasted rate. We can also see what I would refer to as model stickiness in the benchmark forecasts. This is where a longer run forecast tends to over estimate the magnitude of a shift in the series trend and is slow to adapt to reversal in direction. This is most obvious looking at the DARM T+12 forecasts during the 1980s. We can see that the model is slow to reverse direction following the peak.

This provides strong evidence for the use of neural networks for the forecasting of bond rates. This neural network structure allows for vastly improved forecasts and is faster at reacting to changes in the trend. This forecasting methodology may also have better performance as it forecasts all twelve future periods simultaneously. Unlike other benchmark models which typical produce forecasts recursively (i.e forecast T+2 is based on forecast T+1) the neural network forecasts all twelve periods using only information at time T. This essentially allows the model to optimize its weighting as though twelve separate models were used.

This analysis used only a single predictor variable, the history of inflation, in order to predict future inflation rates. It is possible that by adding in additional predictors that model performance may improve. It also possible that different smoothing methods may be used, such as an exponential smoothing, which may allow for improved forecasts. Data on bond rates is also available in a daily series, which may make for an interesting addition to the forecasting challenge and provide additional data.

My code for this analysis is available on my GitHub. I will continue to update the code and refine the model so results may change slightly.

Note from Towards Data Science’s editors: While we allow independent authors to publish articles in accordance with our rules and guidelines, we do not endorse each author’s contribution. You should not rely on an author’s works without seeking professional advice. See our Reader Terms for details.

Deep learning in Macroeconomics — Treasury Bonds (2024)

FAQs

What is an example of value created through the use of deep learning TQ? ›

Answer: An example of value which is created through the use of deep learning is: b. reducing multi-language communication friction in a company through automatic language translation.

Are Treasury bonds seen to have no risk? ›

Financial analysts and the financial media often refer to U.S. Treasury bonds (T-bonds) as risk-free investments. And it's true. The United States government has never defaulted on a debt or missed a payment on a debt.

What are the three types of deep learning? ›

Whether you are a beginner or a professional, these top three deep learning algorithms will help you solve complicated issues related to deep learning: CNNs or Convolutional Neural Networks, LSTMs or Long Short Term Memory Networks and RNNs or Recurrent Neural Networks (RNNs).

What is the risk that the value of the Treasury bond will diminish over time? ›

Explanation: The type of risk that applies to an investment in Treasury bonds is inflation risk. Inflation risk refers to the risk that the value of the Treasury bond will diminish over time if the value of the dollar decreases, or buys less than it used to.

What is deep learning with real life examples? ›

Deep learning can be used in a wide variety of applications, including:
  • Image recognition: To identify objects and features in images, such as people, animals, places, etc.
  • Natural language processing: To help understand the meaning of text, such as in customer service chatbots and spam filters.

What is the biggest advantage of deep learning support your answer? ›

One of the main advantages of deep learning is that it can automatically learn features from the data, which means that it doesn't require the features to be hand-engineered. This is particularly useful for tasks where the features are difficult to define, such as image recognition.

Why are Treasury bonds considered risk-free? ›

Treasury bonds are widely considered a risk-free investment because the U.S. government has never defaulted on its debt. However, investors should understand that even U.S. government bonds have interest rate risk. That is, if market interest rates rise, the prices of these bonds will fall, as they did throughout 2022.

What are the advantages and disadvantages of Treasury bonds? ›

They have tax advantages and are generally low risk. They earn interest until their maturity date, so they're good for earning steady cashflow. But Treasury bonds are not risk-free and are still vulnerable to changes in market interest rates and inflation.

Are Treasury bonds guaranteed? ›

Treasury securities are considered a safe and secure investment option because the full faith and credit of the U.S. government guarantees that interest and principal payments will be paid on time.

What are the 4 pillars of deep learning? ›

The four pillars of deep learning are artificial neural networks, backpropagation, activation functions, and gradient descent.

What is deep learning in simple words? ›

Deep learning is a method in artificial intelligence (AI) that teaches computers to process data in a way that is inspired by the human brain. Deep learning models can recognize complex patterns in pictures, text, sounds, and other data to produce accurate insights and predictions.

Can we learn deep learning without machine learning? ›

Yes, you can learn deep learning on your own if you are learning it from the right resources. Check out ProjectPro if you are looking for a one-stop solution for deep learning resources.

Why are Treasury bonds not risky? ›

Also, T-bonds are backed by the full faith and credit of the U.S. federal government, meaning investors won't lose their initial investment. However, since younger investors have a longer time horizon, they typically opt for investments that offer long-term growth.

How safe are Treasury bonds? ›

U.S. Treasury bonds are fixed-income securities. They're considered low-risk investments and are generally risk-free when held to maturity. That's because Treasury bonds are issued with the full faith and credit of the federal government.

How do Treasury bonds lose value? ›

What causes bond prices to fall? Bond prices move in inverse fashion to interest rates, reflecting an important bond investing consideration known as interest rate risk. If bond yields decline, the value of bonds already on the market move higher. If bond yields rise, existing bonds lose value.

What is an example of value created? ›

Put simply; value creation is the process of turning resources (these can be physical like materials or non-physical like time) into something of perceived value. Some examples of value creation include car manufacturers building vehicles, farmers growing and harvesting crops, or banks offering mortgage loans.

What is value function deep learning? ›

The optimal V-value function is the expected discounted reward when in a given state s the agent follows the policy pi* thereafter. We can relate between the last two functions: It describes “how good” the action a is, compared to the expected return when following direct policy pi.

Which of the following is an example of deep learning? ›

Speech recognition, image recognition, finding patterns in a dataset, object classification in photographs, character text generation, self-driving cars and many more are just a few examples. Hence it is important to be familiar with deep learning and its concepts.

What are the uses of deep Q-learning? ›

Deep Q-Learning is used in various applications such as game playing, robotics and autonomous vehicles. Deep Q-Learning is a variant of Q-Learning that uses a deep neural network to represent the Q-function, rather than a simple table of values.

Top Articles
Latest Posts
Article information

Author: Roderick King

Last Updated:

Views: 5417

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Roderick King

Birthday: 1997-10-09

Address: 3782 Madge Knoll, East Dudley, MA 63913

Phone: +2521695290067

Job: Customer Sales Coordinator

Hobby: Gunsmithing, Embroidery, Parkour, Kitesurfing, Rock climbing, Sand art, Beekeeping

Introduction: My name is Roderick King, I am a cute, splendid, excited, perfect, gentle, funny, vivacious person who loves writing and wants to share my knowledge and understanding with you.