ldecomp.plotResiduals: Residuals distance plot for a set of ldecomp objects

View source: R/ldecomp.R

ldecomp.plotResidualsR Documentation

Residuals distance plot for a set of ldecomp objects

Description

Shows a plot with score (T2, h) vs orthogonal (Q, q) distances and corresponding critical limits for given number of components.

Usage

ldecomp.plotResiduals(
  res,
  Qlim,
  T2lim,
  ncomp,
  log = FALSE,
  norm = FALSE,
  cgroup = NULL,
  xlim = NULL,
  ylim = NULL,
  show.limits = c(TRUE, TRUE),
  lim.col = c("darkgray", "darkgray"),
  lim.lwd = c(1, 1),
  lim.lty = c(2, 3),
  show.legend = TRUE,
  legend.position = "topright",
  show.excluded = FALSE,
  ...
)

Arguments

res

list with result objects to show the plot for

Qlim

matrix with critical limits for orthogonal distance

T2lim

matrix with critical limits for score distance

ncomp

how many components to use (by default optimal value selected for the model will be used)

log

logical, apply log tranformation to the distances or not (see details)

norm

logical, normalize distance values or not (see details)

cgroup

color grouping of plot points (works only if one result object is available)

xlim

limits for x-axis (if NULL will be computed automatically)

ylim

limits for y-axis (if NULL will be computed automatically)

show.limits

vector with two logical values defining if limits for extreme and/or outliers must be shown

lim.col

vector with two values - line color for extreme and outlier limits

lim.lwd

vector with two values - line width for extreme and outlier limits

lim.lty

vector with two values - line type for extreme and outlier limits

show.legend

logical, show or not legend on the plot (if more than one result object)

legend.position

if legend must be shown, where it should be

show.excluded

logical, show or hide rows marked as excluded (attribute 'exclrows').

...

other plot parameters (see mdaplotg for details)

Details

The function is a bit more advanced version of plotResiduals.ldecomp. It allows to show distance values for several result objects (e.g. calibration and test set or calibration and new prediction set) as well as display the correspondng critical limits in form of lines or curves.

Depending on how many result objects your model has or how many you specified manually, using the res parameter, the plot behaves in a bit different way.

If only one result object is provided, then it allows to colorise the points using cgroup parameter. If two or more result objects are provided, then the function show distances in groups, and adds corresponding legend.

The function can show distance values normalised (h/h0 and q/q0) as well as with log transformation (log(1 + h/h0), log(1 + q/q0)). The latter is useful if distribution of the points is skewed and most of them are densely located around bottom left corner.


mdatools documentation built on Sept. 11, 2024, 7:59 p.m.