I don't know how to change it. Arima Model prediction of R language

Source: Internet
Author: User
Tags diff

There's still a lot of data out there, and the program hasn't been completely done yet.

> read.xlsx ("h:/projectpaper/paper/1.xlsx", "Sheet1")

> item<-read.xlsx ("h:/projectpaper/paper/1.xlsx", "Sheet1")

> item<-TS (item,start=c (2014))

> Plot.ts (item)

> itemdiff<-diff (item,differences=1)
> plot.ts (Itemdiff)
> itemdiff2<-diff (item,differences=2)
> plot.ts (ITEMDIFF2)
> itemdiff3<-diff (item,differences=3)
> plot.ts (ITEMDIFF3)
> ACF (ITEMDIFF2,LAG.MAX=20)
> ACF (itemdiff2,lag.max=20,plot=false)

Autocorrelations of series ' itemdiff2 ', by lag

0 1 2 3 4 5 6 7
1.000-0.668 0.177 0.004-0.111 0.255-0.289 0.275
8 9 10 11 12 13 14
-0.282 0.204-0.016-0.191 0.281-0.197 0.058

> pacf (itemdiff2,lag.max=20)
> pacf (itemdiff2,lag.max=20,plot=false)

Partial autocorrelations of series ' itemdiff2 ', by lag

1 2 3 4 5 6 7 8 9
-0.668-0.484-0.339-0.499-0.208-0.297 0.061-0.068 0.011
10 11 12) 13 14
0.140-0.142-0.169-0.033-0.148

> Itemarima<-arima (Item,order=c (1,2,1))
> Itemarima

Call:
Arima (x = Item, order = C (1, 2, 1))

Coefficients:
AR1 MA1
-0.4631-1.0000
S.E. 0.2145 0.2463

Sigma^2 estimated as 602016:log likelihood = -122.96, AIC = 251.92

> Library (forecast)
> Itemarimaforecast<-forecast (itemarima,h=5,level=c (99.5))
> Itemarimaforecast

Point Forecast Lo 99.5 Hi 99.5
2031 5777.286 3529.572 8025.001
2032 5780.032 3164.663 8395.400
2033 5818.222 2592.498 9043.945
2034 5839.998 2169.228 9510.768
2035 5869.375 1721.669 10017.081
> Plot.forecast (itemarimaforecast$residuals)
Error in Plot.forecast (itemarimaforecast$residuals):
There's no "plot.forecast" function.
> ACF (ITEMARIMAFORECAST$RESIDUALS,LAG.MAX=20)
> Box.test (itemarimaforecast$residuals, lag=20, type= "Ljung-box")

Box-ljung Test

Data:itemarimaforecast$residuals
x-squared = na, df = a, P-value = NA

> plot.ts (itemarimaforecast$residuals)

I don't know how to change it. Arima Model prediction of R language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.