更新时间:2023-12-01 20:36:04
我认为问题出在滞后:您在时间上移动值,因此当您在所有菜单上调用 cbind
时,时间序列,最后得到的数据超出了 cmort
和R抱怨的最终日期.(尝试 cbind(趋势,温度,temp2,部分,partL4)
,您可以清楚地看到正在发生的事情).如果在调用 sarima
之前从 partL4
中删除了这些值,则它应该起作用:
I believe the problem comes from the lag: you're shifting the values in time, so when you call cbind
on all the time series, you're end up with data that extends beyond the final date for cmort
and R complains. (Try cbind(trend, temp, temp2, part, partL4)
and you can see clearly what is happening). If you drop those values from partL4
before you call sarima
it should work:
partL4_new <- window(partL4, end = 1979.750)
sarima(cmort, 2,0,0, xreg=cbind(trend, temp, temp2, part, partL4_new))