Time Series Forecasting - Box-Jekins Methon (ARIMA) in Python and

Time Series Forecasting - FBProphet in Python

USA Inflation - Consumer Price Annual Percentage Forecasting

In [3]:
# ignore warnings
import pandas as pd
import warnings
warnings.filterwarnings("ignore")

Load dataset

In [4]:
# load dataset
from pandas import read_csv
from pandas import datetime
from matplotlib import pyplot
from pandas.plotting import autocorrelation_plot

filename = 'USA_Inflation_ConsumerPriceData_Annual_percentages.csv'

df = read_csv(filename)
df = df.set_index('Year')

df.plot(figsize = (8,6))

fig = pyplot.figure(figsize = (8,6))
autocorrelation_plot(df)
pyplot.show()

print(df.head(5))
      Inflation_ConsumerPrice_Annual_Percentage
Year                                           
1960                                   1.457976
1961                                   1.070724
1962                                   1.198773
1963                                   1.239669
1964                                   1.278912

Autocorrelation and Partial Autocorrelation in Python

In [5]:
from statsmodels.graphics.tsaplots import plot_acf
import matplotlib.pyplot as plt

plt.rcParams.update({'figure.figsize':(6,4), 'figure.dpi':120})

plot_acf(df)
pyplot.show()
In [6]:
from statsmodels.graphics.tsaplots import plot_pacf

plot_pacf(df)
pyplot.show()

ADF test

In [7]:
from statsmodels.tsa.stattools import adfuller

# ADF Test
def adf_test(series):
    result = adfuller(series, autolag='AIC')
    print(); print(f'ADF Statistic: {result[0]}')
    print();  print(f'n_lags: {result[1]}')
    print();  print(f'p-value: {result[1]}')

    print(); print('Critial Values:')
    for key, value in result[4].items():
        print(f'   {key}, {value}')   

adf_test(df["Inflation_ConsumerPrice_Annual_Percentage"])
ADF Statistic: -2.00789437929894

n_lags: 0.2831224525158605

p-value: 0.2831224525158605

Critial Values:
   1%, -3.548493559596539
   5%, -2.912836594776334
   10%, -2.594129155766944

KPSS Test

In [8]:
from statsmodels.tsa.stattools import kpss

def kpss_test(series, **kw):    
    
    statistic, p_value, n_lags, critical_values = kpss(series, **kw)
    
    # Format Output
    print(); print(f'KPSS Statistic: {statistic}')
    print(); print(f'p-value: {p_value}')
    print(); print(f'num lags: {n_lags}')
    print(); print('Critial Values:')
    for key, value in critical_values.items():
        print(f'   {key} : {value}')
    
kpss_test(df["Inflation_ConsumerPrice_Annual_Percentage"])
KPSS Statistic: 0.2424327669196838

p-value: 0.1

num lags: 11

Critial Values:
   10% : 0.347
   5% : 0.463
   2.5% : 0.574
   1% : 0.739
/home/crown/miniconda/envs/nilimeshdss/lib/python3.6/site-packages/statsmodels/tsa/stattools.py:1278: InterpolationWarning: p-value is greater than the indicated p-value
  warn("p-value is greater than the indicated p-value", InterpolationWarning)

How to find the order of differencing (d) in ARIMA model

In [9]:
import numpy as np, pandas as pd
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.figsize':(12,14), 'figure.dpi':120})

# Import data
#df = pd.read_csv('shampoo.csv', header=0, names = ['Sales'])
df.reset_index(drop=True, inplace=True)

# Original Series
fig, axes = plt.subplots(5, 2, sharex=True)
axes[0, 0].plot(df.values); axes[0, 0].set_title('Original Series')
plot_acf(df.values, ax=axes[0, 1])

# 1st Differencing
df1 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff()
axes[1, 0].plot(df1); axes[1, 0].set_title('1st Order Differencing')
plot_acf(df1.dropna(), ax=axes[1, 1])

# 2nd Differencing
df2 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff().diff()
axes[2, 0].plot(df2); axes[2, 0].set_title('2nd Order Differencing')
plot_acf(df2.dropna(), ax=axes[2, 1])

# 3rd Differencing
df3 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff().diff().diff()
axes[3, 0].plot(df3); axes[3, 0].set_title('3rd Order Differencing')
plot_acf(df3.dropna(), ax=axes[3, 1])

