The data - historical gold prices
Regression analysis is a statistical tool to understand the relationship between variables. In this chapter, we will implement a nonlinear regression to predict the gold price based on historical gold prices. For this example, we will use the historical gold prices from January 2003 to May 2013 in a monthly range obtained from www.gold.org. Finally, we will forecast the gold price for June 2013, and we will contrast it with the real price from an independent source. The complete dataset (since December 1978) is at http://www.gold.org/research/download-the-gold-price-since-1978.
The first seven records of the CSV file (gold.csv
) look like this:
date,price
1/31/2003,367.5
2/28/2003,347.5
3/31/2003,334.9
4/30/2003,336.8
5/30/2003,361.4
6/30/2003,346.0
7/31/2003,354.8
. . .
In this example, we will implement a Kernel Ridge Regression, which is a regression method based on nonlinear kernels. We will use the original time series and the smoothed time series to...