Learn R Programming

rpatrec (version 1.0.1)

generator: Generate a time series containing a Visual Charting Pattern.

Description

This function lets you generate any pattern you specify in the parameters. For known definitions, either check the examples or the vignettes. This is mainly used to test either your own or this smoothing and recognition function.

Usage

generator(start = 0, dlength = 100, tot.spread = 100, presig = 0,
  postsig = 0, plength = 0, parts = c(15, 25, 50, 75, 85), sprd = c(50,
  25, 100, 25, 50))

Arguments

start
Starting value
dlength
Integer. Length of the signal part of the time series
tot.spread
Integer. Difference between the lowest and highest value of the time series
presig
Integer. Length of the pre-signal part of the time series
postsig
Integer. Length of the post-signal part of the time series
plength
No longer needed, kept for compatability. Set to 0.
parts
Vector of Integers. Must be the same length as sprd Defines how far the extrema lie apart from another (in percent) PREVIOUSLY: Vector must contain plength + 2 elements, the first element being 0 and the last 100.
sprd
Vector of Integers. Must be the same length as parts Defines the value of the extrema in percent of tot.spread in relation to start. PREVIOUSLY: Vector must contain plength + 2 elements, the first and last elemnt should be 0.

Value

Time series with (optional) pre- or post signal, and the specified pattern.

Details

For an overview of the package capabilities, click here rpatrec

Examples

Run this code
## Not run: ------------------------------------
# #create a standard HS pattern:
# generator()
# #
# 
# #create a shifted head and shoulders pattern
# generator(sprd = c(20,10,90,40,60))
# #
# #create a Double Tops pattern
# generator(plength=3,parts=c(25,50,75),sprd=c(80,40,80))
# #
# #create a Rectangle Tops pattern
# generator(plength=5,parts=c(20,40,50,60,80),sprd=c(80,40,80,40,80))
# #
# #create a single peak, 10 data points, max is approximately 10
# generator(0,10,10,0,0,0,50,100)
## ---------------------------------------------

Run the code above in your browser using DataLab