ts_segmentation: Time series histogram and shading

View source: R/ts_segmentation.R

ts_segmentationR Documentation

Time series histogram and shading

Description

Make density plot of subsequent returns conditioned on multiple binary indicators derived from a reference time series

Usage

ts_segmentation(
  df,
  date_idx,
  invest_series,
  invest_name = NULL,
  cndtn_series,
  cndtn_name = NULL,
  bin_method,
  lb = 6,
  pc = 0.2,
  fr = -0.05
)

Arguments

df

A dataframe containing the following columns:

  • date

  • a times series for assessment (to be referenced by the argument "invest_series")

  • an indicator time series (to be referenced by the argument "cndtn_series") for plotting and categorisation into bins representing specific level and change values

date_idx

The column in df representing the date index

invest_series

A column in df representing the time series for which returns are to be assessed

invest_name

A string representing the name of the time series for which returns are to be assessed. If populated, this this will display in the plot title as opposed to the column name.

cndtn_series

A column in df representing the conditioning time series to derive the multiple binary indicators

cndtn_name

A string representing the name of the conditioning time series to derive the multiple binary indicators. If populated, this this will display in the plot title as opposed to the column name.

bin_method

either, "level" - split time series into terciles only, or "both" - split time series into terciles and a 6 month change indicator ("increase" or "decrease")

lb

The look back period for draw-down assessment

pc

The percent draw-down for binary market in/out indicator cutoff

fr

The minimum forward return for binary market in/out indicator cutoff

Value

A ggplot object.


Brent-Morrison/romerb documentation built on Jan. 28, 2024, 9:27 p.m.