scoreplotsimple: scoreplotsimple

Description Usage Arguments Value Examples

View source: R/scoreplotsimple.R

Description

Returns the score plot providing the scores matrix, T. Observations can be identified by the obstag input argument.

Usage

1
2
3
4
5
6
7
8
9
scoreplotsimple(
  Tscores,
  pcx = 1,
  pcy = 2,
  obstag = matrix(0, nrow(Tscores), 1),
  alpha = 0.05,
  varT = stats::var(Tscores),
  plottitle = "Score plot\n"
)

Arguments

Tscores

Matrix with the scores to be displayed, with the information of each Principal Component (PC) stored by columns.

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.

obstag

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

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.

varT

Optional parameter expressing the variance of each PC. Set to var(Tscores) 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
6
7
8
X <- as.matrix(X)
pcamodel.ref <- pcamb_classic(X[1:40,], 3, 0.05, "cent")
pcaproj <- pcame(X, pcamodel.ref) # Project last observations
scoreplotsimple(pcaproj$Tscores)

pcaproj <- pcame(X[-c(1:40),], pcamodel.ref) # Project all observations
tags <- dotag(X[1:40,], X[-c(1:40),]) # 0's for observations used in PCA-MB
scoreplotsimple(pcaproj$Tscores, pcx = 2, pcy = 3, obstag = tags)

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