MyNixOS website logo
Description
Generating Time Series with Diverse and Controllable Characteristics
Generates synthetic time series based on various univariate time series models including MAR and ARIMA processes. Kang, Y., Hyndman, R.J., Li, F.(2020) <doi:10.1002/sam.11461>.

gratis

R buildstatus

The R package gratis (previously known as tsgeneration) provides efficient algorithms for generating time series with diverse and controllable characteristics.

Installation

CRAN version

install.packages("gratis")

Development version

You can install the development version of gratis package from GitHub Repository with:

devtools::install_github("ykang/gratis")

Usage

Tutorial video

Watch this YouTube video provided by Prof. Rob Hyndman.

Load the package

library(gratis)
library(feasts)

Generate diverse time series

set.seed(1)
mar_model(seasonal_periods=12) %>%
  generate(length=120, nseries=2) %>%
  autoplot(value)

Generate mutiple seasonal time series

mar_model(seasonal_periods=c(24, 24*7)) %>%
  generate(length=24*7*10, nseries=12) %>%
  autoplot(value)

Generate time series with controllable features

library(dplyr)
# Function to return spectral entropy, and ACF at lags 1 and 2
# given a numeric vector input
my_features <- function(y) {
  c(tsfeatures::entropy(y), acf = acf(y, plot = FALSE)$acf[2:3, 1, 1])
}
# Produce series with entropy = 0.5, ACF1 = 0.9 and ACF2 = 0.8
df <- generate_target(
  length = 60, feature_function = my_features, target = c(0.5, 0.9, 0.8)
)
df %>%
 as_tibble() %>%
 group_by(key) %>%
 summarise(value = my_features(value),
           feature=c("entropy","acf1", "acf2"),
           .groups = "drop")
#> # A tibble: 30 × 3
#>    key       value feature
#>    <chr>     <dbl> <chr>
#>  1 Series 1  0.533 entropy
#>  2 Series 1  0.850 acf1
#>  3 Series 1  0.735 acf2
#>  4 Series 10 0.478 entropy
#>  5 Series 10 0.880 acf1
#>  6 Series 10 0.764 acf2
#>  7 Series 2  0.507 entropy
#>  8 Series 2  0.890 acf1
#>  9 Series 2  0.899 acf2
#> 10 Series 3  0.454 entropy
#> # … with 20 more rows
autoplot(df)

Web application

You can also run the time series generation procedure in a shiny app

app_gratis()

Or visit our online Shiny APP

See also

References

License

This package is free and open source software, licensed under GPL-3.

Acknowledgements

Feng Li and Yanfei Kang are supported by the National Natural Science Foundation of China (No. 11501587 and No. 11701022 respectively). Rob J Hyndman is supported by the Australian Centre of Excellence in Mathematical and Statistical Frontiers.

Metadata

Version

1.0.7

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows