Package: fabletools Check: examples New result: ERROR Running examples in ‘fabletools-Ex.R’ failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: forecast.mdl_df > ### Title: Produce forecasts > ### Aliases: forecast.mdl_df forecast.mdl_ts > > ### ** Examples > > ## Don't show: > if (requireNamespace("fable", quietly = TRUE) && requireNamespace("tsibbledata", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)({ # examplesIf + ## End(Don't show) + library(fable) + library(tsibble) + library(tsibbledata) + library(dplyr) + library(tidyr) + + # Forecasting with an ETS(M,Ad,A) model to Australian beer production + beer_fc <- aus_production %>% + model(ets = ETS(log(Beer) ~ error("M") + trend("Ad") + season("A"))) %>% + forecast(h = "3 years") + + # Compute 80% and 95% forecast intervals + beer_fc %>% + hilo(level = c(80, 95)) + + beer_fc %>% + autoplot(aus_production) + + # Forecasting with a seasonal naive and linear model to the monthly + # "Food retailing" turnover for each Australian state/territory. + library(dplyr) + aus_retail %>% + filter(Industry == "Food retailing") %>% + model( + snaive = SNAIVE(Turnover), + ets = TSLM(log(Turnover) ~ trend() + season()), + ) %>% + forecast(h = "2 years 6 months") %>% + autoplot(filter(aus_retail, Month >= yearmonth("2000 Jan")), level = 90) + + # Forecast GDP with a dynamic regression model on log(GDP) using population and + # an automatically chosen ARIMA error structure. Assume that population is fixed + # in the future. + aus_economy <- global_economy %>% + filter(Country == "Australia") + fit <- aus_economy %>% + model(lm = ARIMA(log(GDP) ~ Population)) + + future_aus <- new_data(aus_economy, n = 10) %>% + mutate(Population = last(aus_economy$Population)) + + fit %>% + forecast(new_data = future_aus) %>% + autoplot(aus_economy) + ## Don't show: + }) # examplesIf > library(fable) > library(tsibble) Attaching package: ‘tsibble’ The following objects are masked from ‘package:base’: intersect, setdiff, union > library(tsibbledata) > library(dplyr) 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(tidyr) > beer_fc <- aus_production %>% model(ets = ETS(log(Beer) ~ error("M") + + trend("Ad") + season("A"))) %>% forecast(h = "3 years") > beer_fc %>% hilo(level = c(80, 95)) # A tsibble: 12 x 6 [1Q] # Key: .model [1] .model Quarter Beer .mean `80%` 1 ets 2010 Q3 t(N(6, 0.0013)) 407. [388.3086, 425.8337]80 2 ets 2010 Q4 t(N(6.2, 0.0014)) 483. [459.8714, 506.5468]80 3 ets 2011 Q1 t(N(6, 0.0014)) 419. [398.6325, 439.3894]80 4 ets 2011 Q2 t(N(6, 0.0015)) 384. [365.3574, 403.7254]80 5 ets 2011 Q3 t(N(6, 0.0019)) 405. [382.4128, 427.7091]80 6 ets 2011 Q4 t(N(6.2, 0.0022)) 481. [452.3059, 509.7606]80 7 ets 2012 Q1 t(N(6, 0.0023)) 417. [391.5386, 443.0498]80 8 ets 2012 Q2 t(N(5.9, 0.0025)) 383. [358.4021, 407.8355]80 9 ets 2012 Q3 t(N(6, 0.0032)) 403. [374.7091, 432.7834]80 10 ets 2012 Q4 t(N(6.2, 0.0036)) 479. [442.8408, 516.4800]80 11 ets 2013 Q1 t(N(6, 0.0039)) 416. [383.0362, 449.4648]80 12 ets 2013 Q2 t(N(5.9, 0.0043)) 382. [350.3968, 414.1880]80 # ℹ 1 more variable: `95%` > beer_fc %>% autoplot(aus_production) > library(dplyr) > aus_retail %>% filter(Industry == "Food retailing") %>% model(snaive = SNAIVE(Turnover), + ets = TSLM(log(Turnover) ~ trend() + season()), ) %>% forecast(h = "2 years 6 months") %>% + autoplot(filter(aus_retail, Month >= yearmonth("2000 Jan")), level = 90) > aus_economy <- global_economy %>% filter(Country == "Australia") > fit <- aus_economy %>% model(lm = ARIMA(log(GDP) ~ Population)) Warning: 1 error encountered for lm [1] The `urca` package must be installed to use this functionality. It can be installed with install.packages("urca") > future_aus <- new_data(aus_economy, n = 10) %>% mutate(Population = last(aus_economy$Population)) > fit %>% forecast(new_data = future_aus) %>% autoplot(aus_economy) Error in if (!is.null(x[["dist"]]) && !monotonic_increasing(x[["transform"]], : missing value where TRUE/FALSE needed Calls: ... median.dist_default -> quantile -> quantile.dist_transformed Execution halted