distplotsimple {SCOUTer} | R Documentation |
displotsimple
Description
Returns the distance plot directly providing the coordinates and Upper Control Limits.
Usage
distplotsimple(
T2,
SPE,
lim.t2,
lim.spe,
ncomp,
obstag = matrix(0, length(T2), 1),
alpha = 0.05,
plottitle = "Distance plot\n"
)
Arguments
T2 |
Vector with the Hotelling's T^2 values for each observation. |
SPE |
Vector with the SPE values for each observation. |
lim.t2 |
Value of the Upper Control Limit for the T^2 statistic. |
lim.spe |
Value of the Upper Control Limit for the SPE. |
ncomp |
An integer indicating the number of PCs. |
obstag |
Optional column vector of integers indicating the group of each
observation ( |
alpha |
Optional number between 0 and 1 expressing the type I risk assumed in the
computation of the Upper Control Limits (UCL) set to |
plottitle |
Optional string with the plot title, |
Details
Coordinates are expressed in terms of the Hotelling's T^2 (T^2, x-axis) and the Squared Prediction Error (SPE, y-axis). Observations can be identified by the obstag input argument.
Value
distplotobj ggplot object with the generated distance plot.
Examples
X <- as.matrix(X)
pcamodel.ref <- pcamb_classic(X[1:40,], 2, 0.05, "cent") # PCA-MB with first 40
# observations
pcaproj <- pcame(X[-c(1:40),], pcamodel.ref) # Project last observations
distplotsimple(pcaproj$T2, pcaproj$SPE, pcamodel.ref$limt2, pcamodel.ref$limspe,
pcamodel.ref$ncomp)
pcaproj <- pcame(X, pcamodel.ref) # Project all observations
tags <- dotag(X[1:40,], X[-c(1:40),]) # 0's for observations used in PCA-MB
distplotsimple(pcaproj$T2, pcaproj$SPE, pcamodel.ref$limt2, pcamodel.ref$limspe,
pcamodel.ref$ncomp, obstag = tags)