Git Product home page Git Product logo

Comments (3)

earowang avatar earowang commented on August 25, 2024

Thank you for reporting this bug. I've fixed it.

from hts.

rtjohn avatar rtjohn commented on August 25, 2024

I think maybe the bug is back with the newest version of hts or forecast

> require(hts)
> class(ee)
[1] "data.frame"
> head(ee, 5)
  ECEcom RTretl   EUAgri   EUAuto   EUAvia    EUDist    EUEduc EUFitn    EUGove    EUManu    EUMili   EUPubl   EUResi NCAgri NCAuto NCAvia   NCDist
5      0      0 376602.0 343719.0 110137.2 1400167.2  74788.00 161767  45436.82 1458042.2  28999.16 242639.0 214318.2 107258 153155  95460 462564.2
4      0      0 416355.8 187551.0 176520.0 1982673.6 134739.00 195321  21490.00 1907187.1  97129.38 280526.0 212713.0 278275 137540  55605 264918.0
3      0      0 384240.0 259004.5 403193.4 1932341.9 231824.00 216287 123193.67 1490592.5  95892.96 184150.0 265479.0 295683  65465  95500 266299.0
1      0      0 436579.0 110365.0 112431.0 1466298.5 126272.00 250425  73693.24 1435408.9 486414.03 299706.0 198195.8 120620  85323  64606 324107.8
8      0      0 270890.5 152948.2  79571.0  834251.8  56937.23 178815  52003.83  765574.3 521389.99 213339.8 211166.5 111860  34670  60405 477172.2
    NCEduc   NCFitn   NCGove   NCManu   NCMili   NCPubl NCResi INAgri INAuto INAvia INDist INEduc INFitn INGove INManu   INMili INPubl INResi
5 196735.0  47300.0  71180.0 331203.8  15235.0 195680.0  48797  36926   5360   4720  40530  10580  32050      0  39645     0.00  26577   9660
4 189100.0  70281.0 175365.0 182008.2  94100.0 229205.0  57967  52640   5518      0  10650  19329  27245      0 268801     0.00 131558  36040
3 487921.7  53615.0 290255.0 255589.0   9158.0 317436.0  55279      0      0   4480      0  44838      0      0 191040 19950.00  59463  22570
1 101297.3 208409.8 146895.0 387086.0  11425.0 124570.0  64990  59567  16800      0 184780  40559  37760  35180 227526 44484.90 108110  25706
8 249125.0 121868.1 101749.4 170168.5 115205.2 187486.2  25496      0   2400   6401  63085      0  13500  65260  26297 40984.12 112459  33060
> ee <- ts(ee, start=c(2011,5), frequency=12, names=nvec)
> class(ee)
[1] "mts"    "ts"     "matrix"
> frequency(ee)
[1] 12
> ff <- hts(ee, nodes=list(5,c(0,0,11,11,11)), bnames=colnames(ee), characters=c(2,4))
> class(ff)
[1] "gts" "hts"
> frequency(ff)
[1] 1
> frequency(ff$bts)
[1] 12
> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] hts_4.5           Matrix_1.2-1      SparseM_1.6       plyr_1.8.3        psych_1.5.6       lubridate_1.3.3   xts_0.9-7         forecast_6.1     
 [9] timeDate_3012.100 car_2.0-25        ggplot2_1.0.1     reshape_0.8.5     zoo_1.7-12        devtools_1.8.0   

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.0      nloptr_1.0.4     git2r_0.10.1     tseries_0.10-34  tools_3.2.1      digest_0.6.8     lme4_1.1-8       memoise_0.2.1   
 [9] gtable_0.1.2     nlme_3.1-120     lattice_0.20-31  mgcv_1.8-6       curl_0.9.1       parallel_3.2.1   proto_0.3-10     stringr_1.0.0   
[17] xml2_0.1.1       rversions_1.0.2  grid_3.2.1       nnet_7.3-9       minqa_1.2.4      reshape2_1.4.1   magrittr_1.5     scales_0.2.5    
[25] MASS_7.3-40      splines_3.2.1    mnormt_1.5-3     pbkrtest_0.4-2   colorspace_1.2-6 fracdiff_1.4-2   quantreg_5.11    quadprog_1.5-5  
[33] stringi_0.5-5    munsell_0.4.2   
> 

from hts.

earowang avatar earowang commented on August 25, 2024

ff returned by hts() is an hts object containing not only multivariate time series (mts) but also its node structure. So frequency() isn't a right choice for an hts object to detect its frequency, and frequency(ff$bts) gives the correct one.

from hts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.