I'd like to determine how good trend series B estimates trend series A. I tried this with OLS, but obviously the residuals are autocorrelated. I tried to correct with the Cochrane-Orcutt-Procedure (https://onlinecourses.science.psu.edu/stat501/node/360), but this didnĀ“t remedy autocorrelation. I tried python statsmodels GSLAR-function with different rho-values, but also no sucess.
What am I missing? Is regression analysis the right analytical approach? What are alternatives?
This is the data:
import pandas as pd
dataA = [0.02921, 0.02946, 0.02971, 0.02996, 0.03021, 0.03042, 0.03063,
0.03083, 0.031, 0.03117, 0.03129, 0.03142,
0.0315, 0.03146, 0.03142, 0.03142, 0.03138, 0.03129, 0.03117, 0.03104,
0.03096, 0.03083, 0.03067, 0.0305, 0.03042, 0.03042, 0.03042, 0.03042,
0.03046, 0.03058, 0.03075, 0.03087, 0.031, 0.03117, 0.03137, 0.03158,
0.03175, 0.03196, 0.03221, 0.03242, 0.03258, 0.03271, 0.03279, 0.03292,
0.03304, 0.03312]
dataB = [0.28416, 0.28756, 0.29716, 0.30777, 0.31047, 0.30262, 0.29666,
0.28918, 0.28008, 0.28037, 0.27909, 0.2738, 0.28378, 0.29538, 0.2927,
0.29232, 0.28845, 0.27793, 0.27858, 0.29067, 0.29573, 0.29336, 0.28964,
0.28601, 0.273, 0.26278, 0.26786, 0.27156, 0.27272, 0.28691, 0.30556,
0.3109, 0.31243, 0.31083, 0.31534, 0.32455, 0.33221, 0.33714, 0.33397,
0.32347, 0.31899, 0.31567, 0.30213, 0.29288, 0.29132, 0.29346]
daterange = pd.date_range(start='2012-07-31', end='2016-04-30',freq='M')
A = pd.Series(dataA, daterange)
B = pd.Series(dataB, daterange)
dataA and data B was derived from a seasonal decomposition (additive model):
from statsmodels.tsa.seasonal import seasonal_decompose
ADecomp = seasonal_decompose(ARaw)
dataA = ADecomp.trend
BDecomp = seasonal_decompose(BRaw)
dataB = BDecomp.trend
I guess this is more of an econometrics question than a Python question.
First thing to do is to see if both series are stationary.
If stationary: You can regress them through OLS to get an estimate. A stationary series is one where the variance is lowest in difference order.
If not stationary: 1) Test for co-integration using Engle Granger method. Two non stationary series could be jointly stationary. You can run an OLS here too. 2) If they aren't co-integrated, you will have to take the difference series of nth order where they are stationary and then run an OLS to get the predictors.
Hope this answers your question.