0

What to run an arima function in the first difference (2,1,3), but i keep getting an error message. However, if i run it without the differencing (2,3) it works. What am I doing wrong.

Data= https://docs.google.com/spreadsheets/d/1cQvoI9kuF4wNEDBcJjDz5x60wgLSNjjBpECGJ0TnJYo/edit#gid=0

y=data[1:504] 
s=12
st=c(1976,1)
y=ts(y,frequency = s,start=st)

Create seasonal dummies for the time series.

 S2 = rep(c(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), T/s)
    S3 = rep(c(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0), T/s)
    S4 = rep(c(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), T/s)
    S5 = rep(c(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), T/s)
    S6 = rep(c(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0), T/s)
    S7 = rep(c(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0), T/s)
    S8 = rep(c(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), T/s)
    S9 = rep(c(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), T/s)
    S10 = rep(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), T/s)
    S11 = rep(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), T/s)
    S12 = rep(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), T/s)

TrSeas = model.matrix(~ t+S2+S3+S4+S5+S6+S7+S8+S9+S10+S11+S12)
TrSeas 

This model works

ar3.model = arima(y,order = c(2, 0, 3),include.mean = FALSE,xreg=TrSeas)

The one in first difference does not

arima213=Arima(y,order = c(2,1,3),xreg = TrSeas,include.mean = FALSE,include.drift = TRUE,method = "ML")

This gives me the following error message: Error in optim(init[mask], armaCSS, method = optim.method, hessian = TRUE, : non-finite value supplied by optim

1 Answers1

1

In arima function we specify (p,d,q) values here d stand for difference. d is used when our time series data is seasonal and d will remove the seasonality present in data. Here in your case data is not seasonal therefore no need to differentiate, it will work on d=0. If your data is seasonal then you can differentiate.

Zeeshan
  • 1,208
  • 1
  • 14
  • 26
  • thanks for your answer. However, my time series has a unit root that is why I choose to difference it. So, I am modeling a stochastic model with drift. Differencing it makes it stationary. Does your answer still apply then? – Philip Olsson Feb 01 '19 at 17:11
  • @ phillip Use auto.arima() , you no need to worry about (p,d,q) values. auto.arima() with take best value automatically. – Zeeshan Feb 08 '19 at 05:34