How would a change in Money Supply influence the performance of the stock market? — Insights from a ten-year data set

The national banks have employed money supply as a powerful monetary tool to influence the financial system and manipulate the economy for a long history. As one of the most important components of the modern financial system, the stock market should also somehow related to the changes in the money supply. However, the exact effect has been a long-debated and puzzling question, with some economists argue positive relationships and others hold negative ones. Which view can be proved by the realistic data? Or are they both wrong? Let’s find it out together!

To find a robust answer, I divided the projects into the following parts and asked the corresponding questions within each part. The parts and questions are listed as follows:

Part 1.Collect and Prepare the Data

Q1: What are the appropriate variables to represent Money Supply change and performance of stock market?

Q2: How should I transform the raw data to make it appropriate to analyse? (how to handle missingvalues? etc)

Part 2. Test for Granger Causality and Stationarity

Q1: Is there any causalities in between percentage changes in the money supply and percentage change in SP500?

Q2: Are both the variables stationary so that the Vector Autoregression (VAR) model and Vector Autoregression Moving Average (VARMA) model could be run?

Part 3. Develop models and Harvest Forecasts

Q1: What is the appropriate lag level for VAR and VARMA model?

Q2: What can we know about the relationship between percentage changes in the money supply and percentage change in SP500 from the VAR or VARMA models?

figure 1; Raw data of Dow Jones Industrial Average, SP500, Nasdaq composite, and M2 from Fred; They all share a similar upward trend even though they have different units

The two main variables within our project are money supply and stock market performance. Hence, the first question of all is what are the appropriate variables to represent Money supply change and performance of the stock market?

The money supply refers to the amount of currency and liquid instruments circulated in a countries’ economy. The definition is relatively abstract, and, to make it usable, we need to set limits on how we define liquidity. In this project, we will define money supply using M2, including cash, checking deposit, saving deposits, and other time deposits. Even though not all assets including in M2 are cash, they could be converted into cash or checking deposit very quickly and are liquid enough to be considered as equivalent to cash.

For the performance of the stock market, it is a bit more complex. Because first, it is not very possible to find unbiased stock market indexes and second, there is a large number of indexes we could choose from. Hence, I initially pick the three most commonly referred stock market indexes: SP500, the Dow Jones Industrial Average, and NASDAQ composite. However, after a bit explore in the data, I find there are strong correlations between the percentage changes of those three indexes (as shown in figure 2). This implies that they represent very similar information. Thus, I choose to use SP500 alone to represent the performance of the stock market.

figure 2; It is surprising to see how three stock markets indexes, which took different companies into accounts, shared very strong correlations and thus have very strong linear relationships.

As shown in figure 1, raw data from Fred tell us that there is a shared upward trending for both M2 and SP500. However, this is not helpful at all in answering our question because, in time series analysis, two utterly unrelated variables could share the same trend and have a high correlation.

To avoid misrecognizing coincides as linkages, the real relationship we want to find is how percentage changes in M2 affect percentage change in the SP500. To achieve this I did the following steps on our dataset:

  1. Reindex the dataset by a frequency of month
  2. Stored the last co-existed pairs of SP500 and M2 for each month into the dataset
  3. Replace the two variables with their monthly percentage changes
  4. Drop the first row which only contains null values.

The first two steps are because the data of SP500 and M2 are published at different frequencies; to avoid null values, I need to downsample them into a dataset with a monthly frequency and then take the percentage change from month and month, which gives us the following figure. We could inspect that SP500 tends to be more violate than M2, which makes perfect sense due to the gigantic size of M2 stock. One more thing we could inspect is that the two variables seem to link together; the peaks of SP500 seem to correspond to the bottoms of M2, and vice versa. However, we couldn’t jump to the answer right now, because there could be lagged effects and unnoticed patterns that we couldn’t simply observe. To find further evidence of the relationship, let’s dive into part 2.

figure 3; By merely inspecting the figure, the two variables seem to link together; the peaks of SP500 seem to correspond to the bottoms of M2

First, let me clarify one point. When I mention the relationship between percentage change in the M2 and percentage change in SP500, I don’t simply mean correlations, but also causalities (the distinction could be explained by this material). For a relationship between two-time series variables A and B, it is very possible that A is caused by a lagged B variable. For example, a percentage increase in SP500 at time t might be caused by a percentage increase in M2 at time t-1. To test the existence of causalities, we would use the Granger Causality tests (4 tests that theoretically create similar results).

