computePcaNbDims: Number of dimensions for PCA

View source: R/sampleCompute.R

computePcaNbDimsR Documentation

Number of dimensions for PCA

Description

Compute the number of dimensions to keep after a Principal Components Analysis, according to a threshold on the cumulative variance.

Usage

computePcaNbDims(sdev, pca.variance.cum.min = 0.9)

Arguments

sdev

standard deviation of the principal components (returned from prcomp).

pca.variance.cum.min

minimal cumulative variance to retain.

Details

computePcaNbDims computes the number of dimensions to keep after a Principal Components Analysis, according to a threshold on the cumulative variance

Value

pca.nb.dims number of dimensions kept.

See Also

computePcaSample

Examples

dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
tf <- tempfile()
write.table(dat, tf, sep=",", dec=".")

x <- importSample(file.features=tf)
res.pca <- computePcaSample(x)
computePcaNbDims(res.pca$pca$sdev)




RclusTool documentation built on May 29, 2024, 5:23 a.m.