MergeLevels: Signal Quantization

Description Usage Arguments Value Examples

View source: R/MergeLevels.R

Description

This function rounds the input signal with a large set of input levels (values that more than 1 observation have) to a countable smaller set. The quantization error - the difference between an input value and its quantized value - is smaller than minDiff.

Usage

1
MergeLevels(signal, minDiff)

Arguments

signal

a numeric vector.

minDiff

a numeric value indicating the maximum round-off error

Value

The returned value is a list of two vectors:

Examples

1
2
3
4
signal <- c(rep(-1.1, 10), rep(5, 10), rep(-1, 10), 3, rep(4, 10), rep(3.9, 10))
output <- MergeLevels(signal, 0.2)
ts <- data.table(input = signal, output = output$signal, time = (as.Date("2017-01-01") + seq_along(signal)))
PlotTimeSeries(ts, "time")

jingjin1018/anetimeseries documentation built on May 19, 2019, 10:35 a.m.