knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

TSrepr

Travis-CI Build Status CRAN_Status_Badge Downloads Downloads codecov.io DOI

TSrepr is R package for fast time series representations and dimensionality reduction computations. Z-score normalisation, min-max normalisation, forecasting accuracy measures and other useful functions implemented in C++ (Rcpp) and R.

Installation

You can install TSrepr directly from CRAN:

install.packages("TSrepr")

Or development version from GitHub with:

# install.packages("devtools")
devtools::install_github("PetoLau/TSrepr")

Overview

All type of time series representations methods are implemented, and these are so far:

Additional useful functions are implemented as:

Usage

library(TSrepr)
library(ggplot2)

data_ts <- as.numeric(elec_load[5,]) # electricity load consumption data
# Comparison of PAA and PLA
# Dimensionality of the time series will be reduced 8 times
data_paa <- repr_paa(data_ts, q = 12, func = mean)
data_pla <- repr_pla(data_ts, times = 55, return = "both") # returns both extracted places and values

data_plot <- data.frame(value = c(data_ts, data_paa, data_pla$points),
                        time = c(1:length(data_ts), seq(6, length(data_ts), by = 12),
                                 data_pla$places),
                        type = factor(c(rep("Original", length(data_ts)),
                                        rep(c("PAA", "PLA"), each = 56))))

ggplot(data_plot, aes(time, value, color = type, size = type)) +
  geom_line(alpha = 0.8) +
  scale_size_manual(values = c(0.6, 0.8, 0.8)) +
  theme_bw()

For more information

Contact

Citation

Cite the package as:



PetoLau/TSrepr documentation built on July 14, 2020, 6:13 p.m.