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).

Author

N. Frerebeau

Examples

## Load data
data("iris")

## Compute principal components analysis
X <- pca(iris, scale = TRUE, sup_row = sample(150, 10), sup_col = 2)
#> 1 qualitative variable was removed: Species.

## Get row coordinates
head(get_coordinates(X, margin = 1))
#>          F1          F2  .sup
#> 2 -2.201573  0.11817480 FALSE
#> 3 -2.367836 -0.06001351 FALSE
#> 4 -2.367140 -0.18357653 FALSE
#> 5 -2.135207  0.21416273 FALSE
#> 6 -1.617487  0.41716467 FALSE
#> 7 -2.324840 -0.23958256 FALSE

## Get column coordinates
head(get_coordinates(X, margin = 2))
#>                      F1         F2  .sup
#> Sepal.Length  0.9321261  0.3608481 FALSE
#> Petal.Length  0.9850186 -0.1084081 FALSE
#> Petal.Width   0.9653553 -0.2378108 FALSE
#> Sepal.Width  -0.3073360  0.4520736  TRUE

## Get row contributions
head(get_contributions(X, margin = 1))
#>          F1         F2
#> 2 1.2493865 0.05024845
#> 3 1.4452198 0.01295899
#> 4 1.4443700 0.12125713
#> 5 1.1751968 0.16502918
#> 6 0.6743913 0.62616384
#> 7 1.3932099 0.20653009

## Get correlations between variables and dimensions
head(get_correlations(X))
#>                      F1         F2  .sup
#> Sepal.Length  0.9321261  0.3608481 FALSE
#> Petal.Length  0.9850186 -0.1084081 FALSE
#> Petal.Width   0.9653553 -0.2378108 FALSE
#> Sepal.Width  -0.3073360  0.4520736  TRUE

## Get eigenvalues
get_eigenvalues(X)
#>    eigenvalues  variance cumulative
#> F1   2.7710315 93.314891   93.31489
#> F2   0.1985176  6.685109  100.00000