# 3rd Differencing
df4 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff().diff().diff().diff()
axes[4, 0].plot(df4); axes[4, 0].set_title('4th Order Differencing')
plot_acf(df4.dropna(), ax=axes[4, 1])

plt.show()

ADF and KPSS statistics

In [10]:
warnings.filterwarnings("ignore")

print("---------------------------------------------")
print("First Diffencing: ")
print("---------------------------------------------")
df1 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff()
print(); print("---------------------------------------------")
adf_test(df1.dropna())
print(); print("---------------------------------------------")
kpss_test(df1.dropna())
print(); print("---------------------------------------------")


print(); print("---------------------------------------------")
print("2nd Diffencing: ")
print("---------------------------------------------")
df2 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff().diff()
print(); print("---------------------------------------------")
adf_test(df2.dropna())
print(); print("---------------------------------------------")
kpss_test(df2.dropna())
print(); print("---------------------------------------------")

print(); print("---------------------------------------------")
print("3rd Diffencing: ")
print("---------------------------------------------")
df3 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff().diff().diff()
print(); print("---------------------------------------------")
adf_test(df3.dropna())
print(); print("---------------------------------------------")
kpss_test(df3.dropna())
print(); print("---------------------------------------------")

print(); print("---------------------------------------------")
print("4th Diffencing: ")
print("---------------------------------------------")
df4 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff().diff().diff().diff()
print(); print("---------------------------------------------")
adf_test(df4.dropna())
print(); print("---------------------------------------------")
kpss_test(df4.dropna())
print(); print("---------------------------------------------")
---------------------------------------------
First Diffencing: 
---------------------------------------------

---------------------------------------------

ADF Statistic: -7.369435723520059

n_lags: 9.05338669806213e-11

p-value: 9.05338669806213e-11

Critial Values:
   1%, -3.548493559596539
   5%, -2.912836594776334
   10%, -2.594129155766944

---------------------------------------------

KPSS Statistic: 0.17056940350310107

p-value: 0.1

num lags: 11

Critial Values:
   10% : 0.347
   5% : 0.463
   2.5% : 0.574
   1% : 0.739

---------------------------------------------

---------------------------------------------
2nd Diffencing: 
---------------------------------------------

---------------------------------------------

ADF Statistic: -7.014316432007098

n_lags: 6.794504033658939e-10

p-value: 6.794504033658939e-10

Critial Values:
   1%, -3.55770911573439
   5%, -2.9167703434435808
   10%, -2.59622219478738

---------------------------------------------

KPSS Statistic: 0.09865895441617496

p-value: 0.1

num lags: 11

Critial Values:
   10% : 0.347
   5% : 0.463
   2.5% : 0.574
   1% : 0.739

---------------------------------------------

---------------------------------------------
3rd Diffencing: 
---------------------------------------------

---------------------------------------------

ADF Statistic: -5.20090225747649

n_lags: 8.754869426913789e-06

p-value: 8.754869426913789e-06

Critial Values:
   1%, -3.5745892596209488
   5%, -2.9239543084490744
   10%, -2.6000391840277777

---------------------------------------------

KPSS Statistic: 0.09155447361710153

p-value: 0.1

num lags: 11

Critial Values:
   10% : 0.347
   5% : 0.463
   2.5% : 0.574
   1% : 0.739

---------------------------------------------

---------------------------------------------
4th Diffencing: 
---------------------------------------------

---------------------------------------------

ADF Statistic: -4.625797957982303

n_lags: 0.0001157421652520446

p-value: 0.0001157421652520446

Critial Values:
   1%, -3.584828853223594
   5%, -2.9282991495198907
   10%, -2.6023438271604937

---------------------------------------------

KPSS Statistic: 0.09017989281798572

p-value: 0.1

num lags: 11

Critial Values:
   10% : 0.347
   5% : 0.463
   2.5% : 0.574
   1% : 0.739

---------------------------------------------
In [ ]:
 

How to find the order of the AR term (p)

In [11]:
from statsmodels.graphics.tsaplots import plot_pacf

# PACF plot 
plt.rcParams.update({'figure.figsize':(9,3), 'figure.dpi':120})
fig, axes = plt.subplots(1, 2, sharex=True)

df2 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff().diff() #.diff() #.diff()

axes[0].plot(df2); axes[0].set_title('2nd Differencing')
axes[1].set(ylim=(-3,3))
plot_pacf(df2.dropna(), ax=axes[1]) #PACF

plt.show()

How to find the order of the MA term (q)

In [12]:
from statsmodels.graphics.tsaplots import plot_acf
import matplotlib.pyplot as plt

