pcaMethods (version 1.64.0)

rediduals-methods: Residuals values from a PCA model.

Description

This function extracts the residuals values from a pcaRes object for the PCA methods SVD, Nipals, PPCA and BPCA

Usage

"residuals"(object, data = completeObs(object), ...)
"residuals"(object, data = completeObs(object), ...)
"resid"(object, data = completeObs(object), ...)

Arguments

object
pcaRes the pcaRes object of interest.
data
matrix The data that was used to calculate the PCA model (or a different dataset to e.g. adress its proximity to the model).
...
Passed on to predict.pcaRes. E.g. setting the number of used components.

Value

A matrix with the residuals

Examples

Run this code
data(iris)
pcIr <- pca(iris[,1:4])
head(residuals(pcIr, iris[,1:4]))

Run the code above in your browser using DataCamp Workspace