I create an ARIMA model for my ts-object. My data is available in seconds or even miliseconds. I didn't find a way to specify the time information for the start- and end-parameters when creating the ts object?

I need the exact time, because I want to extract the time information when I do the forecast based on the ARIMA model to return the exact times for my forecasted values. It would be enough to store the end-time information somewhere in my ARIMA model, so that I can use it later when I do the forecast.

How is this done usually with ARIMA models?



Did you see the help file for the ts function? At the bottom there are examples for quarterly and monthly time series. Perhaps you could directly extend this to second-wise series? You only need to specify the start date, not the end date.

For example, instead of using start = c(1954, 7), frequency = 12 for monthly data starting in July 1954 you could use start = c(d, s), frequency = 60*24 for second-wise data starting on day d, second s. The time attribute of your data would be given in days.

x=rnorm(10^4) # generate random data
print(time(x)) # extract the 'time' attribute of the 'ts' object

There might be a better solution, but perhaps this one is sufficient?

  • $\begingroup$ I thought about that, but then I actually have hourly based data and the frequency is 24. When I define the start time as a miliseconds or seconds based "timestamp", I have to change the frequency parameter as well to milliseconds or seconds, which would be wrong for my arima model, because obviously arima uses the frequency information from the ts object. $\endgroup$ – MikeHuber Sep 22 '15 at 11:28
  • $\begingroup$ Depending on what you will do with the model, the frequency may only be used for the seasonal part of a seasonal ARIMA model, so it should not do harm if a non-seasonal ARIMA model is considered. $\endgroup$ – Richard Hardy Sep 22 '15 at 12:10
  • $\begingroup$ For now I just added the end-timestamp and the interval as additional attributes to my model. When I use the same model for forecasting I can extract that information from the model to calculate the weekdays. I don't know if there is a better solution. $\endgroup$ – MikeHuber Sep 22 '15 at 12:19

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.