distplot {SCOUTer}R Documentation

distplot

Description

Returns the distance plot providing a dataset and a Principal Component Analysis model.

Usage

distplot(
  X,
  pcaref,
  obstag = matrix(0, nrow(X), 1),
  plottitle = "Distance plot\n"
)

Arguments

X

data matrix with observations to be displayed in the distance plot.

pcaref

list with the information of the PCA model.

obstag

Optional column vector of integers indicating the group of each observation (0 or 1). Default value set to matrix(0, nrow(X), 1).

plottitle

Optional string with the plot title. Set to "Distance plot" by default.

Details

Coordinates are expressed in terms of the Hotelling's T^2 (x-axis) and the Squared Prediction Error (y-axis) obtained projecting X on the provided model. Observations can be identified by the obstag input argument.

Value

ggplot object with the distance plot.

Examples

X <- as.matrix(X)
pcamodel.ref <- pcamb_classic(X, 2, 0.05, "cent")
distplot(X, pcamodel.ref)
tags <- dotag(X[1:40,], X[-c(1:40),])
distplot(X, pcamodel.ref, obstag = tags, plottitle = "D plot title")

[Package SCOUTer version 1.0.0 Index]