speinfo: speinfo

Description Usage Arguments Value Examples

View source: R/speinfo.R

Description

Information about the Squared Prediction Error (SPE) of an observation. Two subplots show the information of an observation regarding its SPE statistic, i.e.: a bar plot indicating the value of the statistic for the observation, and a bar plot with the contribution that each variable had for the SPE value

Usage

1
speinfo(SPE, E, limspe, iobs = NA)

Arguments

SPE

Vector with values of the SPE statistic.

E

Matrix with the contributions of each variable (columns) for each observation (rows) to the SPE. It is the error term obtained from the unexplained part of X by the PCA model.

limspe

Upper Control Limit (UCL) for the SPE, at a certain confidence level (1-alpha)*100 %.

iobs

Integer with the index of the observation of interest. Default value set to NA.

Value

ggplot object with the generated bar plots.

Examples

1
2
3
4
5
X <- as.matrix(X)
pcamodel.ref <- pcamb_classic(X[1:40,], 2, 0.05, "cent") # PCA-MB with first 40 observations
pcaproj <- pcame(X[-c(1:40),], pcamodel.ref) # Project last observations
speinfo(pcaproj$SPE, pcaproj$E, pcamodel.ref$limspe, 2) # Information about the SPE of the 
# row #2

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