Case On ARIMA
Case On ARIMA
Arima(p,d,q)
d=1. The number of times you do the differential to get minimum trend line or straight trendline.
From excel we see that we run the differential once. Therefore d=1.
-------------------------------------------------------------------------------------------------------------------------------------
View(data1)
acf(data1)
If in the ACF graph, Gradual decay is present , MA effect is not there. q=0
------------------------------------------------------------------------------------------------------------------------------
pacf(data1)
-------------------------------------------------------------------------------------------------------------------------------
arima(data1, order=c(1,1,0))
Coefficients:
ar1
-0.0337
s.e. 0.0237
-------------------------------------------------------------------------------------------------------------------------------------
Seasonal ARIMA
Eg. Say at period 20 you get some value say 1000. At period 21 you get an error. That means that
this seasonal effect is for 20 days.
In this case, the aic values are increasing. There is no change. Hence there it is not seasonal effect.
> arima(data1, seasonal = list(order=c(1,1,1),period=5))
Call:
arima(x = data1, seasonal = list(order = c(1, 1, 1), period = 5))
Coefficients:
sar1 sma1
0.8103 -0.7929
s.e. 0.1194 0.1228
Call:
arima(x = data1, seasonal = list(order = c(1, 1, 1), period = 7))
Coefficients:
sar1 sma1
-0.3527 0.3697
s.e. 1.6247 1.6063
Call:
arima(x = data1, seasonal = list(order = c(1, 1, 1), period = 12))
Coefficients:
sar1 sma1
0.5724 -0.5280
s.e. 0.1349 0.1389
Call:
arima(x = data1, seasonal = list(order = c(1, 1, 1), period = 25))
Coefficients:
sar1 sma1
-0.2714 0.4300
s.e. 0.1111 0.1036
Call:
arima(x = data1, seasonal = list(order = c(1, 1, 1), period = 30))
Coefficients:
sar1 sma1
-0.3110 0.4491
s.e. 0.0962 0.0894
sigma^2 estimated as 58.64: log likelihood = -6046.06, aic = 12098.12
If there is a seasonal effect, we will run the below code with the period at which you get the last
seasonal effect. In the above case we will add period=20.
predict(fit,n.ahead=5)
Time Series:
Start = 1781
End = 1785
Frequency = 1
[1] 54.42105 54.42203 54.42199 54.42200 54.42200