How to avoid forecast below 0 values?

I got pretty good metrics with ARIMA model , but when I plot the forecast, my prediction go below 0 values,
I have tried to fit with log, but I got strange plot and worst metrics about 10x more bad.
Follow below my reprex code :

#### Bibliotecas
library(tsibble)
#> Warning: package 'tsibble' was built under R version 3.6.2
library(lubridate)
#> Warning: package 'lubridate' was built under R version 3.6.2
#> 
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:tsibble':
#> 
#>     interval
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union
library(dplyr)
#> Warning: package 'dplyr' was built under R version 3.6.2
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(imputeTS)
#> Warning: package 'imputeTS' was built under R version 3.6.2
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
library(feasts)
#> Warning: package 'feasts' was built under R version 3.6.2
#> Carregando pacotes exigidos: fabletools
#> Warning: package 'fabletools' was built under R version 3.6.2
library(fable)
#> Warning: package 'fable' was built under R version 3.6.2




iniciativa <- tibble(
    data_planejada = sample(seq(as.Date("2020-01-01"), length=35, by="week"), size=35),
    n = sample(seq(35), size=35)
) %>% as_tsibble()
#> Using `data_planejada` as index variable.


arima_fit1 <- iniciativa %>%  
    model(
        arima1 = ARIMA(n ~ 1 + pdq(1,0,3) + PDQ(0,0,0) + fourier(period = 17, K = 5)))


arima_fit2 <- iniciativa %>%  
    model(
        arima1 = ARIMA(log(n) ~ 1 + pdq(1,0,3) + PDQ(0,0,0) + fourier(period = 17, K = 5)))



arima_fc <- arima_fit1 %>%
    forecast(h = "20 weeks")


arima_fc2 <- arima_fit2 %>%
    forecast(h = "20 weeks")


arima_fc %>%  
    autoplot(iniciativa, level = c(70,95)) 

arima_fc2 %>%  
    autoplot(iniciativa, level = c(70,95)) 

Created on 2020-11-14 by the reprex package (v0.3.0)

The point estimates do not fall below zero; it's the confidence interval lower bound.

Exactly, there is a way to avoid that ?
Also I got the best Winkler score with this model

See these two suggestions by Rob Hyndman

Got worst metrics, when applied, also a strange plot.

See below:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.