Back Transform log response variable [fable package]

Hi, guys

I had log transformed my response variable in my training fitted object, and got some good results with my metrics, however I would like to see my forecasts in my original data, how I could do that, actually I'm new with forecasts, and I do not know if my approach it is correct method, any advices in solving this issue?

I did a log transformation in my tbl data:

log transformation in my response variable

iniciativa_tsbl <- iniciativa_tsbl %>%
mutate(log_n = log1p(n)) %>%
select(-n)

After that I pass my object as a tsibble to a train data and fitted

train <- iniciativa_tsbl %>%
filter_index("2020-01-26" ~ "2020-08-30")

Fit my trainig data in a model

naive_fit <- train %>%
model(
naive = NAIVE(log_n)
)

Produce forecasts, how to have my forecasts in original scale?

naive_fit <- train %>%
model(
naive = NAIVE(log_n)
)

I would appreciate some help here,

Regards

Put the transformation inside the model() function:

naive_fit <- train %>%
  model(naive = NAIVE(log1p(n)))

Then the back-transformation will be taken care of automatically.

You're fitting a random walk model on logged data, so the prediction intervals will expand rapidly. It looks as expected to me given the model you've chosen.

This topic was automatically closed 7 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.

When I plot the forecast the data seems a little strange.....

Fit training data to forecast

naive_fc <- naive_fit %>%
forecast(h = "20 weeks")

Plotting data

naive_fc %>%
autoplot(train, level = c(50,80)) +
ggtitle("Naive Forecast") +
xlab("Data Entregue") +
ylab("Demanda") +
theme_tq()