distplot: distplot

Description Usage Arguments Details Value Examples

View source: R/distplot.R

Description

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

Usage

1
2
3
4
5
6
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

1
2
3
4
5
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")

SCOUTer documentation built on July 1, 2020, 6:27 p.m.