I am trying doing time series analysis. My main purpose is predict data using seasonal ARIMA model in R. I found 2 functions which I can apply my data to ARIMA model in R. One is Arima
in library(forecast), the other is sarima
in library(astsa). Both of them are using ARIMA method, but the predict values are not equal.
Q1: Why does this happens?
Q2: What is the difference between them?
To help your understanding, here is my code and the result.
------------------ code ---------------------------
data<-read.csv("C:internet.csv",header=T,sep=",")
call<-data[,2]
library(astsa)
fit1<-sarima(call,1,0,0,0,1,1,7)
library(forecast)
fit2<-Arima(call,c(1,0,0),seasonal=list(order=c(0,1,1),period=7))
pre1<-sarima.for(call,28,1,0,0,0,1,1,7)
pre2<-predict(fit2,n.ahead=28)
----------------- result --------------------------------
pre1
-128 -211 -225 -120 -83 -219 -98 -277 -60 -129 -82 -102 -105
-57 -38 -12 -53 -88 -60 -57 30 -64 44 61 -8 -83 50 114
pre2
-92 -159 -173 -48 -3 -146 -15 -192 22 -57 7 -10 -22 36 56 80
29 9 42 36 133 40 146 152 99 28 152 226
----------------- fit summary --------------------------------
# fit1:
Coefficients:
ar1 sma1 constant
0.5513 -0.8881 -1.3508
s.e. 0.0351 0.0203 0.3853
sigma^2 estimated as 53729: log likelihood = -3946, aic = 7899.99
$degrees_of_freedom
[1] 578
$ttable
Estimate SE t.value p.value
ar1 0.5513 0.0351 15.6962 0e+00
sma1 -0.8881 0.0203 -43.7872 0e+00
constant -1.3508 0.3853 -3.5055 5e-04
> summary(fit2)
Series: call1
ARIMA(1,0,0)(0,1,1)[7]
Coefficients:
ar1 sma1
0.5720 -0.8664
s.e. 0.0353 0.0209
sigma^2 estimated as 54997: log likelihood=-3951.12
AIC=7908.25 AICc=7908.29 BIC=7921.31
Training set error measures:
ME RMSE MAE MPE MAPE MASE
Training set -33.29538 232.6907 142.5681 -9.647886 20.18476 0.3910501
ACF1
Training set -0.04397984
summary(fit1)
andsummary(fit2)
. $\endgroup$ – Richard Hardy Mar 8 '17 at 8:49summary(fit1)
does not tell anything interesting. Can you somehow get the coefficients and their standard errors like insummary(fit2)
for fit1? $\endgroup$ – Richard Hardy Mar 8 '17 at 9:37