Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I am working on a time series whose values are strictly positive. Working with various models including AR, MA, ARMA, etc, I couldn't find an easy way to achieve strictly positive forecasts.

I'm using R for doing my forecasts, and all that I could find was forecast.hts {hts} that has a positive parameter described here:

Forecast a hierarchical or grouped time series, package hts

## S3 method for class 'gts':
forecast((object, h,
  method = c("comb", "bu", "mo", "tdgsf", "tdgsa", "tdfp", "all"),
  fmethod = c("ets", "rw", "arima"), level, positive = FALSE,
    xreg = NULL, newxreg = NULL, ...))

positive
    If TRUE, forecasts are forced to be strictly positive

http://www.inside-r.org/packages/cran/hts/docs/forecast.gts

Any suggestions for non-hierarchical time series? What about generalization on using other constraints like minimum, maximum, etc?

Even if not implemented in R, suggestions on articles, models or helpful general variable transformations would be appreciated.

share|improve this question
2  
One of the easiest, but not always correct thing to do in such case is simply forecast the log of the variable. –  mpiktas Dec 30 '13 at 8:51
3  
To partly echo @mpiktas one approach is to work on the log-scale. In practice this often improves several aspects of the model at once. While prediction intervals transform back just fine, you have to take care with mean forecasts (if normality is reasonable on the logs, you can get an estimate for the mean of the lognormal that is usually reasonable if sample sizes are large). An alternative that can sometimes work for some simple time series models is to use a Gamma model. –  Glen_b Dec 30 '13 at 9:42

1 Answer 1

up vote 6 down vote accepted

With the forecast package for R, simply set lambda=0 when fitting a model. For example:

fit <- auto.arima(x, lambda=0)
forecast(fit)

Many of the functions in the package allow the lambda argument. When the lambda argument is specified, a Box-Cox transformation is used. The value $\lambda=0$ specifies a log transformation. So setting lambda=0 means the logged data are modelled, and when forecasts are produced, they are back-transformed to the original space.

See http://www.otexts.org/fpp/2/4 for further discussion.

share|improve this answer
    
Thanks Prof. Hyndman for your kind help. I think I should reread that chapter seriously! Do you think mentioning this in chapter 2-4 can help? I think so! :-) Some questions remain for me: Can some kind of transformation be used for minimum (or maximum) possible values? I'm trying to do this with a log based function, but after all is the resulting confidence interval mathematically correct? –  Ho1 Dec 30 '13 at 12:33
1  
Please ask the min/max question separately. Yes, the prediction intervals are correct when back-transformed. –  Rob Hyndman Dec 30 '13 at 22:21
1  
@Ho1 Applied Time Series Analysis For Managerial Forecasting by NELSON ; Holden-Day 1973 pp162-165 discusses this in detail ... with a diverse opinion –  IrishStat Dec 31 '13 at 15:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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