This blog post is adapted from a capstone project created by Aihui Ong for Springboard’s Data Science Career Track. This post originally appeared on Aihui’s Medium page.

Image for post

GLD vs S&P 500 from 2005 to 2019

Image for post

So: is gold still a good investment?

Image for post

adfuller_result = adfuller(data['Open'])
print('ADF Statistic: ', adfuller_result[0])
print('p-value: ', adfuller_result[1])
ADF Statistic:  -1.8025174981713052
p-value:  0.3792125439071432

GLD price before transformation

GLD price after transformation

Splitting data into training and test set

results = auto_arima(arima_data,
seasonal=True,
start_p = 1,
start_q = 1,
start_P=1,
start_Q=1,
max_P=3,
max_Q=3,
m=7, #seasonal period
information_criterion='aic',
trace=True,
error_action='ignore',
stepwise=True)

Using Auto Arima to Forecast Opening Price and Compare With Test Data

Image for post

Using Facebook Prophet to Forecast gold prices

all_auto_arima_model = SARIMAX(arima_data,
seasonal=True,
order=(0,1,0),
seasonal_order=(0,0,0,7),
trend='c')

Forecast of gold prices from 2019 to 2021 using Auto Arima

Gold price google trend

Want to learn more? Check out Springboard’s Data Science Career Track.