jharvey09 / A_Tale_of_Two__The_Yen_Versus_The_US_Dollar

In this project, I will use time series models to forecast the future outcome of the yen versus the US dollar.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A Tale Of Two (The Yen Vs US Dollar)

image

This project utilizes Time Series analysis, along with a Linear Regression model to forecast the price of the Japanese Yen vs. the US Dollar. ARMA, ARIMA, and GARCH forecasting models included, also using the decompisition of the Hodrick-Prescott filter. The In-Sample and Out-of-Sample performance metrics used to evaluate Linear Regression model. The financial departments of large companies often deal with foreign currency transactions while doing international business. As a result, they are always looking for anything that can help them better understand the future direction and risk of various currencies. Hedge funds, too, are keenly interested in anything that will give them a consistent edge in predicting currency movements.

Table Of Contents:

Time Series Forecasting

Files

Linear Regression Forcasting

Linear Regression Forecast Line Plot

Models:

ARMA Model

ARIMA Model

GARCH Model

Time Series Forecasting:

The Following has been utilized in analysing historical data for the Yen:

  1. Hodrick-Prescott Filter
  2. ARMA Model
  3. ARIMA Model
  4. GARCH

Steps:

The dataset contained the following data related to the Yen from 1990-2019: image

Decompisiton Using Hodrick-Prescott Filter:
  1. Apply the Hodrick-Prescott Filter by decomposing the "Settle" price into two separate series
  2. Create a dataframe of just the settle price, and add columns for "Noise" and "Trend" series
  3. Plot the Settle Price vs. the Trend Price for 2015 to the present

image

ARMA Model:

  1. Create a series using "Settle" price percentage returns, drop any nan's, and then create model Below are the results of the ARMA model

image

In the above ARMA model, the autoregressive term has a p-value (.42) that is greater than the significance level of 0.05.

To return a plot forecast, use the following code, results listed below code:

pd.DataFrame(results.forecast(steps=5)[0]).plot(title="5 Day Returns Forecast")

image

ARIMA Model:

image

In the above ARIMA, the autoregressive term has a p-value (.65) that is greater than the significance level of 0.05. With both models showing a p-value higher than 0.05, we can conclude that the coefficient for the autoregressive term is NOT statistically significant, and should NOT be kept in the model.

GARCH Volitality Model:

image

Files:

  1. Time-Series Notebook
  2. Linear Regression Notebook
  3. Yen Data CSV File

Linear Regression Forecasting:

  1. Data Preparation (Creating Returns and Lagged Returns and splitting the data into training and testing data)
  2. Fitting a Linear Regression Model.
  3. Making predictions using the testing data.
  4. Out-of-sample performance.
  5. In-sample performance.

Linear Regression Model:

  1. Load Yen futures return data, create a lagged return column using the .shift() function
  2. The following dataset was produced
  3. Assembled actual y data (Y_test) with predicted y data into two columns in a dataframe

image

After splitting into Training and Testing data, I ran the Linear Regression model Assembled actual y data (Y_test) with predicted y data into two columns in a dataframe

Steps Taken:

  1. Decomposition using a Hodrick-Prescott Filter (Decompose the Settle price into trend and noise).
  2. Forecasting Returns using an ARMA Model.
  3. Forecasting the Settle Price using an ARIMA Model.
  4. Forecasting Volatility with GARCH.

Linear Regression Forecasting Line Plot:

image

Conclusion:

When partaking in an analysis, I try to find three questions to conclude the findings. This project consisted of the use of Time Series Analysis, with that my first question was Based on my Time Series Analysis, Would I buy the Yen now? For me to conclude my findings, I would first need to ask myself, Is the risk of the Yen expected to increase or decrease? To come to my conclusion I could therefore use the evaluation based on the model. My final question would be Would I feel comfortable using this model for trading?

With this model, the out-of-sample data performed slightly better than the in-sample data. The out-of-sample had a Root Mean Squared Error(RMSE) of 0.415, while the in-sample data has a Root Mean Squared Error(RMSE) of 0.596. Using the ARMA Model to forecast the returns, then using the ARIMA Model to forecast the settle price. After that applying the GARCH Volatility Model for future volatility. Concluding, based on the evaluation from the models, I would buy the Yen, knowing that the future rate would increase.

About

In this project, I will use time series models to forecast the future outcome of the yen versus the US dollar.


Languages

Language:Jupyter Notebook 100.0%