monteCarlo.eigen: Monte Carlo generation of (random) eigenvalues to match a...

View source: R/testMC.R

monteCarlo.eigenR Documentation

Monte Carlo generation of (random) eigenvalues to match a data matrix.

Description

monteCarlo.eigen: generates Monte Carlo random eigenvalues to match a data given matrix. The random numbers can be generated from any of the random number generators in R. (of course, the default is a standard normal distribution). Note that the specific parameters for the random gnerator need to be passed as additional arguments to the function (i.e., with the "..." procedure).

Usage

monteCarlo.eigen(
  X,
  nIter = 100,
  center = TRUE,
  scale = "SS1",
  FUN = rnorm,
  ...
)

Arguments

X

The data matrix to match.

nIter

how many random set of eigenvalues to generate; Default: 100.

center

(Default = TRUE) if TRUE: center the data (by columns).

scale

the type of scaling of the data. Can be FALSE (no scaling), TRUE (scale as Z-score), 'NONE' (no scaling), or 'SS1' (all columns of the data matrix have norm 1, and so the eigen-values come from a correlation matrix). Default: 'SS1'.

FUN

the function to generate random numbers; Default: rnorm (normal distribution). Could be any of the functions provided by R, such as rexp, rlogis,, etc. Most of these functions require additional parameters to be passed via ... (see below).

...

Stuff (i.e., parameters) to pass the FUN if needed (e.g., mean and standard deviation). To find these parameters, check the help of the function used for the random number generator.

Details

monteCarlo.eigen can be used to implement a parallel test for the number of reliable components. Note that the parallel test becomes equivalent to the Kaiser test (i.e., eigenvalues larger than the average inertia) when the number of rows of the data matrix is large enough.

Value

a list with 3 elements

  1. $fixed.eigs: the eigen-values of X,

  2. $rand.eigs: an nIter by rank(X) matrix of the eigenvalues of the bootstrapped samples,

  3. $rand.eigs.sorted: an nIter by rank(X) matrix of the eigenvalues of the bootstrapped samples.

See Also

rnorm scale0 boot.eigen

Examples

data(iris)
random.eigen <- monteCarlo.eigen(iris[,1:4], nIter = 10)

HerveAbdi/data4PCCAR documentation built on Sept. 11, 2022, 4:19 p.m.