dist_pca: Distance matrix with inter feature(variable) distances based...

Description Usage Arguments Details Examples

View source: R/dist_pca.R

Description

Computes distance between features(variables) weighing the loadings proportional to corresponding eigenvalues

Usage

1
dist_pca(model, ...)

Arguments

model

Object of class 'prcomp' or 'princomp'.

...

Arguments to be passed to 'proxy::dist'

Details

See the book: 'An introduction to applied multivariate analysis with R' by Everitt (et al) section 3.6 on 'Rescaling the principal components'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
pca_iris          <- stats::prcomp(scale(iris[,1:4]))
feature_dist_iris <- dist_pca(pca_iris)
feature_dist_iris
plot(stats::hclust(feature_dist_iris))

pca_iris2         <- stats::princomp(covmat = cor(iris[,1:4]), cor = TRUE)
feature_dist_iris2 <- dist_pca(pca_iris2)
feature_dist_iris2
all.equal(feature_dist_iris, feature_dist_iris2)
plot(stats::hclust(feature_dist_iris))

talegari/sidekicks documentation built on Sept. 26, 2018, 4:18 p.m.