jdplot: Function to visualize the predictive power of a joint...

Description Usage Arguments Details

Description

This function is used to gain insights into a joint distribution x, y and its predictive power over the third variable, the target.

Usage

1
2
3
4
5
6
jdplot(target, x = NULL, y = NULL, mode = "scatterplot",
  window = NULL, qsize = NULL, qtiles = list(Top = c(0.9, 1, 0.01),
  Bottom = c(0, 0.1, -0.01)), qstyle = data.frame(qnames = c("Other",
  "Top", "Bottom"), col = c("grey20", "green", "red"), pch = c(20, 8, 5),
  alpha = c(0.15, 1, 1)), legendloc = "topleft", mtitle = NULL,
  prices = NULL, ...)

Arguments

target,

x, y These are the 3-D data points to perform the scatter plot. X and y are the scatterplot x and y coordinates respectively, whereas target is the third dimension that is expressed as a pch and/or color on the 2D scatterplot based on its quantile / cluster. There are two ways to specify this data: either each of target, x and y are single column xts matrices, or a single 3 column xts matrix is provided as target and x and y are NULL.

mode

The plotting mode. Supported modes are 'scatterplot' and 'dual'. Mode 'scatterplot' is for a simple scatterplot to highlight the quantile regions using a given pch character and a given color. Mode 'dual' produces a two panel plot, where the top panel is a scatterplot and the bottom panel is an xtsplot of the target variable's price.

window

The window width to perform the rollapply to compute the rolling quantile. If left to NULL, then no windowing is performed and the quantiles are computed from the entire data set.

qsize

If specified, this modifies the qtiles 'Top' and 'Bottom' arguments to the specified percentage. qsize should be specified as a decimal i.e. 0.10

qtiles

A named list containing the quantiles to analyze and a cutoff threshold used in rolling window mode. The cutoff thresholds are applicable only to Top and Bottom quantiles and ignored otherwise. All other quantile names can be anything meaningful to identify the quantiles, except that Top and Bottom are reserved for Top and Bottom quantiles respectively. Each quantile is assigned a vector length of either 2 or 3, where the first two values express the bottom and upper limit of the quantile. These limits are expressed as a number between 0 and 1. In cases where a third argument is provided (in rolling window mode), it is a percentage value (expressed as a fraction between -1 and +1) above or below which the data vector is either accepted or rejected in the quantile. For example, if Top is set between 0.75 and 1.0, with a window length of 100, then we would normally expect the top 25 points in that quantile. By adding the threshold, then only the top 25 points that are also above that threshold are reported. For example, during a bear market lasting the entire window, it's possible that only a few or even no vectors exist in that quantile that also exceed 10 percent. So a cutoff threshold of 10pct would reject most (or all) vectors in such a case.

qstyle

A dataframe used to specify the characteristics of each quantile subset on the scatterplot. Column 1, called qname, contains the name of each quantile. Column 2 (col) is the color for each quantile points. Column 3 (pch) is the plot character. Column 4 (alpha) is the plot point transparency level. In aggregate, this provides full ability to customize the jdplot.

legendloc

The location of the legend. See ?legend for details.

mtitle

The main title text. Normally set to NULL which creates a default title.

prices

The price series to plot in the second panel, if mode = "dual". If no price series is given and the dual mode is selected, then the target is used instead of the price series.

...

Other arguments passed on to the plot function.

Details

The function generally performs a scatterplot of x, y and uses color to project the target variable onto the 2-D scatterplot. The projection should at least contain one quantile region of the data, thus splitting the data into at least two subsets, the quantile region and all other points.

As an additional option, the quantile subsets may also be grouped into clusters. Each such cluster should be given a unique color and/or point character (pch) for easy identification. This is specified in a dataframe in argument qstyle.

A shortcut is provided to get top and bottom quantiles at a given percentage. The default is set to Top = 95 qsize argument.


jeanmarcgp/xtsanalytics documentation built on May 19, 2019, 12:38 a.m.