plt.rcParams.update({'figure.figsize':(9,3), 'figure.dpi':120})
fig, axes = plt.subplots(1, 2, sharex=True)

df2 = df["Inflation_ConsumerPrice_Annual_Percentage"].diff().diff() #.diff() #.diff()
axes[0].plot(df2); axes[0].set_title('2nd Differencing')
#axes[1].set(ylim=(0,1.2))
plot_acf(df2.dropna(), ax=axes[1]) # ACF

plt.show()
In [13]:
## ADF test
adf_test(df2.dropna())
ADF Statistic: -7.014316432007098

n_lags: 6.794504033658939e-10

p-value: 6.794504033658939e-10

Critial Values:
   1%, -3.55770911573439
   5%, -2.9167703434435808
   10%, -2.59622219478738

Build the ARIMA(p,d,q) Model

In [14]:
from statsmodels.tsa.arima_model import ARIMA

plt.rcParams.update({'figure.figsize':(16,6), 'figure.dpi':220})

df = read_csv(filename)
df = df.set_index('Year')

# ARIMA Model
model = ARIMA(df["Inflation_ConsumerPrice_Annual_Percentage"], order=(2,2,0))
model_fit = model.fit(disp=0)
print(model_fit.summary())

# Plot residual errors
residuals = pd.DataFrame(model_fit.resid)
fig, ax = plt.subplots(1,2)
residuals.plot(title="Residuals", ax=ax[0])
residuals.plot(kind='kde', title='Density', ax=ax[1])
plt.show()

# Actual vs Fitted
model_fit.plot_predict(dynamic=False)
plt.show()
                                          ARIMA Model Results                                           
========================================================================================================
Dep. Variable:     D2.Inflation_ConsumerPrice_Annual_Percentage   No. Observations:                   59
Model:                                           ARIMA(2, 2, 0)   Log Likelihood                -122.191
Method:                                                 css-mle   S.D. of innovations              1.913
Date:                                          Wed, 04 Aug 2021   AIC                            252.382
Time:                                                  16:51:55   BIC                            260.692
Sample:                                                       2   HQIC                           255.626
                                                                                                        
======================================================================================================================
                                                         coef    std err          z      P>|z|      [0.025      0.975]
----------------------------------------------------------------------------------------------------------------------
const                                                 -0.0029      0.150     -0.019      0.985      -0.297       0.292
ar.L1.D2.Inflation_ConsumerPrice_Annual_Percentage    -0.2622      0.117     -2.236      0.029      -0.492      -0.032
ar.L2.D2.Inflation_ConsumerPrice_Annual_Percentage    -0.4144      0.115     -3.595      0.001      -0.640      -0.188
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1           -0.3164           -1.5208j            1.5534           -0.2826
AR.2           -0.3164           +1.5208j            1.5534            0.2826
-----------------------------------------------------------------------------
In [ ]:
 

using Auto ARIMA

In [15]:
import pmdarima as pm

model_with_auto_d = pm.auto_arima(df, start_p=1, start_q=1,
                      test='adf',       # use adftest to find optimal 'd'
                      max_p=4, max_q=4, # maximum p, q
                      m=1,              # frequency of series
                      
                      d=None,           # let model determine 'd'
                      
                      seasonal=False,   # No Seasonality
                      start_P=0, 
                      D=0, 
                      trace=True,
                      error_action='ignore',  
                      suppress_warnings=True, 
                      stepwise=True)

print(model_with_auto_d.summary())
Fit ARIMA: order=(1, 1, 1); AIC=231.914, BIC=240.292, Fit time=0.036 seconds
Fit ARIMA: order=(0, 1, 0); AIC=234.217, BIC=238.406, Fit time=0.002 seconds
Fit ARIMA: order=(1, 1, 0); AIC=234.703, BIC=240.986, Fit time=0.015 seconds
Fit ARIMA: order=(0, 1, 1); AIC=232.029, BIC=238.312, Fit time=0.033 seconds
Fit ARIMA: order=(2, 1, 1); AIC=226.472, BIC=236.943, Fit time=0.047 seconds
Fit ARIMA: order=(2, 1, 0); AIC=226.357, BIC=234.734, Fit time=0.022 seconds
Fit ARIMA: order=(3, 1, 1); AIC=228.471, BIC=241.038, Fit time=0.078 seconds
Fit ARIMA: order=(3, 1, 0); AIC=227.248, BIC=237.720, Fit time=0.043 seconds
Total fit time: 0.280 seconds
                             ARIMA Model Results                              
