backTransPCA: "Back-transform" PCA scores to their original values

View source: R/backTransPCA.r

backTransPCAR Documentation

"Back-transform" PCA scores to their original values

Description

This function back-transforms principal component scores to their original values.

Usage

backTransPCA(pca, x = NULL)

Arguments

pca

Object of class prcomp.

x

Either NULL (default) or a vector of PC scores. If NULL, then the scores from the PCA object are used.

Value

Numeric vector.

Examples

x <- data.frame(
	x1 = 1:20 + rnorm(20),
	x2 = 1:20 + rnorm(20, 0, 5),
	x3 = sample(20, 20)
)

pca1 <- prcomp(x, center=FALSE, scale=FALSE)
pca2 <- prcomp(x, center=TRUE, scale=FALSE)
pca3 <- prcomp(x, center=TRUE, scale=TRUE)

backTransPCA(pca1)
backTransPCA(pca2)
backTransPCA(pca3)


adamlilith/statisfactory documentation built on Jan. 3, 2024, 10:37 p.m.