Learn R Programming

jvcoords (version 1.0.3)

whiten: Whiten data

Description

Whiten data and return the results as an object of class coords.

Usage

whiten(x, compute.scores = TRUE)

Arguments

x

A data matrix, rows are observations, columns are variables.

compute.scores

Whether to compute the scores (i.e. x in the new basis).

Value

An object of class coords, with the following additional components added:

loadings

the loadings, each column is one of the new basis vectors

y

if compute.scores==TRUE, this is x expressed in the new basis

Details

This function whitens the data by finding an affine transformation such that the transformed data has mean 0 and identity covariance matrix.

If compute.scores is set to FALSE, only the information required for the toCoords() and fromCoords() to work is stored in the returned coords object; otherwise the scores (transformed data) will be stored in the $y field of the coords object.

See Also

coords

Examples

Run this code
# NOT RUN {
  w <- whiten(iris[, 1:4])
  colMeans(w$y)
  round(cov(w$y), 3)
# }

Run the code above in your browser using DataLab