2
$\begingroup$

I'm dealing with a time series data and I'm trying to construct a time series model for this particular dataset. I'm new to R and tried using the the auto.arima function under the forecast package:

fit <- auto.arima(tsdata, xreg=cbind(CSS2$Month,CSS2$DayID,CSS2$Year), 
                  stepwise=FALSE, approximation=FALSE)
summary(fit)
resid(fit)
acf(resid(fit))

However, I noticed some problems in the ACF plot and the PACF plot from the resulting model. Both of those appear to show some trends or seasonality. The data that I'm dealing with do have some strong seasonal patterns (on a weekly basis and on a monthly basis), and I thought that this would be captured using auto.arima. I do have the most recent version of the forecast package. I should mention that I have daily data for 3 years, so there are a total of 1095 observations.

Any suggestions would be much appreciated, thank you!

ACF Plot PACF Plot

$\endgroup$
  • $\begingroup$ Welcome to the site, @user24788. Note that you can't post figures (plots) until your rep reaches 10. You can also post the images elsewhere on the internet & post a link here, and another user can load them for you. $\endgroup$ – gung Apr 24 '13 at 19:48
2
$\begingroup$

You can see in the arima code that there is a seasonal component that is set to (0,0,0), it is the seasonal AR, I, and MA component that you can change the values for. So if you're using an AR(1) that also has a seasonal AR(12) (annual seasonal AR), then the seasonal c=(0,0,0) vector should be (1,0,0) and the period should be changed from NA as well to say what the period of the season is.

arima(x, order = c(0, 0, 0),
      seasonal = list(order = c(0, 0, 0), period = NA),      
      xreg = NULL, include.mean = TRUE,
      transform.pars = TRUE,
      fixed = NULL, init = NULL,
      method = c("CSS-ML", "ML", "CSS"),
      n.cond, optim.method = "BFGS",
      optim.control = list(), kappa = 1e6)
$\endgroup$
  • $\begingroup$ Thank you very much for your answer! I've played around with this code, but how do I determine what the correct values are for order=c(?,?,?) and for seasonal=list(order=(?,?,?)? Also, what exactly should the period be? Since I'm dealing with daily data and there is weekly seasonality pattern, as in the data is higher during the week and lower on weekends, should the period=7? Thanks again!!! $\endgroup$ – user24788 Apr 24 '13 at 20:29
  • $\begingroup$ starting with the ACF and PACF will be a good starting point. Look for spikes at certain periods that suggest what the seasonality is. I think that the period is annual, so if you set it to 52 I think that will work for a weekly pattern, but I'm not sure about that. I'll try and look up some stuff online to confirm that. $\endgroup$ – Eric Peterson Apr 24 '13 at 21:11
  • $\begingroup$ Just wanted to say - THANK YOU once again! I ended up playing around with the orders and the period pattern. I've tried to base my decisions on the ACF and PACF and I've finally found a model that worked. Thank you very much for showing me the arima code above! $\endgroup$ – user24788 Apr 25 '13 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.