scoreplot: scoreplot

Description Usage Arguments Value Examples

View source: R/scoreplot.R

Description

Returns the score plot providing a dataset and a pca model. Observations can be identified by the obstag input argument.

Usage

1
2
3
4
5
6
7
8
9
scoreplot(
  X,
  pcamodel,
  obstag = matrix(0, nrow(X), 1),
  pcx = 1,
  pcy = 2,
  alpha = 0.05,
  plottitle = "Score plot\n"
)

Arguments

X

Matrix with the data to be displayed.

pcamodel

List wiht 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 compuatation of the confidence ellipse, set to 0.05 (5 %) by default.

plottitle

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

Value

ggplot object with the generated score plot.

Examples

1
2
3
4
5
X <- as.matrix(X)
pcamodel.ref <- pcamb_classic(X[1:40,], 3, 0.05, "cent")
scoreplot(X, pcamodel.ref)
tags <- dotag(X[1:40,], X[-c(1:40),])
scoreplot(X, pcamodel.ref, obstag = tags, pcx = 2, pcy = 3, alpha = 0.1, plottitle = "T-plot")

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