Learn R Programming

RclusTool (version 0.91)

computePcaNbDims: 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.

Value

pca.nb.dims number of dimensions kept.

Details

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

See Also

computePcaSample

Examples

Run this code
# NOT RUN {
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, dir.save=tempdir())
res.pca <- computePcaSample(x)
computePcaNbDims(res.pca$pca$sdev)



# }

Run the code above in your browser using DataLab