Closed robjhyndman closed 1 month ago
This appears to be a general problem whenever h=1
.
library(fable)
#> Loading required package: fabletools
tsibble::tsibble(
time = 1:20,
value = rnorm(20),
index = time
) |>
model(NAIVE(value)) |>
forecast(h = 1) |>
autoplot()
#> Warning in min(x, na.rm = na.rm): no non-missing arguments to min; returning
#> Inf
#> Warning in max(x, na.rm = na.rm): no non-missing arguments to max; returning
#> -Inf
#> Warning in min(x, na.rm = na.rm): no non-missing arguments to min; returning
#> Inf
#> Warning in max(x, na.rm = na.rm): no non-missing arguments to max; returning
#> -Inf
#> Warning in min(x, na.rm = na.rm): no non-missing arguments to min; returning
#> Inf
#> Warning in max(x, na.rm = na.rm): no non-missing arguments to max; returning
#> -Inf
Created on 2024-05-13 with reprex v2.1.0
More minimal reprex without forecasting / autoplot. Keeping it here for now since it could be user error of ggdist on my part.
library(ggplot2)
library(ggdist)
library(distributional)
tibble::tibble(time = 0, value = dist_normal()) |>
ggdist::median_qi(value, .width = c(0.8, 0.95)) |>
ggplot(aes(x = time, ymin = .lower, ymax = .upper, colour_ramp = .width, fill_ramp = .width)) +
ggdist::stat_interval()
#> Warning in bandwidth_dpi(): Bandwidth calculation failed.
#> > Falling back to `bandwidth_nrd0()`.
#> i This often occurs when a sample contains many duplicates, which suggests that
#> a dotplot (e.g., `geom_dots()`) or histogram (e.g., `density_histogram()`,
#> `stat_slab(density = 'histogram')`, or `stat_histinterval()`) may better
#> represent the data.
#> Caused by error in `bw.SJ()`:
#> ! sample is too sparse to find TD
#> Warning in bandwidth_dpi(): Bandwidth calculation failed.
#> > Falling back to `bandwidth_nrd0()`.
#> i This often occurs when a sample contains many duplicates, which suggests that
#> a dotplot (e.g., `geom_dots()`) or histogram (e.g., `density_histogram()`,
#> `stat_slab(density = 'histogram')`, or `stat_histinterval()`) may better
#> represent the data.
#> Caused by error in `bw.SJ()`:
#> ! sample is too sparse to find TD
Created on 2024-05-13 with reprex v2.0.2
Thanks, fixed.
Created on 2024-04-12 with reprex v2.1.0
Session info
``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.3.3 (2024-02-29) #> os KDE neon 6.0 #> system x86_64, linux-gnu #> ui X11 #> language en_GB #> collate en_AU.UTF-8 #> ctype en_AU.UTF-8 #> tz Australia/Melbourne #> date 2024-04-12 #> pandoc 3.1.11.1 @ /usr/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> anytime 0.3.9 2020-08-27 [1] RSPM #> cli 3.6.2 2023-12-11 [1] RSPM #> colorspace 2.1-0 2023-01-23 [1] RSPM #> curl 5.2.1 2024-03-01 [1] RSPM #> digest 0.6.35 2024-03-11 [1] RSPM #> distributional 0.4.0 2024-02-07 [1] RSPM (R 4.3.0) #> dplyr * 1.1.4 2023-11-17 [1] RSPM #> ellipsis 0.3.2 2021-04-29 [1] RSPM #> evaluate 0.23 2023-11-01 [1] RSPM #> fable * 0.3.4 2024-03-15 [1] RSPM (R 4.3.0) #> fabletools * 0.4.1 2024-03-02 [1] RSPM (R 4.3.0) #> fansi 1.0.6 2023-12-08 [1] RSPM #> farver 2.1.1 2022-07-06 [1] RSPM #> fastmap 1.1.1 2023-02-24 [1] RSPM #> fs 1.6.3 2023-07-20 [1] RSPM #> generics 0.1.3 2022-07-05 [1] RSPM #> ggdist 3.3.2 2024-03-05 [1] RSPM #> ggplot2 3.5.0 2024-02-23 [1] RSPM #> glue 1.7.0 2024-01-09 [1] RSPM #> gtable 0.3.4 2023-08-21 [1] RSPM #> highr 0.10 2022-12-22 [1] RSPM #> htmltools 0.5.8.1 2024-04-04 [1] RSPM (R 4.3.3) #> knitr 1.46 2024-04-06 [1] RSPM (R 4.3.3) #> labeling 0.4.3 2023-08-29 [1] RSPM #> lifecycle 1.0.4 2023-11-07 [1] RSPM #> lubridate * 1.9.3 2023-09-27 [1] RSPM #> magrittr 2.0.3 2022-03-30 [1] RSPM #> munsell 0.5.1 2024-04-01 [1] RSPM #> pillar 1.9.0 2023-03-22 [1] RSPM #> pkgconfig 2.0.3 2019-09-22 [1] RSPM #> progressr 0.14.0 2023-08-10 [1] RSPM #> purrr 1.0.2 2023-08-10 [1] RSPM #> R.cache 0.16.0 2022-07-21 [1] RSPM (R 4.3.3) #> R.methodsS3 1.8.2 2022-06-13 [1] RSPM (R 4.3.3) #> R.oo 1.26.0 2024-01-24 [1] RSPM (R 4.3.3) #> R.utils 2.12.3 2023-11-18 [1] RSPM (R 4.3.3) #> R6 2.5.1 2021-08-19 [1] RSPM #> rappdirs 0.3.3 2021-01-31 [1] RSPM #> Rcpp 1.0.12 2024-01-09 [1] RSPM #> reprex 2.1.0 2024-01-11 [2] RSPM (R 4.3.0) #> rlang 1.1.3 2024-01-10 [1] RSPM #> rmarkdown 2.26 2024-03-05 [1] RSPM #> rstudioapi 0.16.0 2024-03-24 [2] RSPM (R 4.3.0) #> scales 1.3.0 2023-11-28 [1] RSPM #> sessioninfo 1.2.2 2021-12-06 [2] RSPM (R 4.2.0) #> styler 1.10.3 2024-04-07 [1] RSPM (R 4.3.3) #> tibble 3.2.1 2023-03-20 [1] RSPM #> tidyr 1.3.1 2024-01-24 [1] RSPM #> tidyselect 1.2.1 2024-03-11 [1] RSPM #> timechange 0.3.0 2024-01-18 [1] RSPM #> tsibble * 1.1.4 2024-01-29 [1] RSPM (R 4.3.0) #> tsibbledata 0.4.1 2022-09-01 [1] RSPM (R 4.3.0) #> utf8 1.2.4 2023-10-22 [1] RSPM #> vctrs 0.6.5 2023-12-01 [1] RSPM #> withr 3.0.0 2024-01-16 [1] RSPM #> xfun 0.43 2024-03-25 [1] RSPM (R 4.3.3) #> xml2 1.3.6 2023-12-04 [2] RSPM (R 4.3.0) #> yaml 2.3.8 2023-12-11 [1] RSPM #> #> [1] /usr/local/lib/R/site-library #> [2] /usr/lib/R/site-library #> [3] /usr/lib/R/library #> #> ────────────────────────────────────────────────────────────────────────────── ```