Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
141507
Helper I
Helper I

ARIMA forecasting - Avoid negative preditions

Hi,

 

I am using below R code to generate Arima Forecast. The plot is successful and I dont want to see negative values in the plot. I used the lambda=0 in the arima() and my plot date is greater than zero records only. Still I am seeing negative predicions.

 

 

.forecast_R_Arima.JPG

 

Is there anyway to prevent this. Below is my R code.

 

 

 

library(xts)
library("forecast")
dates=as.Date(dataset$ReceivedDate,"%Y-%m-%d")
xs=xts(dataset$Volume,dates,frequency=12)
plot(xs)

arima1 <-arima(xs,order=c(2,1,5),seasonal=list(order=c(0,1,1),period=12,lambda=0))
q=forecast(arima1,h=60,level=c(99.5))
plot(q,col ="darkcyan",xaxt = 'n',xlab='Year', ylab = 'Volume',main='Inventory Forecast (Arima)')
axis(side=1,at=c(0,50,100,150,200),labels=c("Aug 2016","Oct 2016","Dec 2016","Jan 2017","Mar 2017"))
 
file.remove("D:/fitarima.csv")
write.table(q,file="D:/fitarima.csv", append=TRUE,sep=",",col.names=TRUE,row.names=TRUE)

Regards,

Senthil D

3 REPLIES 3
v-ljerr-msft
Employee
Employee

Hi @141507,

 

Here is an article about positive forecasts and forecasts constrained to an interval. Could you go to check if it helps in your scenario? Smiley Happy

 

Regards

Hi,

 

Thanks for your input, But using this, prediction line shows as constant.

 

Do We have any other way to achieve the positive prediction since we have positive values as resource data ?

 

Regards,

Senthil D

Hi,

 

Is any update for the above.

 

Regards,

Senthil D

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.