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

Time Series Forecasting - FBProphet in Python

Colombia 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 = 'Colombia_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                                   5.814076
1961                                   8.283190
1962                                   4.697094
1963                                  26.355436
1964                                  17.072435

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: -1.3535885921424577

n_lags: 0.6043132003060728

p-value: 0.6043132003060728

Critial Values:
   1%, -3.5463945337644063
   5%, -2.911939409384601
   10%, -2.5936515282964665

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.2707234427212749

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: -12.135040700634026

n_lags: 1.701207539038095e-22

p-value: 1.701207539038095e-22

Critial Values:
   1%, -3.5463945337644063
   5%, -2.911939409384601
   10%, -2.5936515282964665

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

KPSS Statistic: 0.27664831821564345

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: -4.330432619013219

n_lags: 0.0003932900563767173

p-value: 0.0003932900563767173

Critial Values:
   1%, -3.5714715250448363
   5%, -2.922629480573571
   10%, -2.5993358475635153

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

KPSS Statistic: 0.08757561514742138

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: -3.0936148459135064

n_lags: 0.027029341279058736

p-value: 0.027029341279058736

Critial Values:
   1%, -3.5812576580093696
   5%, -2.9267849124681518
   10%, -2.6015409829867675

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

KPSS Statistic: 0.09870960556348744

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: -6.345563553610398

n_lags: 2.6883621166600842e-08

p-value: 2.6883621166600842e-08

Critial Values:
   1%, -3.5812576580093696
   5%, -2.9267849124681518
   10%, -2.6015409829867675

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

KPSS Statistic: 0.13939989239010905

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: -4.330432619013219

n_lags: 0.0003932900563767173

p-value: 0.0003932900563767173

Critial Values:
   1%, -3.5714715250448363
   5%, -2.922629480573571
   10%, -2.5993358475635153

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                -187.825
Method:                                                 css-mle   S.D. of innovations              5.765
Date:                                          Mon, 02 Aug 2021   AIC                            383.649
Time:                                                  17:01:39   BIC                            391.959
Sample:                                                       2   HQIC                           386.893
                                                                                                        
======================================================================================================================
                                                         coef    std err          z      P>|z|      [0.025      0.975]
----------------------------------------------------------------------------------------------------------------------
const                                                 -0.0850      0.284     -0.299      0.766      -0.642       0.472
ar.L1.D2.Inflation_ConsumerPrice_Annual_Percentage    -1.0750      0.107    -10.061      0.000      -1.284      -0.866
ar.L2.D2.Inflation_ConsumerPrice_Annual_Percentage    -0.6047      0.111     -5.430      0.000      -0.823      -0.386
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1           -0.8889           -0.9293j            1.2860           -0.3715
AR.2           -0.8889           +0.9293j            1.2860            0.3715
-----------------------------------------------------------------------------
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=372.183, BIC=380.560, Fit time=0.034 seconds
Fit ARIMA: order=(0, 1, 0); AIC=381.715, BIC=385.904, Fit time=0.002 seconds
Fit ARIMA: order=(1, 1, 0); AIC=370.947, BIC=377.230, Fit time=0.013 seconds
Fit ARIMA: order=(0, 1, 1); AIC=371.287, BIC=377.570, Fit time=0.011 seconds
Fit ARIMA: order=(2, 1, 0); AIC=371.817, BIC=380.195, Fit time=0.022 seconds
Fit ARIMA: order=(2, 1, 1); AIC=373.561, BIC=384.033, Fit time=0.070 seconds
Total fit time: 0.156 seconds
                             ARIMA Model Results                              
==============================================================================
Dep. Variable:                    D.y   No. Observations:                   60
Model:                 ARIMA(1, 1, 0)   Log Likelihood                -182.474
Method:                       css-mle   S.D. of innovations              5.056
Date:                Mon, 02 Aug 2021   AIC                            370.947
Time:                        17:01:41   BIC                            377.230
Sample:                             1   HQIC                           373.405
                                                                              
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         -0.0629      0.457     -0.138      0.891      -0.959       0.833
ar.L1.D.y     -0.4347      0.115     -3.790      0.000      -0.660      -0.210
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1           -2.3004           +0.0000j            2.3004            0.5000
-----------------------------------------------------------------------------
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=372.183, BIC=380.560, Fit time=0.034 seconds
Fit ARIMA: order=(0, 1, 0); AIC=381.715, BIC=385.904, Fit time=0.002 seconds
Fit ARIMA: order=(1, 1, 0); AIC=370.947, BIC=377.230, Fit time=0.012 seconds
Fit ARIMA: order=(0, 1, 1); AIC=371.287, BIC=377.570, Fit time=0.011 seconds
Fit ARIMA: order=(2, 1, 0); AIC=371.817, BIC=380.195, Fit time=0.023 seconds
Fit ARIMA: order=(2, 1, 1); AIC=373.561, BIC=384.033, Fit time=0.095 seconds
Total fit time: 0.179 seconds
                             ARIMA Model Results                              
==============================================================================
Dep. Variable:                    D.y   No. Observations:                   60
Model:                 ARIMA(1, 1, 0)   Log Likelihood                -182.474
Method:                       css-mle   S.D. of innovations              5.056
Date:                Mon, 02 Aug 2021   AIC                            370.947
Time:                        17:01:42   BIC                            377.230
Sample:                             1   HQIC                           373.405
                                                                              
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         -0.0629      0.457     -0.138      0.891      -0.959       0.833
ar.L1.D.y     -0.4347      0.115     -3.790      0.000      -0.660      -0.210
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1           -2.3004           +0.0000j            2.3004            0.5000
-----------------------------------------------------------------------------
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=371.129, BIC=379.439, Fit time=0.126 seconds
Fit ARIMA: order=(0, 2, 0); AIC=438.750, BIC=442.905, Fit time=0.003 seconds
Fit ARIMA: order=(1, 2, 0); AIC=404.566, BIC=410.799, Fit time=0.023 seconds
Fit ARIMA: order=(0, 2, 1); AIC=381.862, BIC=388.094, Fit time=0.037 seconds
Fit ARIMA: order=(2, 2, 1); AIC=371.709, BIC=382.097, Fit time=0.111 seconds
Fit ARIMA: order=(1, 2, 2); AIC=372.192, BIC=382.580, Fit time=0.230 seconds
Fit ARIMA: order=(2, 2, 2); AIC=373.435, BIC=385.900, Fit time=0.171 seconds
Total fit time: 0.702 seconds
                             ARIMA Model Results                              
==============================================================================
Dep. Variable:                   D2.y   No. Observations:                   59
Model:                 ARIMA(1, 2, 1)   Log Likelihood                -181.564
Method:                       css-mle   S.D. of innovations              5.032
Date:                Mon, 02 Aug 2021   AIC                            371.129
Time:                        17:01:42   BIC                            379.439
Sample:                             2   HQIC                           374.372
                                                                              
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         -0.0331      0.026     -1.251      0.216      -0.085       0.019
ar.L1.D2.y    -0.4387      0.115     -3.814      0.000      -0.664      -0.213
ma.L1.D2.y    -0.9999      0.050    -19.853      0.000      -1.099      -0.901
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1           -2.2794           +0.0000j            2.2794            0.5000
MA.1            1.0001           +0.0000j            1.0001            0.0000
-----------------------------------------------------------------------------

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    2.869499
2021    2.629374
2022    2.643552
2023    2.547183
2024    2.498870
2025    2.429667
2026    2.369545
2027    2.305475
2028    2.243121
2029    2.180021
dtype: float64

2020    -7.039752
2021    -8.753586
2022   -10.973908
2023   -12.611752
2024   -14.204125
2025   -15.627260
2026   -16.970494
2027   -18.227905
2028   -19.421984
2029   -20.558888
dtype: float64

2020    12.778750
2021    14.012333
2022    16.261013
2023    17.706119
2024    19.201865
2025    20.486594
2026    21.709583
2027    22.838855
2028    23.908227
2029    24.918931
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                                   5.814076
1  1961                                   8.283190
2  1962                                   4.697094
3  1963                                  26.355436
4  1964                                  17.072435

   Year  Inflation_ConsumerPrice_Annual_Percentage    End_Year
0  1960                                   5.814076  1960-12-31
1  1961                                   8.283190  1961-12-31
2  1962                                   4.697094  1962-12-31
3  1963                                  26.355436  1963-12-31
4  1964                                  17.072435  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  7.514293
57 2017-12-31  4.312141
58 2018-12-31  3.240234
59 2019-12-31  3.525493
60 2020-12-31  2.524621

           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   8.230303   -2.731386   18.549751
47 2007-12-31  10.129837   -0.876799   20.149438
48 2008-12-31   9.673367   -0.768066   19.943716
49 2009-12-31  10.841872   -0.407179   20.926520
50 2010-12-31   8.137535   -1.963487   19.030767
51 2011-12-31  11.549732    0.972327   21.924078
52 2012-12-31   7.645915   -3.665675   18.991693
53 2013-12-31  10.371472    0.731311   20.987242
54 2014-12-31   9.181510   -1.755066   20.082199
55 2015-12-31  10.345282   -0.343408   21.862613
56 2016-12-31   9.065811   -0.731415   19.763205
57 2017-12-31   5.251894   -4.306784   16.191698
58 2018-12-31   7.154058   -3.730628   18.025520
59 2019-12-31   9.874882   -0.209519   20.570411
60 2020-12-31   7.861361   -2.672589   18.839214
61 2021-12-31   5.159126   -6.133612   15.711431
62 2022-12-31   8.573953   -2.121613   18.790200
63 2023-12-31   4.755304   -5.087754   15.716940
64 2024-12-31   7.390960   -2.315822   18.072522
65 2025-12-31   6.203101   -4.145127   17.241302
66 2026-12-31   7.369503   -3.531087   17.062677
67 2027-12-31   4.662536   -5.636638   15.234644
68 2028-12-31   2.271383   -7.923245   12.155025
69 2029-12-31   4.175650   -6.905896   14.677353
70 2030-12-31   6.899103   -4.050598   16.873037
         Year       yhat  yhat_lower  yhat_upper  \
0  1960-12-31  21.960208   10.784834   32.894865   
1  1961-12-31  18.146569    7.326387   28.221141   
2  1962-12-31  20.049010   10.686471   30.577848   
3  1963-12-31  22.770110   12.442157   32.823858   
4  1964-12-31  20.756867   10.786816   31.386265   
..        ...        ...         ...         ...   
66 2026-12-31   7.369503   -3.531087   17.062677   
67 2027-12-31   4.662536   -5.636638   15.234644   
68 2028-12-31   2.271383   -7.923245   12.155025   
69 2029-12-31   4.175650   -6.905896   14.677353   
70 2030-12-31   6.899103   -4.050598   16.873037   

    Inflation_ConsumerPrice_Annual_Percentage  
0                                    5.814076  
1                                    8.283190  
2                                    4.697094  
3                                   26.355436  
4                                   17.072435  
..                                        ...  
66                                        NaN  
67                                        NaN  
68                                        NaN  
69                                        NaN  
70                                        NaN  

[71 rows x 5 columns]
In [ ]: