Learn R Programming

RPatRec

Please refer to the vignette for details and examples on how to use this package!

There are two vignettes in this package that guide you through the process of using this software.

Check out whether the latest build has passed the checks on Tarvis/AppVeyor:

Currently, testing covers this proportion of lines of code

How to build your own recognition function

Your function can have any name you wish. There are, however, a few criteria you should adhere to:

  • The first 3 arguments of your function may have any name and together provide all known information about the extrema in the time series. They need be as follows:
    • Extrema: A vector of 0s and 1s indicating whether the identified extrema are maxima(1) or minima(0)
    • Extvals: A vector containing the value of these extrema in the smoothed time series
    • Extpos: A vector containing the times at which the extrema occur in the smoothed time series
  • Your function must return a list as a result. This list needs to contain the following elements if you wish to use the inbuilt diagnostics tools (recognition rate, etc. although these will need be adapted). Should you wish to use the slicer function (i.e. expect more than one pattern per sample) you need to make sure to include point 4) in your output list.
  1. EXT=extrema as passed to your function
  2. EXV=values of these extrema, as passed to your function
  3. EXP=position in time of these extremes
  4. RESULT=Logical. TRUE if any pattern is found in the sample, FALSE otherwise. Depending on whether your algorithm looks for more than one type of pattern, this needs to be programmed. If TRUE, slicer counts the result as a find.
  • The remaining arguments and list entries in the result need not confirm to any standard.

Below is an example of a skeleton recognition function for your own patterns. ITALIC are optional but recommended elements.

custompatrec <- function(extrema, extvals, extpos, arguments){
    #room for your code
    result <- list(EXT=extrema, EXV=extvals, EXP=extpos, recog, RESULT=logical)
    #recog is your own output. I recommend a separate list
    #element per type of pattern your function recognises
return(result)
}

Copy Link

Version

Install

install.packages('rpatrec')

Monthly Downloads

20

Version

1.0.1

License

GPL-3

Maintainer

Stephan Maier

Last Published

May 23rd, 2017

Functions in rpatrec (1.0.1)

data

Daily Closing Prices of major Stock Market Indices
generator

Generate a time series containing a Visual Charting Pattern.
rpatrec

rpatrec: A package to recognise Patterns in (financial) time series Data
sample.pre

Prepare Data for using with the other functions in the package
savgolay

Perform Savitzgy-Golay smoothing on Time Series Data
slicer

Recognise Multiple Patterns in a sinlge time series
mav

Compute the moving average, exponential average or running median.
noise

Add noise to a time series
splines

Use the inbuilt function
test.smoother

Test how well a smoother can filter noise from data
interpret

Recognise patterns in Time Series Data
iq

Inbuilt Recoqnition for 10 different financial markets patterns
kernel

Perform Kernel Regression on Time Series Data
loess.rpatrec

Use the inbuilt function