==============================================================================
Dep. Variable:                    D.y   No. Observations:                   60
Model:                 ARIMA(2, 1, 0)   Log Likelihood                -109.178
Method:                       css-mle   S.D. of innovations              1.488
Date:                Wed, 04 Aug 2021   AIC                            226.357
Time:                        16:51:57   BIC                            234.734
Sample:                             1   HQIC                           229.633
                                                                              
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const          0.0015      0.165      0.009      0.993      -0.322       0.325
ar.L1.D.y      0.2195      0.118      1.864      0.067      -0.011       0.450
ar.L2.D.y     -0.3921      0.116     -3.384      0.001      -0.619      -0.165
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1            0.2800           -1.5723j            1.5971           -0.2220
AR.2            0.2800           +1.5723j            1.5971            0.2220
-----------------------------------------------------------------------------
In [16]:
model_with_d_equals_1 = pm.auto_arima(df, start_p=1, start_q=1,
                      test='adf',       # use adftest to find optimal 'd'
                      max_p=4, max_q=4, max_d=4, # maximum p, q and d
                      m=1,              # frequency of series
                      
                      d=1,              # let model determine 'd'
                      
                      seasonal=False,   # No Seasonality
                      start_P=0, 
                      D=0, 
                      trace=True,
                      error_action='ignore',  
                      suppress_warnings=True, 
                      stepwise=True)

print(model_with_d_equals_1.summary())
Fit ARIMA: order=(1, 1, 1); AIC=231.914, BIC=240.292, Fit time=0.036 seconds
Fit ARIMA: order=(0, 1, 0); AIC=234.217, BIC=238.406, Fit time=0.002 seconds
Fit ARIMA: order=(1, 1, 0); AIC=234.703, BIC=240.986, Fit time=0.016 seconds
Fit ARIMA: order=(0, 1, 1); AIC=232.029, BIC=238.312, Fit time=0.033 seconds
Fit ARIMA: order=(2, 1, 1); AIC=226.472, BIC=236.943, Fit time=0.046 seconds
Fit ARIMA: order=(2, 1, 0); AIC=226.357, BIC=234.734, Fit time=0.023 seconds
Fit ARIMA: order=(3, 1, 1); AIC=228.471, BIC=241.038, Fit time=0.081 seconds
Fit ARIMA: order=(3, 1, 0); AIC=227.248, BIC=237.720, Fit time=0.041 seconds
Total fit time: 0.281 seconds
                             ARIMA Model Results                              
==============================================================================
Dep. Variable:                    D.y   No. Observations:                   60
Model:                 ARIMA(2, 1, 0)   Log Likelihood                -109.178
Method:                       css-mle   S.D. of innovations              1.488
Date:                Wed, 04 Aug 2021   AIC                            226.357
Time:                        16:51:58   BIC                            234.734
Sample:                             1   HQIC                           229.633
                                                                              
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const          0.0015      0.165      0.009      0.993      -0.322       0.325
ar.L1.D.y      0.2195      0.118      1.864      0.067      -0.011       0.450
ar.L2.D.y     -0.3921      0.116     -3.384      0.001      -0.619      -0.165
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1            0.2800           -1.5723j            1.5971           -0.2220
AR.2            0.2800           +1.5723j            1.5971            0.2220
-----------------------------------------------------------------------------
In [17]:
model_with_d_equals_2 = pm.auto_arima(df, start_p=1, start_q=1,
                      test='adf',       # use adftest to find optimal 'd'
                      max_p=4, max_q=4, # maximum p, q
                      m=1,              # frequency of series
                      
                      d=2,              # let model determine 'd'
                      
                      seasonal=False,   # No Seasonality
                      start_P=0, 
                      D=0, 
                      trace=True,
                      error_action='ignore',  
                      suppress_warnings=True, 
                      stepwise=True)

print(model_with_d_equals_2.summary())
Fit ARIMA: order=(1, 2, 1); AIC=nan, BIC=nan, Fit time=nan seconds
Fit ARIMA: order=(0, 2, 0); AIC=261.952, BIC=266.107, Fit time=0.002 seconds
Fit ARIMA: order=(1, 2, 0); AIC=261.893, BIC=268.126, Fit time=0.010 seconds
Fit ARIMA: order=(0, 2, 1); AIC=237.057, BIC=243.290, Fit time=0.020 seconds
Fit ARIMA: order=(0, 2, 2); AIC=234.497, BIC=242.807, Fit time=0.043 seconds
Fit ARIMA: order=(1, 2, 3); AIC=nan, BIC=nan, Fit time=nan seconds
Fit ARIMA: order=(1, 2, 2); AIC=nan, BIC=nan, Fit time=nan seconds
Fit ARIMA: order=(0, 2, 3); AIC=nan, BIC=nan, Fit time=nan seconds
Total fit time: 0.113 seconds
                             ARIMA Model Results                              
==============================================================================
Dep. Variable:                   D2.y   No. Observations:                   59
Model:                 ARIMA(0, 2, 2)   Log Likelihood                -113.248
Method:                       css-mle   S.D. of innovations              1.600
Date:                Wed, 04 Aug 2021   AIC                            234.497
Time:                        16:51:58   BIC                            242.807
Sample:                             2   HQIC                           237.741
                                                                              
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         -0.0076      0.016     -0.467      0.642      -0.040       0.024
ma.L1.D2.y    -0.6154      0.157     -3.931      0.000      -0.922      -0.309
ma.L2.D2.y    -0.3846      0.151     -2.542      0.014      -0.681      -0.088
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
MA.1            1.0000           +0.0000j            1.0000            0.0000
MA.2           -2.6004           +0.0000j            2.6004            0.5000
-----------------------------------------------------------------------------

How to interpret the residual plots in ARIMA model

In [18]:
model_with_auto_d.plot_diagnostics(figsize=(12,10))
plt.show()
In [19]:
model_with_d_equals_1.plot_diagnostics(figsize=(12,10))
plt.show()
In [20]:
model_with_d_equals_2.plot_diagnostics(figsize=(12,10))
plt.show()

Forecast

In [21]:
model = model_with_auto_d
In [22]:
# Forecast
n_periods = 10
fc, confint = model.predict(n_periods=n_periods, return_conf_int=True)
#index_of_fc = np.arange(len(df), len(df)+n_periods)
index_of_fc = np.arange(2020, 2020+n_periods)

# make series for plotting purpose
fc_series = pd.Series(fc, index=index_of_fc)
lower_series = pd.Series(confint[:, 0], index=index_of_fc)
upper_series = pd.Series(confint[:, 1], index=index_of_fc)

# Plot
plt.plot(df)
plt.plot(fc_series, color='darkgreen')
plt.fill_between(lower_series.index, 
                 lower_series, 
                 upper_series, 
                 color='k', alpha=.15)

plt.title("Final Forecast")
plt.show()

print(); print(fc_series)
print(); print(lower_series)
print(); print(upper_series)
2020    1.355400
2021    1.610703
2022    1.620696
2023    1.524496
2024    1.501160
2025    1.535455
2026    1.553836
2027    1.546127
2028    1.538930
2029    1.542074
dtype: float64

2020   -1.561831
2021   -2.990098
2022   -3.641729
2023   -4.135269
2024   -4.635961
2025   -5.138096
2026   -5.594733
2027   -6.011277
2028   -6.405970
2029   -6.785071
dtype: float64

2020    4.272630
2021    6.211504
2022    6.883121
2023    7.184261
2024    7.638281
2025    8.209007
2026    8.702404
2027    9.103530
2028    9.483830
2029    9.869220
dtype: float64

Using FB Prophet

In [23]:
from fbprophet import Prophet
import pandas as pd

df = read_csv(filename)
#df = df.set_index('Year')

print(df.head())
#print(); print(df[['Year', 'Population']])

df["End_Year"] = 0
for i in range(0, len(df)):
    df.iloc[i, 2] = str(df.iloc[i, 0]) + '-12-' + '31'

print(); print(df.head())
   Year  Inflation_ConsumerPrice_Annual_Percentage
0  1960                                   1.457976
1  1961                                   1.070724
2  1962                                   1.198773
3  1963                                   1.239669
4  1964                                   1.278912

   Year  Inflation_ConsumerPrice_Annual_Percentage    End_Year
0  1960                                   1.457976  1960-12-31
1  1961                                   1.070724  1961-12-31
2  1962                                   1.198773  1962-12-31
3  1963                                   1.239669  1963-12-31
4  1964                                   1.278912  1964-12-31
In [24]:
# Create a new Data Frame
df_pop = pd.DataFrame()

df_pop[['ds','y']] = df[['End_Year', 'Inflation_ConsumerPrice_Annual_Percentage']]

