ykang / gratis

GRATIS: GeneRAting TIme Series with diverse and controllable characteristics
https://github.com/ykang/gratis
GNU General Public License v3.0
76 stars 29 forks source link

gaps in index #34

Closed emitanaka closed 1 year ago

emitanaka commented 2 years ago

I'm not sure why but the following code some how creates a gap at year 0004 July 2nd:

library(tsibble)
library(gratis)

set.seed(2022)
sim1 <- arima_model(frequency = 7,
                    p = 1, # non-seasonal AR order
                    d = 0, # non-seasonal order of differencing
                    q = 0, # non-seasonal MA order
                    P = 1, # seasonal AR order
                    D = 0, # seasonal order of differencing
                    Q = 1, # seasonal MA order
                    constant = 0, # intercept
                    phi = c(0.8), # AR parameters
                    theta = c(), # MA parameters
                    Phi = c(-0.4), # seasonal AR parameters
                    Theta = c(0.8), # seasonal MA parameters
                    sigma = 0.5 # sd of noise
) %>% 
  generate(length = 2000, nseries = 1)

scan_gaps(sim1)
#> # A tsibble: 1 x 1 [1D]
#>   index     
#>   <date>    
#> 1 0004-07-02

Created on 2022-04-21 by the reprex package (v2.0.1)

robjhyndman commented 2 years ago

This is actually a problem in tsibble::as_tsibble() due to the conversion of a numerical time index to an explicit date. Probably something for @earowang.