You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that hts cannot create a hierarchical time series if we have only one observation in the series.
It returns: Error in if (nbts <= 1L) { : argument is of length zero
You need to subset with drop = FALSE to retain the ts object, otherwise abc[1, ] is a numeric vector, not an mts.
library(hts)
#> Loading required package: forecast#> Registered S3 method overwritten by 'quantmod':#> method from#> as.zoo.data.frame zoonodes<-list(2, c(3, 2))
abc<- ts(5+matrix(sort(rnorm(500)), ncol=5, nrow=100))
hts(abc[1, , drop=FALSE], nodes)
#> Since argument characters are not specified, the default labelling system is used.#> Hierarchical Time Series #> 3 Levels #> Number of nodes at each level: 1 2 5 #> Total number of series: 8 #> Number of observations per series: 1 #> Top level series: #> Time Series:#> Start = 1 #> End = 1 #> Frequency = 1 #> [1] 22.10018
It seems that hts cannot create a hierarchical time series if we have only one observation in the series.
It returns: Error in if (nbts <= 1L) { : argument is of length zero
library(hts)
nodes <- list(2, c(3, 2))
abc <- ts(5 + matrix(sort(rnorm(500)), ncol = 5, nrow = 100))
y <- hts(abc[1,], nodes)
The text was updated successfully, but these errors were encountered: