na.fail.default(as.ts(x))出错:在时间序列预测中缺少对象中的值

时间:2017-07-30 12:51:58

标签: r time-series analytics forecasting

我正在尝试使用

对salesData预测执行适合诊断
false

然而我收到了错误:

  

salesDataFC $残差

acf(SalesDataFC$residuals)

2012 NA NA NA NA NA

2013 1.00454060 0.74436890 0.59266194 0.53535119 0.18350112

2014 1.99667197 -3.32464848 0.28314025 2.30886777 7.90332419

2015 1.71499831 -0.52401427 0.34252510 -1.64516043 2.77034325

         Jan         Feb         Mar         Apr         May

2012 NA NA NA NA NA

2013 0.05094251 -0.22804463 -1.91518053 2.58830624 0.26477677

2014 4.40433679 0.32271024 1.57947031 1.43734334 -3.20311270

2015 -2.20471818 -0.90067401 -3.44177911 5.48261863 -2.98716442

         Jun         Jul         Aug         Sep         Oct

2012 NA NA

2013 -4.73145658 4.89403358

2014 2.11005638 -2.66661403

2015 0.01368218 1.55215790

  

ACF(salesDataFC $残差)

na.fail.default(as.ts(x))出错:对象中缺少值

1 个答案:

答案 0 :(得分:9)

我错过了检查缺失值,即NA。因此在acf(salesDataFC $ residuals)之后将使用na.action = na.pass。所以命令就像  acf(salesDataFC $ residuals,na.action = na.pass)。