# What's the difference between Arima and sarima functions in R?

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  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)

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

• Can you post the output of the two functions so as to see what the differences are? – Richard Hardy Mar 8 '17 at 7:39
• Oh. sorry. I added my code and the result. – Doyeong Park Mar 8 '17 at 8:43
• Could you post the estimated models? I mean summary(fit1) and summary(fit2). – Richard Hardy Mar 8 '17 at 8:49
• Here, I added it. – Doyeong Park Mar 8 '17 at 9:03
• OK, summary(fit1) does not tell anything interesting. Can you somehow get the coefficients and their standard errors like in summary(fit2) for fit1? – Richard Hardy Mar 8 '17 at 9:37

## 1 Answer

Q1: Why does this happen?

The model specifications are not exactly the same, as became clear once you included the model outputs.

Q2: What is the difference between them?

sarima includes a constant while Arima does not (because the default value of the argument include.drift is set to FALSE in Arima; but you can change that manually).

(A constant for a differenced series (as in your example) implies a linear trend for the original series. You may use subject-matter knowledge or test model performance out of sample to justify inclusion or exclusion of the constant term.)