getRandomFS: generate multivariate random observations (i.e., factor...

View source: R/buildRandomImage4PCA.R

getRandomFSR Documentation

generate multivariate random observations (i.e., factor scores) whose variance match the variance/eigenvalues of the dimensions of the space.

Description

getRandomFS: generate random observations (such as factors scores) from a PCA whose variance match the variance of the dimensions of the PCA. .

Usage

getRandomFS(
  ev,
  nObs = 100,
  FUN = stats::runif,
  center = FALSE,
  scale = "SS1",
  sv = FALSE
)

Arguments

ev

The variance / eigenvalues per dimension (no default).

nObs

the number of observationz to generate, Default: 100

FUN

the random number generating. function. Default: stats::runif (uniform distribution).

center

center the numbers. Default: FALSE.

scale

normalization per dimension prior to re-normalize the factor scores with ev, best to stick with the default. if FALSE do not normalize the numbers, if TRUE normalize the numbers to Z-scores per dimension, if 'SS1' (default) normalize to one

sv

if TRUE, ev gives singular values or standard deviation, if FALSE (default) ev gives eigenvalues or variance.

Details

getRandomFS: Simulates a set multivariate coordinates of random observations whose variance per dimension (i.e., eigenvalues in PCA) will match a given set of variances. The function generating the set of numbers can be any such function (default is runif).

Value

A matrix of multidimensional factor scores with nObs rows (observations) and number of columns (variables / components) equal to the length of ev.

Author(s)

Hervé Abdi

See Also

scale0 @importFrom stats runif

Examples

# generates 10 factors scores from a 4-dimensional space
# whose dimensions have variances of 16, 9, 4, and 1
randFS <- getRandomFS(ev = c(16, 9, 4, 1), nObs = 10)

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