Open asgharmustafa opened 1 year ago
Hi. This can be done by transforming variable before fitting the model.
Perhaps you want to predict a non-negative variable like the price or quantity. Let the variable be y
. Then you need to define new variable lny = ln(y)
, fit the model on lny
, make a prediction lny_pred
and apply inverse transformation exp(lny_pred)
. Or you can use sqrt
instead of ln
and x ** 2
instead of exp
.
But be careful because such transformations tend to bias the estimates of expectation and confidence intervals. If you need to get unbiased estimates, then you need to either calculate a correction for the resulting forecast or conduct a Monte Carlo.
References:
Hi Team, Is it possible for .predict function to generate strictly positive predictions and confidence intervals? If so can you please guide on the change the pmd auto arima and/or predict for this to happen?