Skip to contents

An S4 class to store the results of a principal components analysis.

Slots

center

A numeric vector giving the column mean of the initial dataset (active individuals only).

scale

A numeric vector giving the column standard deviations of the initial dataset (active individuals only).

Note

This class inherits from MultivariateAnalysis.

Author

N. Frerebeau

Examples

## Load data
data("iris")

## Compute principal components analysis
X <- pca(iris)
#> 1 qualitative variable was removed: Species.

## Get eigenvalues
get_eigenvalues(X)
#>    eigenvalues  variance cumulative
#> F1   2.9184978 73.342264   73.34226
#> F2   0.9140305 22.969715   96.31198
#> F3   0.1467569  3.688021  100.00000

## Get individual cos2
head(get_cos2(X, margin = 1))
#>          F1         F2           F3  .sup
#> 1 0.9539975 0.04286032 0.0030335249 FALSE
#> 2 0.8927725 0.09369248 0.0113475382 FALSE
#> 3 0.9790410 0.02047578 0.0003422122 FALSE
#> 4 0.9346682 0.06308947 0.0014732682 FALSE
#> 5 0.9315095 0.06823959 0.0000403979 FALSE
#> 6 0.6600989 0.33978301 0.0001114335 FALSE

## Get variable contributions
get_contributions(X, margin = 2)
#>                     F1          F2        F3
#> Sepal.Length 27.150969 14.24440565 51.777574
#> Sepal.Width   7.254804 85.24748749  5.972245
#> Petal.Length 33.687936  0.05998389  2.019990
#> Petal.Width  31.906291  0.44812296 40.230191

## Get correlations between variables and dimensions
get_correlations(X)
#>                      F1         F2          F3  .sup
#> Sepal.Length  0.8901688 0.36082989 -0.27565767 FALSE
#> Sepal.Width  -0.4601427 0.88271627  0.09361987 FALSE
#> Petal.Length  0.9915552 0.02341519  0.05444699 FALSE
#> Petal.Width   0.9649790 0.06399985  0.24298265 FALSE