I have a time series of sensor data from a machine. This machine is sometimes moved and thus there are big chunks of missing data, here is a plot of the data points:

enter image description here

My goal is to try to start building some basic forecasting models, I thought I would try Holt Winters, ARIMA, and Theta methods.

However I have noticed that the way these methods work (at least in R), is they expect a time series with constant time intervals instead of what I have:

> glimpse(test_df)
Observations: 19,086
Variables: 2
$ System_Time     <dttm> 2018-02-01 13:26:00, 2018-02-01 13:31:00,...
$ System_Variable <int> 1240, 1400, 1210, 1270, 1230, 1170, 1180,...

I am fairly new to this and unsure how to proceed, as I can't use any functions like ts() without fixing this. My time series also says it has frequency = 1 even though it spans over several months.

I have tried running auto.arima just to see what happens and it just spits out a flat static line:

enter image description here

Trying to use holt winters is even worse, it just goes straight up.

I am unsure of what to do, I am guessing I could do something like interpolate? But that seems dodgy at best.


Aside from what has been suggested, you might use an state-space model (see packages such as dlm, KFAS and others in R). State-space models are quite tolerant to NA values in the data.


A time series is evenly spaced. You should transform your data set into something evenly spaced. This may require going up to a higher level of aggregation (will that render the result irrelevant?) or imputing the missing values (and there are several different ways you could do so).

What do you expect the forecast to look like? Is there a cycle or seasonality in the data? A flat line is not necessarily a bad thing. If there's no slope, and no cycle, a flat line is what you will get.

If you can go up to a higher level of aggregation this will help to smooth out some of the volatility and may help uncover a cycle that is obscured at the lower level by all of the noise. Exploring this, and getting a grasp on the decomposition of the time series, are my suggestions of where you start.

  • $\begingroup$ There is definitely an upwards trend, using MannKendall test validates that I think. So I was hoping to get a forecast that at least tries to copy the up and down cycle that seems to emerge when I plot the data. Can you define what you mean by a higher level of aggregation? $\endgroup$ Aug 14 '18 at 15:52
  • $\begingroup$ what interval is the data measured when the machine doesn't move? Let's say it's every second. Sometimes, the machine gets moved and that takes 30 seconds. A higher level of aggregation would be to take the average measurement across every minute and then forecast the minute observations. When the machine is moved you'll have the average of 30 points instead of 60. If necessary, you can use aggregate-disaggregate approach, and estimate the second-by-second predictions of the minute forecasts. $\endgroup$ Aug 14 '18 at 16:11
  • $\begingroup$ nice words from Chris ! $\endgroup$
    – IrishStat
    Apr 28 '20 at 21:23

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.