gs-quant
gs-quant copied to clipboard
Add ARIMA Normalization Functionality
ARIMA here is used without the moving averages component to normalize and forecast time series data.
An ARIMA model is selected from 9 possible combinations: (0,0,0), (1,0,0), (2,0,0), (0,1,0), (1,1,0), (2,1,0), (0,2,0), (1,2,0), (2,2,0). The time series is split into train and test sets and an ARIMA model is fit for every combination on the training set. The model with the lowest mean-squared error (MSE) on the test set is selected as the best model. The original times series can then be transformed by the best model.
import pandas as pd
import numpy as np
import gs_quant.timeseries as ts
series = pd.Series(np.random.randint(0,100,size=(1, 100))[0])
arima = ts.arima()
arima.fit(series, train_size=0.8)
arima.transform(series)