简体   繁体   English

估计的自由度不足

[英]Insufficient degrees of freedom to estimate

My degree of freedom is smaller than the number of rows in the dataset. 我的自由度小于数据集中的行数。 Why do I have the error "Insufficient degrees of freedom to estimate". 为什么我会出现“估算自由度不足”的错误。 What can I do to resolve this error? 我该怎么做才能解决此错误?

I have tried to reduce the value in differenced = difference(X,11) , but it still shows the error. 我试图减少differenced = difference(X,11) ,但它仍然显示错误。

dataset, validation = series[0:split_point], series[split_point:]
print('Dataset %d, Validation %d' % (len(dataset), len(validation)))
dataset.to_csv('dataset.csv')
validation.to_csv('validation.csv')
from pandas import Series
from statsmodels.tsa.arima_model import ARIMA
import numpy
# load dataset
series = Series.from_csv('dataset.csv', header=None)
series = series.iloc[1:]
series.head()
series.shape

from pandas import Series
from statsmodels.tsa.arima_model import ARIMA
import numpy
# create a differenced series
def difference(dataset, interval=1):
    diff = list()
    for i in range(interval+1, len(dataset)):
        value = int(dataset[i]) - int(dataset[i - interval])
        diff.append(value)
    return numpy.array(diff)

# load dataset
series = Series.from_csv('dataset.csv', header=None)
# seasonal difference
X = series.values
differenced = difference(X,11)
# fit model
model = ARIMA(differenced, order=(7,0,1))
model_fit = model.fit(disp=0)
# print summary of fit model
print(model_fit.summary())

series.head()结果

The shape is (17,) 形状是(17,)

After differencing, you are left with 6 observations (17 - 11 = 6). 差分后,剩下6个观察值(17 - 11 = 6)。 That's not enough for an ARIMA(7, 0, 1). 这对ARIMA来说还不够(7,0,1)。

With that little data, you are unlikely to get good forecasting performance with any model, but if you must, then I would recommend something much simpler, like ARIMA(1, 0, 0) or an exponential smoothing model. 使用这些小数据,您不可能在任何模型下获得良好的预测性能,但如果必须,那么我会推荐更简单的东西,如ARIMA(1,0,0)或指数平滑模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM