Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pmdarima negative forecasts #537

Open
asgharmustafa opened this issue Jan 20, 2023 · 1 comment
Open

pmdarima negative forecasts #537

asgharmustafa opened this issue Jan 20, 2023 · 1 comment

Comments

@asgharmustafa
Copy link

asgharmustafa commented Jan 20, 2023

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?

@nvkost
Copy link

nvkost commented Mar 19, 2023

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants