Naive-Persistence-Model-Simulation-of-Natural-Gas-Daata

This time, I would like to run a test train split simulation and Naive Persistence Model simulation of Natural Gas Data. The data is downloaded from yahoo finance in 5 year range period from June 13, 2016 - June 13, 2021. Natural Gas.xlsx

  1. First of all, we import the related library, and transform the excel data into panda dataframes

textimage

  1. Run a test train split, we will set 80% of total amount of data for train size

textimage

  1. Next, we forecast the data through Naive persistence model simulation. Define df, and add t columns. Actually, t columns is just the actual data at index 0 + 1. Later we define Adj Close as y variable and t as x variable (predicted values).

textimage

  1. Then we set the last 7 data as test data, and the rest as train data, and divide the data into 4 parts

textimage

  1. Show the Naive persistence model result

textimage

  1. Calculate mean squared error. Mean squared error is actually the sum of squared of subtraction values between y values and predicted values. MSE is needed to evaluate advanced model. If the mse values of the advanced model is greater than mse values from naive persistence model, it means we cant extract any information from that data. And we could categorize the time series data as random walk.

textimage

  1. Visualize the result

textimage