1
$\begingroup$

I am trying to forecast a time series using auto. arima. My command is,

auto.arima(X, stationary = F, ic = "aic", stepwise = T, trace = T, test = "adf", allowdrift = F, allowmean = T, lambda = BoxCox.lambda(prd.xts, method = "loglik"), biasadj = T);

My original time series has 36 observations (monthly for 3 years). When plotting the fitted vs original values, I found the fitted value to be a negative one. Please find below the original and fitted:

X:

 [1]  5200  4420  5297  6815  8385  8000  5700  6610  5810  5680  4100  4750  2205  4748  5170  8050  8900  7050  6810
[20]  7030  5890  7160  6405  5370  5360  7649  7730  9090 10174  7775

Fitted:

 [1]  4932.4310  4935.5587  4003.1725  5045.8954  6690.9964  8315.6047  7920.8435  5495.5020  6474.9251  5616.1591
[11]  5473.4794  3585.5492  4409.2808  -716.4241  4406.8788  4901.2397  7972.2124  8841.2718  6937.2260  6685.7413
[21]  6916.3253  5703.4412  7052.0103  6257.4684  5128.3367  5117.0722  7559.2477  7642.8563  9034.6446 10133.6204

Looking at these two closely, we can observe, 14th element in original series is: 4748 & in fitted (ARIMA modelled) is -716.4241.

I am a novice in Time series forecasting. The best model auto.arima spits out is arima(0,1,0) with an AIC of 964.095.

My questions: 1) Is the model correct? Is it alright, if the fitted value is negative? 2) Would it be reasonable to have just 36 observations to do a monthly forecasting?

Any help would be much appreciated.

$\endgroup$
1
  • $\begingroup$ What is the value of the Box-Cox transformation parameter (the one you pass in as lambda in the call to auto.arima)? $\endgroup$
    – Chris Haug
    Commented Nov 5, 2017 at 0:10

1 Answer 1

1
$\begingroup$

ARIMA assumes normally distributed innovations, and it can definitely go below zero. (If you take differences, you will often end up with negative values.)

In your specific case, I suspect that your X is not identified as monthly data, i.e., that it has a frequency of 12. Once we do that and create a seasonplot, seasonality is rather evident:

library(forecast)
foo <- c(5200, 4420, 5297, 6815, 8385, 8000, 5700, 6610, 5810, 5680, 
4100, 4750, 2205, 4748, 5170, 8050, 8900, 7050, 6810, 7030, 5890, 
7160, 6405, 5370, 5360, 7649, 7730, 9090, 10174, 7775)

X <- ts(foo,frequency=12)
seasonplot(X)

seasonplot

Now auto.arima() fits a seasonal model, and neither fits nor forecasts are negative:

model <- auto.arima(X)
plot(forecast(model,h=12))
lines(fitted(model),col="red")

forecast

$\endgroup$
1
  • $\begingroup$ It's quite possible that the frequency attribute wasn't set correctly, but it's also not clear what data was used (36 points are mentioned but only 30 are shown), and most importantly their model involves a Box-Cox transform which is based on some other series (prd.xts, not X), and for which they haven't provided the value of the parameter. Obviously it's not one that restricts values to be positive, but maybe it should be if that's required for subject-matter reasons. $\endgroup$
    – Chris Haug
    Commented Nov 8, 2017 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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