Skip to contents

Event Helpers : fg_findTurningPoints

Usage

fg_findTurningPoints(
  indta,
  rtn = "dates",
  method = "pctchg",
  npts = 10,
  pts_of_interest = "change",
  pctabovemin = 0.05,
  maxwindow = -1,
  addlast = FALSE,
  cpmmethod = "GLR",
  ...
)

Arguments

indta

Time series data.table with a date as the first column and a value series as the second column, or a prophet::prophet() object

rtn

string with what to return ('dates','data','all')

method

string describing method of finding Turning Points

  • "pctchg" : (Default) Find npts largest percentage changes with a miniumum window between them

  • "cpm" : Uaw cpm-package to find change points

npts

Number of change points to find

pts_of_interest

string in 'change' (default) or 'value'

pctabovemin

Minimum percentage change to look for.

maxwindow

Integer (default -1) which limits (if positive) the minimum number of observations between change points.

addlast

Logical (default: FALSE) to add an event with final observation.

cpmmethod

String (default: "GLM") passed to cpm::processStream()

...

Additional parameters passed to cpm-package

Value

data.table suitable for passing into fgts_dygraph() via the event_ds parameter

Examples

dta <-eqtypx[,.(date,QQQ,TLT)]
fgts_dygraph(dta,event_ds=fg_findTurningPoints(dta),title="With turningPoints")