I am trying to do time series analysis and am new to this field. I have daily count of an event from 2006-2009 and I want to fit a time series model to it. Here is the progress that I have made:
timeSeriesObj = ts(x,start=c(2006,1,1),frequency=365.25) plot.ts(timeSeriesObj)
The resulting plot I get is:
In order to verify whether there is seasonality and trend in the data or not, I follow the steps mentioned in this post :
ets(x) fit <- tbats(x) seasonal <- !is.null(fit$seasonal) seasonal
and in Rob J Hyndman's blog:
library(fma) fit1 <- ets(x) fit2 <- ets(x,model="ANN") deviance <- 2*c(logLik(fit1) - logLik(fit2)) df <- attributes(logLik(fit1))$df - attributes(logLik(fit2))$df #P value 1-pchisq(deviance,df)
Both cases indicate that there is no seasonality.
When I plot the ACF & PACF of the series, here is what I get:
My questions are:
Is this the way to handle daily time series data? This page suggests that I should be looking at both weekly and annual patterns but the approach is not clear to me.
I do not know how to proceed once I have the ACF and PACF plots.
Can I simply use the auto.arima function?
fit <- arima(myts, order=c(p, d, q)
*****Updated Auto.Arima results******
When i change the frequency of the data to 7 according to Rob Hyndman's comments here, auto.arima selects a seasonal ARIMA model and outputs:
Series: timeSeriesObj ARIMA(1,1,2)(1,0,1) Coefficients: ar1 ma1 ma2 sar1 sma1 0.89 -1.7877 0.7892 0.9870 -0.9278 s.e. NaN NaN NaN 0.0061 0.0162 sigma^2 estimated as 21.72: log likelihood=-4319.23 AIC=8650.46 AICc=8650.52 BIC=8682.18
******Updated Seasonality Check******
When I test seasonality with frequency 7, it outputs True but with seasonality 365.25, it outputs false. Is this enough to conclude a lack of yearly seasonality?
timeSeriesObj = ts(x,start=c(2006,1,1),frequency=7) fit <- tbats(timeSeriesObj) seasonal <- !is.null(fit$seasonal) seasonal
timeSeriesObj = ts(x,start=c(2006,1,1),frequency=365.25) fit <- tbats(timeSeriesObj) seasonal <- !is.null(fit$seasonal) seasonal
Rsimple doesn't have the capability to handle it. I would look for commercial solutions if there is high inventory/manufacturing cost involved for the product that you are trying to forecast.
Rhas severe limitations for forecasting task like yours. Look at questions on daily forecasting else where in this site. $\endgroup$