I have two variables speed and vibration and you can see that speed causes vibration. I am trying to fit this using auto.arima. But when i plot the fitted model, it gives bad result

> head(datax.ts)
Time Series:
Start = 1 
End = 6 
Frequency = 1 
  vibration_x      Speed
1      -0.252   12.47183
2      -0.668 1204.89032
3      -0.508 1211.75330
4      -1.492 1208.71899
5      -0.536 1207.32922
6      -0.936 1206.91174

> fit4 <- auto.arima(datax.ts[,1], xreg = datax.ts[,2])
> plot(datax.ts[,1], type = "l", x = index(datax.zoo))
> lines(fit4$fitted, col = "red", x = index(datax.zoo))

Black is my original data of Vibration_x column and Red color is the fitted model using Auto.arima. Plot

Do i have to look for another model? or Am i doing something wrong here? I checked for autocorrelation.


I also would like to get suggested if there is any other model to work with. I tried VAR model which was again bad (Portmanteau Test for all lagged value was less then 0.05). Please help me.

Edited : (1) Replacing missing values with dummy values (2) I tried without missing values. But still the fit results in bad output.

Missing values replaced by dummy with No zero values

Thank you.

  • 1
    $\begingroup$ just a shot in the dark, but: Are those long intervals of 0 at the beginning and the end important? I was hopping that they might be missing measurements. If they are, you can remove them and (hopefully) obtain a better fit. - Or is it the the speed is 0 then and only then? $\endgroup$ – Daniel May 24 '17 at 7:59
  • $\begingroup$ Also, I would think that an ARCH or a GARCH model would suit this kind of predictions better than an ARIMA model due to the noisiness of the data. $\endgroup$ – Pierre Chevallier May 24 '17 at 8:12
  • $\begingroup$ @Daniel Yes. those are missing values. I even tried without missing values which gives the same kind of plot. $\endgroup$ – dhinar May 24 '17 at 9:11

You are running a regression model with an ARIMA on the residuals, rather than a pure ARIMA model. This means that the fit of the model will still be mostly dependent on the 'speed' variable.

From looking at the very small portion of the data shown, speed does not appear to be a good predictor of vibration. There is a much larger difference between observations 3 and 4, than there is from observations 1 and 2. Can you provide more details about the quality of the regression fit?

Second, based on the plot, it appears that vibration fluctuates between a high negative value and a high positive value. Again, I can only see 6 rows, but my guess is that you really want to be measuring the magnitude of the vibration, not the actual measurement. Transforming this the vibration to the absolute value may provide a better fit.


Just a couple of suggestions:

  1. Try to test for stationarity using adf.test (tseries package) from what I see from the acf the series seems to be not stationary and you cannot apply arma on non-stationary series. If the test is not refused, work on differences of your variables.

  2. Sometimes it happens even if you have stationarity , arma is not meaningful (it's the case of stock index very often). In this case you can't predict mean, but you can test for arch effect and fit the volatility using a garch

  • 1
    $\begingroup$ Thanks federico. 1) Adf.test shows the series are stationary (data: datax.ts[, 1] Dickey-Fuller = -12.411, Lag order = 23, p-value = 0.01 and data: datax.ts[, 2] Dickey-Fuller = -9.0226, Lag order = 23, p-value = 0.01 . But there is autocorrelation from ACF. But the value in auto.arima gives d=1. I believe that will do the differencing and i dont need to do it separately. $\endgroup$ – dhinar May 24 '17 at 9:17

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.