如何对从对数变换和差分数据获得的预测值进行逆变换?

时间:2019-05-09 21:31:55

标签: python time-series transform arima forecast

为了使其静止,我执行了对数转换,然后对对数值进行了差分。

df['Val_1'] = df['Val_1'].apply(lambda x: np.log(x))  
df['Val_1_trans'] = df['Val_1'].diff(periods = 1)

使用我预测的ARIMA建模,如何对预测值进行逆变换?

def prediction(val, p , d, q):
    from statsmodels.tsa.arima_model import ARIMA
    model = ARIMA(df[val], order = (p, d, q))
    results_ = model.fit()
    forecast = results_.forecast(steps=4)[0]   
    fc_series = pd.Series(forecast)
    print('Forecast %s\n' %(val), fc_series)

    return fc_series  

0 个答案:

没有答案