dist_pca.Rd
Computes distance between features(variables) weighing the loadings proportional to corresponding eigenvalues
dist_pca(model, ...)
model | Object of class 'prcomp' or 'princomp'. |
---|---|
... | Arguments to be passed to 'proxy::dist' |
See the book: 'An introduction to applied multivariate analysis with R' by Everitt (et al) section 3.6 on 'Rescaling the principal components'
pca_iris <- stats::prcomp(scale(iris[,1:4])) feature_dist_iris <- dist_pca(pca_iris) feature_dist_iris#> Sepal.Length Sepal.Width Petal.Length #> Sepal.Width 2.36441184 #> Petal.Length 0.38799175 2.61263496 #> Petal.Width 0.36928628 2.55802891 0.09765659pca_iris2 <- stats::princomp(covmat = cor(iris[,1:4]), cor = TRUE) feature_dist_iris2 <- dist_pca(pca_iris2) feature_dist_iris2#> Sepal.Length Sepal.Width Petal.Length #> Sepal.Width 2.36441184 #> Petal.Length 0.38799175 2.61263496 #> Petal.Width 0.36928628 2.55802891 0.09765659#> [1] TRUE