Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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, ...))

    If TRUE, forecasts are forced to be strictly positive

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
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
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
up vote 7 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)

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 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
Please ask the min/max question separately. Yes, the prediction intervals are correct when back-transformed. – Rob Hyndman Dec 30 '13 at 22:21
@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


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.