figure 4; It is surprising to see that all four tests agree that lagged pct_change of M2 granger caused pct_change of SP500 when M2 at the lagged level around 4

The test is run in python by statsmodels’ grangercausalitytests package and I designed it in a specific way so that we will measure whether lagged percentage change in M2 could cause percentage change in SP500, instead of the reversed. We would use P-values as criteria to judge whether the test is passed. A low p-value means the null hypothesis, that there are no Granger Causalities, could be rejected with sufficient evidence.

The result for four different types of Granger Causality test is shown in figure 4. We could observe that they all agree that when lagged levels for M2 are around 4, there seem to be significant causalities. Even though the result is encouraging, it is not promising whether there will be a robust forecasting model at the end.

The last section of part two is to test whether the two variables, the percentage change in M2 and the percentage change in SP500, are stationary so that we could use them to train our VAR and VARMA model. The method we employ in this part is one of the unit root tests, the Dickey-Fuller Test. The null hypothesis for this test is that there is a unit root and the variable is not stationary. Thus we need a very low p-value in this test to reject the null and prove the variables are stationary. The result is shown as following; both of the two variables passed the test and can be considered stationary. (Because of this, we don’t need further to difference the variable)

Before discussing building models, I need to mention that I have divided our dataset here into two parts: the training set (80%) and the testing set (20%). This would enable us to verify the accuracy of our models’ predictions.

The first challenge I meet while building the model is choosing the optimal degrees of lags for the VAR and VARMA models. This is really important because if too few lags were chosen, the model might neglect important and significant lagged variables and lose forecasting power. Also, if too many lags were chosen, there could be problems with multicollinearity, serial correlation, and loss of degrees of freedom. Thus an optimal level of lags should be determined to ensure the well-balance of the models. I would use two criteria to measure the optimal level of lags: AIC, HQIC (the difference is that HQIC has a stricter limit on the loss of degrees of freedom). By setting the maximum number by empirical rule around 20, through AIC and HQIC, we could get separately two optimal levels of lags of 16 and 8.

figure 5; Even though AIC and HQIC both strive to find the most balanced point, it is surprising to see how their different standards finally lead them to yield very different optimal lag levels.

After determining the lagged value we could start to build our Vector Autoregression Models. By plugging in the two lag levels and training the model using the training data set, we acquire the modeling two VAR models: VAR(8) and VAR(16);

figure 6; rmse = 0.058678631903717846;
figure 7; rmse = 0.06467014875353583; The two VAR models have very precise predictions about what would happen in the year 2019; one important reason for those precise predictions is that the lagged variables about the percentage change in M2 are very significant in determining the percentage change in SP500; this reconfirms that there are linkages between the two variable.

It is amazing to see how precise the two models predict what would happen within the year 2019. This accuracy is not out of nothing; they are based on the significant lagged variables we find in the two models. I am especially happy to see that there are significant lagged M2 variables (significance level is 5%) in both of the models. For VAR(8), there are Lagged 3.M2(p-value = 0.027),Lagged 5.M2(p-value = 0.047); For VAR(16), there are Lagged 4.M2(p-value = 0.048), Lagged 5.M2(p-value = 0.047), Lagged 9.M2(p-value = 0.030), Lagged 14.M2(p-value = 0.013), Lagged 15.M2(p-value = 0.037). Moreover, the coefficients of all those significant lagged M2 variables are positive. This seems to imply that a positive percentage change in M2 tends to cause a positive percentage change in the SP500.

figure 8; rmse = 0.06049389917349435
figure 9; rmse = 0.062999844875429; I actually expected the two VARMA models to perform better because I thought the error terms might help a lot in easing the difference in the pattern between the two investigated variables.

To further enhance the model, I tried to incorporate the moving average model into our current VAR model, so that we could know how the lagged errors in the past are related to the monthly percentage change in SP500. However, the result is very good; Not only we didn’t see any noticeable changes in the pattern of prediction values between VAR and VARMA, but also an increase in the root mean square error (rmse) from VAR(8) to VARMA(8, 1). Plus the p-values of the coefficients of all error terms are very large, which means we could reject the null hypothesis that those coefficients equal to zeros. Thus, the VARMA models in this condition couldn’t outperform the VAR models.

In conclusion, from the analysis above, we know that lagged variables of the percentage change in M2 granger caused percentage change in SP500; from the VAR model, we could also know that a positive percentage change in M2 tends to cause a positive percentage change in the SP500, ceteris paribus.