err <- ts(c(0.6100, 1.3500, 1.0300, 0.9600, 1.1100, 0.8350 , 0.8800 , 1.0600 , 1.3800 , 1.6200, 1.5800 , 1.2800 , 1.3000 , 1.4300 , 2.1500 , 1.9100 , 1.8300 , 1.9500 ,1.9999, 1.8500 , 1.5500 , 1.9800 ,1.7044 ,1.8593 , 1.9900 , 2.0400, 1.8950, 2.0100 , 1.6900 , 2.1800 ,2.2150, 2.1293 , 2.1000 , 2.1200 , 2.0500 , 1.9000, 1.8350, 1.9000 ,1.9500 , 1.7800 , 1.5950, 1.8500 , 1.8400, 1.5800, 1.6100 , 1.7200 , 1.8500 , 1.6700, 1.8050, 1.9400, 1.5000 , 1.3100 , 1.4864, 1.2400 , 0.9300 , 1.1400, -0.6100, -0.4300 ,-0.4700 ,-0.3450), frequency = 7, start = c(23, 1), end = c(31, 4))
我知道这个残差序列具有一些Seriel相关性,可以用ARIMA
来建模。
acf(err[1:length(err)]);pacf(err[1:length(err)])
# x axis starts with zero.
# showing only integer lags here, same plot as full seasonal periods.
# shows it typically can be fitted by a MA model.
所以我在这里尝试了一些配件。我使用stats::arima
进行拟合,并使用stats::filter
进行仔细检查。这显示了一些意外的结果。
m1 <- arima(x = err, order=(0,0,5), include.mean=F)
# output
# Call:
# arima(x = err, order = c(0, 0, 5), include.mean = F)
# Coefficients:
# ma1 ma2 ma3 ma4 ma5
# 1.1057 1.2212 1.2151 0.9396 0.5706
# s.e. 0.1411 0.1436 0.1666 0.3120 0.2614
# sigma^2 estimated as 0.1846: log likelihood = -36.48, aic = 82.96
f1 <- filter(x=err, filter = c(0.5706, 0.9396, 1.2151, 1.2212, 1.1057), method = 'convolution'))
res <- err - na.omit(fil1.1)
acf(mod1$residuals[1:length(mod1$residuals)]); acf(res[1:length(res)])
filter
的情节显然与目标背道而驰;我期望手工产生的残差与stats::arima
产生的残差相同,或者至少足够接近以显示白噪声残差。
我的问题:
NA
?