dscplot {SCOUTer}R Documentation

dscplot

Description

Returns the distance plot and the score plot providing a data matrix and a Principal Component Analysis (PCA) model. Observations can be identified by the obstag input argument.

Usage

dscplot(
  X,
  pcamodel,
  obstag = matrix(0, nrow(X), 1),
  pcx = 1,
  pcy = 2,
  alpha = 0.05,
  nrow = 1,
  ncol = 2,
  legpos = "bottom"
)

Arguments

X

Matrix with the data to be displayed.

pcamodel

List with the PCA model elements.

obstag

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

pcx

Optional integer with the number of the PC in the horizontal axis. Set to 1 by default.

pcy

Optional integer with the number of the PC in the vertical axis. Set to 2 by default.

alpha

Optional number between 0 and 1 expressing the type I risk assumed in the computation of the confidence ellipse, set to 0.05 (5 %) by default.

nrow

Optional number of rows the plot layout. Set to 1 by default.

ncol

Optional number of columns the plot layout. Set to 2 by default.

legpos

Optional string with the position of the legend. Set to "bottom" by default.

Value

ggplot object with the generated score plot.

Examples

X <- as.matrix(X)
pcamodel.ref <- pcamb_classic(X[1:40,], 3, 0.05, "cent")
dscplot(X, pcamodel.ref)
dscplot(X, pcamodel.ref, nrow = 2, ncol = 1)
tags <- dotag(X[1:40,], X[-c(1:40),])
dscplot(X, pcamodel.ref, obstag = tags, pcy = 3)

[Package SCOUTer version 1.0.0 Index]