Skip to contents

Return indivdual contributions for each principal component

Usage

pca_ind_contrib(
  ind_coords,
  eigs,
  weighted_row = rep(1, nrow(ind_coords))/nrow(ind_coords)
)

Arguments

ind_coords

individual coordinates

eigs

eigs computed by get_eigen or get_weighted_eigen

weighted_row

row weights

Details

If you want to compute the contributions of the individuals to the principal components, you have to change the weighted_col argument to rep(1, nrow(ind_cos2)).

Examples

library(FactoMineR2)

eigs <- iris[, -5] |>
  standardize_norm() |>
  get_weighted_eigen()

eigs |>
  pca_ind_coords() |>
  pca_ind_contrib(eigs) |>
  head()
#>          Dim.1      Dim.2       Dim.3       Dim.4
#> [1,] 1.1715796 0.16806554 0.074085470 0.018798188
#> [2,] 0.9891845 0.33146674 0.250034006 0.341474919
#> [3,] 1.2768164 0.08526419 0.008875320 0.025915633
#> [4,] 1.2077372 0.26029781 0.037858004 0.140000650
#> [5,] 1.3046313 0.30516562 0.001125175 0.041530572
#> [6,] 0.9841236 1.61748779 0.003303827 0.001405371