forked from RobertMcPherson/BayesianVectorAutoRegression
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gold_SweaveTemplate.tex
108 lines (78 loc) · 9.81 KB
/
Gold_SweaveTemplate.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
\documentclass[12pt]{article} % the type of document and font size (default 10pt)
\usepackage[margin=1.0in]{geometry} % sets all margins to 1in, can be changed
\usepackage{moreverb} % for verbatimtabinput -- LaTeX environment
\usepackage{url} % for \url{} command
\usepackage{amssymb} % for many mathematical symbols
\usepackage[pdftex]{lscape} % for landscaped tables
\usepackage{longtable} % for tables that break over multiple pages
\usepackage{graphicx}
\title{Gold Forecast with Demographic and Economic Leading Indicators} % to specify title
\author{Bob McPherson} % to specify author(s)
\usepackage{Sweave}
\begin{document} % document begins here
\input{Gold_SweaveTemplate-concordance}
% If .nw file contains graphs: To specify that EPS/PDF graph files are to be
% saved to 'graphics' sub-folder
% NOTE: 'graphics' sub-folder must exist prior to Sweave step
%\SweaveOpts{prefix.string=graphics/plot}
% If .nw file contains graphs: to modify (shrink/enlarge} size of graphics
% file inserted
% NOTE: can be specified/modified before any graph chunk
\setkeys{Gin}{width=1.0\textwidth}
\maketitle % makes the title
%\tableofcontents % inserts TOC (section, sub-section, etc numbers and titles)
%\listoftables % inserts LOT (numbers and captions)
%\listoffigures % inserts LOF (numbers and captions)
% % NOTE: graph chunk must be wrapped with \begin{figure},
% % \end{figure}, and \caption{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Dow Jones Forecast Variables and Methods}
Following is a brief analysis, to forecast the Consumer Price Index, as a measure of inflation. It is not meant to be a comprehensive, broad treatment of the many variables that might affect inflation. Rather, the analysis focuses on some economic trends that have been in the news lately, and that are sometimes said to portent a possible crash in the markets. For example, the U.S. national debt to GDP has rarely been higher, and has caused great concern for many investors. Also, the rate of inflation has just begun to increase, after years of being at record lows. Lastly among economic variables, the velocity of money is sometimes said to be related to market performance. This analysis examines these variables, and their combined relationship to the year to year changes in the Dow Jones Industrial Index. The data in this study goes back to 1961, and extends through 2017.
In addition to the economic variables, demographic variables were also considered. As a proxy for age distributions, the number of births by year, and also the birth rate by year, were included along with the previously mentioned economic variables. It is well known that the population of the U.S. has been aging. This trend has contributed to rising demand for fixed income investments, which has driven interest rates to very low levels. Also, as older, retired individuals tend to purchase fewer consumer goods, inflation for these items as also been very low. This has an impact toward lower velocity of money as well. As retirees have been known to rebalance investment portfolios away from equities, and toward fixed income investments, large numbers of retirees have been seen to have a negative impact on the markets.
Conversely, when there are large numbers of people in their peak earnings years, which is approximately age 45 on average, it tends to have a positive impact on the markets. We saw such a period in the 1990s, when a large proportion of Baby Boomers were in their mid forties.
The difference between the number of people in these two groups, those entering age 65 compared to those entering age 45, can provide a useful indicator as to the net impact of age demographics on the markets. This variable was also included in this analysis, to determine how demographic forces interact with the other key economic variables in this forecast.
\section{Arima Univariate Forecast of Gold}
Before examining the combined, multivariate impact of all the variables on Gold stocks, this section will perform a univariate analysis to create a forecast on nothing more than Gold stock data alone. The method utilized is an auto-ARIMA, or automatic Auto Regressive Integrated Moving Average. This brief document will not go into the details as to how the ARIMA method works. However, perhaps it will suffice to say that it examines the following.
\begin{itemize}
\item Auto Regressive trends - the AR in ARIMA: measures a trends correlation to itself, such as with seasonality, or in the case of annual data, possible cyclicality
\item Integration - the I in ARIMA: measures the degree to which subracting each preceding time period's value removes the overall trend, also known as detrending.
\item Moving Average - the MA in ARIMA: measures the extent to which a trend can be explained by a moving average pattern
\end{itemize}
The auto.arima function in R estimates each of these ARIMA parameters, and uses them to calculate a forecast. The plot in Figure~\ref{fig:Arima} shows that this method estimates that gold stocks will increase over the next five years, beginning in 2018.
However, this is purely a momentum, or trend forecast only. As an ARIMA forecast is univariate, this method does not take into account any of the previously mentioned economic and demographic variables. The ARIMA analysis was performed here to see whether there were any affects within the DJIA trend itself that should be taken into account, which might significantly affect the forecast. The order of the ARIMA is shown at the top of Figure~\ref{fig:Arima} as 0,1,0. The first zero indicates no cyclical, auto regressive effects. The numeral one suggests first order differencing to detrend the data. First order differencing involves subtracting each preceding number in the series, from the number that immediately follows. The final zero indicates no moving average effects.
\begin{figure}[h!]
\begin{center}
\includegraphics[width=\linewidth]{plots/Gold_arima.pdf}
\caption{Univariate ARIMA forecast of Gold}
\label{fig:Arima}
\end{center}
\end{figure}
\section{Multivariate Forecast with Bayesian Vector Auto Regression - BVAR}
In this section, we produce a multivariate forecast of gold stocks, utilizing the previously mentioned economic and demographic variables. Older methods of performing multivariate time series analysis involved searching for top correlations between the predictor variables, and the target variable we are trying to predict. It largely ignored the impact of predictor variables on each other. A newer method for accounting for these cross variable impacts, is called Bayesian Vector Auto Regression, or BVAR.
Figure~\ref{fig:BVARForecast} shows a forecast of gold stocks using the BVAR method. The black trend line to the right of the blue, dashed, vertical line, indicates the forecasted trend in DJIA annual percentage growth for five years, after 2017. The forecast suggests that annual growth will moderate, diminishing year over year. The growth rate, however, is not predicted to be negative on a year over year basis. Crashes in the short run as always possible. However, these economic indicators, and demographic age factors taken together, do not indicate strong pressures for a market crash over the next five years, despite much media hyperbole to the contrary.
\begin{figure}[h!]
\begin{center}
\includegraphics[width=\linewidth]{plots/Gold_forecast.pdf}
\caption{Forecast of Gold, utilizing predictor variables that are scaled, and pre-whitened - Bayesian Vector Auto Regression (BVAR)}
\label{fig:BVARForecast}
\end{center}
\end{figure}
\section{Influencers}
Figure~\ref{fig:BVARInfluencers} shows the top variables in the BVAR forecast model, as to their influence on each other. Recall that the BVAR method takes into account not only each variable's impact on the target variable, gold stocks in this case, but also on each other. The BVAR also examines the relationships between the variables, adjusting for many possible lags of the data over time. This enables finding the variables that tend to be leading indicators. This is a form of causality analysis, which investigates whether the strongest relationship, akin to the concept of correlation, occurs when the movement of one variable, precedes a corresponding movement on the part of another.
We can see in Figure~\ref{fig:BVARInfluencers} that all the predictor variables not only tend to be relatively strong influencers of each other, but especially of the DJIA. The DJIA, on the other hand, is not a strong influencer of the other variales.
\begin{Schunk}
\begin{Soutput}
pdf
2
\end{Soutput}
\end{Schunk}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=\linewidth]{plots/Gold_barchart_not_whitened.pdf}
\caption{Main inflencers of Gold - Bayesian Vector Auto Regression (BVAR)}
\label{fig:BVARInfluencers}
\end{center}
\end{figure}
\section{Summary}
This analysis examined the impact of some economic and demographic trends that have gotten attention in the media, as to their influence on the stock market. Many have predicted a collapse in the stock market, as a result of some of these trends. While no analysis can guarantee against such a collapse, and there are many other variables involved with market performance than these few, this analysis suggests that recent trends in these variables, when taken together, have not reached levels that would make a severe decline in the markets inevitable. However, the resulting forecast from this mulivariate analysis does suggest that the recent double digit growth rates of the market are not likely to be sustainable. While annual growth rates are likely to remain positive, they will likely diminish year over year for at least the next five years.
\end{document}