Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in na.fail.default(as.ts(x)) : missing values in object in time series forecasting

I am trying to perform fit diagnostic on a salesData forecast using

acf(SalesDataFC$residuals)

however I am getting an error:

salesDataFC$residuals

         Jan         Feb         Mar         Apr         May

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

         Jun         Jul         Aug         Sep         Oct

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

         Nov         Dec

2012 NA NA

2013 -4.73145658 4.89403358

2014 2.11005638 -2.66661403

2015 0.01368218 1.55215790

acf(salesDataFC$residuals)

Error in na.fail.default(as.ts(x)) : missing values in object

like image 601
Deb Avatar asked Jul 30 '17 12:07

Deb


1 Answers

here I was missing to check the missing values i.e. NA. hence na.action = na.pass will be used after acf(salesDataFC$residuals). so the command goes like acf(salesDataFC$residuals, na.action = na.pass).

like image 99
Deb Avatar answered Oct 24 '22 13:10

Deb