# Convert Data Frame to FBProphet Timeseries ds and y
df_pop['ds'] = pd.to_datetime(df_pop['ds'])
df_pop['y']  = pd.to_numeric(df_pop['y'])

print(df_pop.tail())

# Create FBProphet Model with Dataset
m = Prophet(daily_seasonality=False, weekly_seasonality=True, yearly_seasonality=True)
m.fit(df_pop)

future = m.make_future_dataframe(periods=10, freq = 'Y')

print()
print(future.tail(26))

forecast = m.predict(future)
print(forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail(25))

fig = m.plot(forecast)
plt.show()


# Save Data in a CSV file
df_final = pd.DataFrame()
df_final[['Year', 'yhat', 'yhat_lower', 'yhat_upper']] = forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']]

df_final['Inflation_ConsumerPrice_Annual_Percentage'] = df_pop['y']

print(df_final.head(len(df_final)))

#df_final.to_csv('Forecast_final.csv',index = False)
           ds         y
56 2016-12-31  1.261583
57 2017-12-31  2.130110
58 2018-12-31  2.442583
59 2019-12-31  1.812210
60 2020-12-31  1.233584

           ds
45 2005-12-31
46 2006-12-31
47 2007-12-31
48 2008-12-31
49 2009-12-31
50 2010-12-31
51 2011-12-31
52 2012-12-31
53 2013-12-31
54 2014-12-31
55 2015-12-31
56 2016-12-31
57 2017-12-31
58 2018-12-31
59 2019-12-31
60 2020-12-31
61 2021-12-31
62 2022-12-31
63 2023-12-31
64 2024-12-31
65 2025-12-31
66 2026-12-31
67 2027-12-31
68 2028-12-31
69 2029-12-31
70 2030-12-31
           ds      yhat  yhat_lower  yhat_upper
46 2006-12-31  2.385425   -0.710759    5.754560
47 2007-12-31  3.435699    0.240129    6.607037
48 2008-12-31  4.040568    0.866148    7.224155
49 2009-12-31  2.029975   -1.274430    5.054499
50 2010-12-31  2.114411   -1.152184    5.465187
51 2011-12-31  1.950290   -1.311365    4.855142
52 2012-12-31  3.090569   -0.019694    6.331506
53 2013-12-31  2.239118   -0.785096    5.607538
54 2014-12-31  3.728092    0.655521    6.802504
55 2015-12-31  1.729103   -1.629456    4.836881
56 2016-12-31  1.605160   -1.638708    4.901550
57 2017-12-31  1.733608   -1.382032    4.749594
58 2018-12-31  2.778093   -0.683182    5.732331
59 2019-12-31  1.938247   -1.179921    5.047462
60 2020-12-31  1.383973   -1.841176    4.626470
61 2021-12-31  1.462594   -1.455383    4.545920
62 2022-12-31  1.292684   -1.944390    4.405319
63 2023-12-31  1.432736   -1.931835    4.585354
64 2024-12-31  1.593116   -1.531976    4.887536
65 2025-12-31  3.076275    0.122054    6.207434
66 2026-12-31  1.071497   -2.178434    4.376499
67 2027-12-31  1.161722   -1.820174    4.513581
68 2028-12-31  1.087606   -2.191381    4.298735
69 2029-12-31  2.126276   -0.866711    5.259378
70 2030-12-31  1.280640   -1.876888    4.502679
         Year      yhat  yhat_lower  yhat_upper  \
0  1960-12-31  4.824380    1.723616    8.120083   
1  1961-12-31  4.952896    1.811249    8.031961   
2  1962-12-31  5.997448    2.524197    8.861642   
3  1963-12-31  5.157670    1.804994    8.494936   
4  1964-12-31  4.603464    1.637028    7.978469   
..        ...       ...         ...         ...   
66 2026-12-31  1.071497   -2.178434    4.376499   
67 2027-12-31  1.161722   -1.820174    4.513581   
68 2028-12-31  1.087606   -2.191381    4.298735   
69 2029-12-31  2.126276   -0.866711    5.259378   
70 2030-12-31  1.280640   -1.876888    4.502679   

    Inflation_ConsumerPrice_Annual_Percentage  
0                                    1.457976  
1                                    1.070724  
2                                    1.198773  
3                                    1.239669  
4                                    1.278912  
..                                        ...  
66                                        NaN  
67                                        NaN  
68                                        NaN  
69                                        NaN  
70                                        NaN  

[71 rows x 5 columns]
In [ ]: