# R learning notes (1) — ARIMA model

In view of the existing tutorial (http://blog.csdn.net/desilting/article/details/39013825), in the operation of the problems and solutions
If you have to do d-order differences on a time series to get a stationary series, then you use the ARIMA(P, D, Q) model, where D is the order of the difference. ARIMA(P, D, Q) Model is fully known as Autoregressive Integrated Moving Average Model (ARIMA). AR is Autoregressive and P is an Autoregressive term. MA is the moving average, Q is the number of moving average terms, and D is the difference times made when the time series becomes stationary.
Here are some basic ways to view help:
A. Help ()
two

 1. Open R interface 2. 3. Click on “packages” in the pop-up page and then go to “…”

3.
library(help=”MASS”)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
data< – XTS (data,seq(as.POSIXct(“2014-01-01″),len=length(data),by=”day”)
Error in as. Vector (x, mode) :
cannot coerce type ‘closure’ to vector of type ‘any’
Solution: Just because the blogger did not replace the input data (source), it should be data< -xts(source,seq(as.POSIXct(“2014-01-01″),len=length(source),by=”day”))

acf < -acf (data_diff1,lag.max=100,plot=FALSE)
Error in na.fail. Default (as. Ts (x)) : there is a missing value
in the object
Solution: acf & lt; – acf(data_diff1,lag.max=100,na.action = na.pass,plot=FALSE)
However, in the ACF figure displayed at this time, the maximum value of the horizontal axis coordinate (hysteresis value) is not 100, and the horizontal axis coordinate grows exponentially with the value of E +00 and E +02.
After checking the specific value of ACF, it was found that the original horizontal coordinate of lag=1 was 86400, which should be changed to the unit of seconds (?). .
There is no way to solve this problem at present, just put “data< – “(data, seq (as POSIXct (” 2014-01-01″), len = length (data), by = “day”)) “this step can be omitted…

data.fit < – arima (data, order = c (7, 0), seasonal = list (order = c (1, 0), the period = 7))
Here’s a seasonal setup for ARIMA models, the setup rules are unclear.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
The final result is the same as the original blogger
Question: Do I need to do a unit root test?(Verified to be stationary time series)