Learn R Programming

Rdimtools (version 1.0.6)

aux.preprocess: Preprocessing the data

Description

aux.preprocess can perform one of following operations; "center", "scale", "cscale", "decorrelate" and "whiten". See below for more details.

Usage

aux.preprocess(
  data,
  type = c("center", "scale", "cscale", "decorrelate", "whiten")
)

Arguments

data

an \((n\times p)\) matrix or data frame whose rows are observations and columns represent independent variables.

type

one of "center", "scale", "cscale", "decorrelate" or "whiten".

Value

named list containing:

pX

an \((n\times p)\) matrix after preprocessing in accordance with type parameter

info

a list containing

  • type: name of preprocessing procedure.

  • mean: a mean vector of length \(p\).

  • multiplier: a \((p\times p)\) matrix or 1 for "center".

Operations

we have following operations,

"center"

subtracts mean of each column so that every variable has mean \(0\).

"scale"

turns each column corresponding to variable have variance \(1\).

"cscale"

combines "center" and "scale".

"decorrelate"

"center" and sets its covariance term having diagonal entries only.

"whiten"

"decorrelate" and sets all diagonal elements be \(1\).

Examples

Run this code
# NOT RUN {
## Generate data
set.seed(100)
X = aux.gensamples(n=200)

## 5 types of preprocessing
X_center = aux.preprocess(X)
X_scale  = aux.preprocess(X,type="scale")
X_cscale = aux.preprocess(X,type="cscale")
X_decorr = aux.preprocess(X,type="decorrelate")
X_whiten = aux.preprocess(X,type="whiten")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab