Comments (9)
This occurs when you have a constant column in your data set. It is impossible to estimate covariances when one of the series is constant. Add some small random noise to the constant column and it should be ok.
from hts.
@brunocarlin Hello, I ran into the same problem, have you solved this problem yet? I rounded both the residuals and replaced any 0s with 0.1s or 1s, but still got this error.
from hts.
I think our problem was the series full of zeros or some other number, try adding random noise, I will be honest , in my final version I stuck with hts because Mint was too advanced for me
from hts.
Hello,
was anyone able to resolve this issue?
thanks.
from hts.
Ah, works fine now after adding random noise via rnorm()
Thank you for your assistance.
from hts.
I added noise to both the forecast and residuals and still get this error.
from hts.
I added noise to both the forecast and residuals and still get this error.
Same here.
When I'm using ets or arima forecasting algorithms it works well (after removing constant columns), but when I use hybridModel
I always get the error.
from hts.
Same error here, this time it occurs even if series is not constant, so any of the solution mentioned helps
Thank you for your assistance.
library(dplyr , quietly = TRUE)
library(tsibble, quietly = TRUE)
library(fable , quietly = TRUE)
tsibble::tourism %>%
filter(State == 'ACT') %>%
aggregate_key(State / Region, Trips = sum(Trips)) %>%
model(base = fable::SNAIVE(Trips)) %>%
reconcile(mint_cov = min_trace(base, method = "mint_cov")) %>%
forecast(h = 1)
#> Error in `mutate()`:
#> ! Problem while computing `mint_cov = (function (object, ...) ...`.
#> Caused by error:
#> ! min_trace needs covariance matrix to be positive definite.
Created on 2022-05-26 by the reprex package (v2.0.1)
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.1.3 (2022-03-10)
#> os Ubuntu 20.04.4 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language (EN)
#> collate C.UTF-8
#> ctype C.UTF-8
#> tz Etc/UTC
#> date 2022-05-26
#> pandoc 2.11.4 @ /usr/lib/rstudio-server/bin/pandoc/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> anytime 0.3.9 2020-08-27 [2] CRAN (R 4.0.4)
#> assertthat 0.2.1 2019-03-21 [2] CRAN (R 4.0.4)
#> cli 3.3.0 2022-04-25 [2] CRAN (R 4.1.3)
#> colorspace 2.0-3 2022-02-21 [2] CRAN (R 4.1.2)
#> crayon 1.5.0 2022-02-14 [2] CRAN (R 4.1.2)
#> DBI 1.1.2 2021-12-20 [2] CRAN (R 4.1.2)
#> digest 0.6.29 2021-12-01 [2] CRAN (R 4.1.2)
#> distributional 0.3.0 2022-01-05 [2] CRAN (R 4.1.2)
#> dplyr * 1.0.8 2022-02-08 [2] CRAN (R 4.1.2)
#> ellipsis 0.3.2 2021-04-29 [2] CRAN (R 4.1.1)
#> evaluate 0.15 2022-02-18 [2] CRAN (R 4.1.2)
#> fable * 0.3.1 2021-05-16 [2] CRAN (R 4.1.1)
#> fabletools * 0.3.2.9000 2022-03-16 [2] Github (tidyverts/fabletools@3003027)
#> fansi 1.0.2 2022-01-14 [2] CRAN (R 4.1.2)
#> farver 2.1.0 2021-02-28 [2] CRAN (R 4.0.4)
#> fastmap 1.1.0 2021-01-25 [2] CRAN (R 4.0.4)
#> fs 1.5.2 2021-12-08 [2] CRAN (R 4.1.2)
#> generics 0.1.2 2022-01-31 [2] CRAN (R 4.1.2)
#> ggplot2 3.3.5 2021-06-25 [2] CRAN (R 4.1.1)
#> glue 1.6.2 2022-02-24 [2] CRAN (R 4.1.2)
#> gtable 0.3.0 2019-03-25 [2] CRAN (R 4.0.4)
#> highr 0.9 2021-04-16 [2] CRAN (R 4.1.1)
#> htmltools 0.5.2 2021-08-25 [2] CRAN (R 4.1.1)
#> knitr 1.37 2021-12-16 [2] CRAN (R 4.1.2)
#> lattice 0.20-45 2021-09-22 [4] CRAN (R 4.1.1)
#> lifecycle 1.0.1 2021-09-24 [2] CRAN (R 4.1.2)
#> lubridate 1.8.0 2021-10-07 [2] CRAN (R 4.1.2)
#> magrittr 2.0.2 2022-01-26 [2] CRAN (R 4.1.2)
#> Matrix 1.4-1 2022-03-23 [4] CRAN (R 4.1.3)
#> munsell 0.5.0 2018-06-12 [2] CRAN (R 4.0.4)
#> pillar 1.7.0 2022-02-01 [2] CRAN (R 4.1.2)
#> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.0.4)
#> progressr 0.10.0 2021-12-19 [2] CRAN (R 4.1.2)
#> purrr 0.3.4 2020-04-17 [2] CRAN (R 4.0.4)
#> R6 2.5.1 2021-08-19 [2] CRAN (R 4.1.1)
#> Rcpp 1.0.8.2 2022-03-11 [2] CRAN (R 4.1.2)
#> reprex 2.0.1 2021-08-05 [2] CRAN (R 4.1.1)
#> rlang 1.0.2 2022-03-04 [2] CRAN (R 4.1.2)
#> rmarkdown 2.13 2022-03-10 [2] CRAN (R 4.1.2)
#> rstudioapi 0.13 2020-11-12 [2] CRAN (R 4.0.4)
#> scales 1.1.1 2020-05-11 [2] CRAN (R 4.0.4)
#> sessioninfo 1.2.2 2021-12-06 [2] CRAN (R 4.1.2)
#> stringi 1.7.6 2021-11-29 [2] CRAN (R 4.1.2)
#> stringr 1.4.0 2019-02-10 [2] CRAN (R 4.0.4)
#> tibble 3.1.6 2021-11-07 [2] CRAN (R 4.1.2)
#> tidyr 1.2.0 2022-02-01 [2] CRAN (R 4.1.2)
#> tidyselect 1.1.2 2022-02-21 [2] CRAN (R 4.1.2)
#> tsibble * 1.1.1 2021-12-03 [2] CRAN (R 4.1.2)
#> utf8 1.2.2 2021-07-24 [2] CRAN (R 4.1.1)
#> vctrs 0.3.8 2021-04-29 [2] CRAN (R 4.1.1)
#> withr 2.5.0 2022-03-03 [2] CRAN (R 4.1.2)
#> xfun 0.30 2022-03-02 [2] CRAN (R 4.1.2)
#> yaml 2.3.5 2022-02-21 [2] CRAN (R 4.1.2)
#>
#> [1] /home/edoardo/R/x86_64-pc-linux-gnu-library/4.1
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library
#>
#> ──────────────────────────────────────────────────────────────────────────────
from hts.
First, this has nothing to do with the hts package. You are using the forecast reconcilation procedures in the fabletools package.
Second, your example consists of a single time series (the ACT), so the reconciliation is degenerate.
Third, SNAIVE is already reconciled since the forecasts are equal to the last year of data, so the reconciliation is degenerate.
That said, we should improve fabletools to prevent the error. @mitchelloharawild
To see it working on a small non-degenerate example, try this:
library(dplyr , quietly = TRUE)
library(tsibble, quietly = TRUE)
library(fable , quietly = TRUE)
tsibble::tourism %>%
filter(State == 'ACT') %>%
aggregate_key(State / Region, Trips = sum(Trips)) %>%
model(base = fable::SNAIVE(Trips)) %>%
reconcile(mint_cov = min_trace(base, method = "mint_cov")) %>%
forecast(h = 1)
from hts.
Related Issues (20)
- Extension of createNotes() to work with levels specified by seperators HOT 6
- combinef return
- MinT: Error in if (!is.symmetric.matrix(x)) stop("argument x is not a symmetric matrix") : missing value where TRUE/FALSE needed HOT 1
- parallel doesnt work on custom functions HOT 2
- Implement Hyndman's fix for non conforming forecast
- Issue with gts
- Error in install.packages : cannot open the connection HOT 1
- Predictions are always flat? HOT 8
- Interop with tidyverts HOT 6
- Warning message if constant columns are passed to MinT
- Getting fitted and residual values when using comb nonnegative method
- How to work on a single level hierarchy?
- hts cannot create a hierarchical time series for a single observation HOT 1
- A typo in the code causes error when calling forecast.gts() with nonnegative=T parameter HOT 1
- Missing nodes (time-series) in hierarchy: combinef reconciliation function error HOT 2
- combinef function to constrain bottom level predictions with external predictions in gts
- Sample covariance calculation HOT 2
- Failed to install 'hts' due to RcppEigen.h
- forecast.gts argument conflicts with auto.arima via ... HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hts.