| plot_influence | R Documentation |
Plots the residual distance of each sample to a PCA model (Q residual or
DModX) against its Hotelling's T^2, with their limits at each
confidence level, from q_residuals() or dmodx(). It is drawn like the
outlier map of a robust PCA, plot_outlier_map().
plot_influence(
x,
label = NULL,
labels = 3,
relative = FALSE,
shade = FALSE,
log = FALSE,
title = NULL,
...,
color_by = c("type", "distance"),
xlab = NULL,
ylab = NULL,
base_size = 11,
point_size = 2.2,
point_alpha = 0.85,
colour_by = deprecated()
)
x |
The result of |
label |
The names of the samples: a vector with one value per sample. By default, their row numbers. |
labels |
The number of most outlying samples to label (beyond a limit at the highest confidence level). Default is 3; use 0 for no labels. |
relative |
If |
shade |
If |
log |
If |
title |
The plot title. |
... |
Further arguments passed to |
color_by |
The colors of the points: |
xlab, ylab |
The axis titles. Default are the names of the distances. |
base_size |
The size of the text, in points. Default is 11. |
point_size |
The size of the points (default 2.2), or a numeric vector with one value per sample, such as the concentration of an element, to vary the size of the points, with a legend. |
point_alpha |
The opacity of the points, between 0 and 1 (default 0.85). |
colour_by |
The limits at the highest confidence level (dashed lines) divide the plot into four types of samples:
regular samples (bottom left);
extreme samples (bottom right): a high T^2 but well
described by the model, for example a high concentration;
residual samples (top left): not described by the model (another matrix, a contamination, an instrumental problem);
samples beyond both limits, the most harmful.
The limits at lower confidence levels are dotted, dot-dashed, ... lines.
With relative = TRUE, each distance is divided by its limit at the
highest confidence level, so both limits are at 1 whatever the model,
which puts plots of different models on the same scale.
A ggplot object.
Christian L. Goueguel
q_residuals(), dmodx(), plot_outlier_map()
data(forageLIBS)
pca <- stats::prcomp(forageLIBS[-(1:14)])
influence <- q_residuals(pca, ncomp = 3, conf_level = c(0.95, 0.99))
plot_influence(influence, label = forageLIBS$Measurement)
# the same options as plot_outlier_map(): distances relative to the limits,
# shaded outlying regions, logarithmic axes and colors by distance
plot_influence(influence, relative = TRUE, shade = TRUE, log = TRUE, color_by = "distance")
# a single limit at 97.5%, with the outlying regions shaded
influence_975 <- q_residuals(pca, ncomp = 3, conf_level = 0.975)
plot_influence(influence_975, label = forageLIBS$Measurement, shade = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.