Question Details

No question body available.

Tags

r forecasting fable-r

Answers (1)

Accepted Answer Available
Accepted Answer
April 20, 2026 Score: 3 Rep: 32,278 Quality: Expert Completeness: 80%

If you put the transformations inside the model() function, then fable will automatically undo the transformations for you. In this case, the model is equivalent to a regression on the log variables with an ARIMA(0,1,0) error. Your TSLM model included an insignificant intercept, which you probably don't want/need here, as it induces a small trend in the forecasts.

library(fpp3)
#> ── Attaching packages ──────────────────────────────────────────── fpp3 1.0.3 ──
#> ✔ tibble      3.3.1     ✔ tsibble     1.2.0
#> ✔ dplyr       1.2.1     ✔ tsibbledata 0.4.1
#> ✔ tidyr       1.3.2     ✔ ggtime      0.2.0
#> ✔ lubridate   1.9.5     ✔ feasts      0.5.0
#> ✔ ggplot2     4.0.2     ✔ fable       0.5.0
#> ── Conflicts ───────────────────────────────────────────────── fpp3conflicts ──
#> ✖ lubridate::date()    masks base::date()
#> ✖ dplyr::filter()      masks stats::filter()
#> ✖ tsibble::intersect() masks base::intersect()
#> ✖ tsibble::interval()  masks lubridate::interval()
#> ✖ dplyr::lag()         masks stats::lag()
#> ✖ tsibble::setdiff()   masks base::setdiff()
#> ✖ tsibble::union()     masks base::union()

googlestock filter(Symbol == "GOOG", year(Date) >= 2015) |> mutate(day = rownumber()) |> updatetsibble(index = day, regular = TRUE)

google2015 filter(year(Date) == 2015)

fit filter(Date < "2015-12-23") |> model(ARIMA(log(Open) ~ log(High) + pdq(0, 1, 0))) report(fit) #> Series: Open #> Model: LM w/ ARIMA(0,1,0) errors #> Transformation: log(Open) #> #> Coefficients: #> log(High) #> 0.9267 #> s.e. 0.0401 #> #> sigma^2 estimated as 0.0001211: log likelihood=757.67 #> AIC=-1511.35 AICc=-1511.3 BIC=-1504.34

forecast forecast(newdata = google2015 |> filter(Date >= "2015-12-23"))

autoplot(forecast) + autolayer( google2015 |> filter(Date > "2015-11-01"), Open ) + labs( x = "Date", y = "Google Stock Price", title = "Google Stock Price Forecast" )

Created on 2026-04-20 with reprex v2.1.1