Skip to contents

An S4 class to store the results of a simple correspondence analysis.

Note

This class inherits from MultivariateAnalysis.

Author

N. Frerebeau

Examples

## Data from Lebart et al. 2006, p. 170-172
data("colours")

## The chi square of independence between the two variables
stats::chisq.test(colours)
#> 
#> 	Pearson's Chi-squared test
#> 
#> data:  colours
#> X-squared = 138.29, df = 9, p-value < 2.2e-16
#> 

## Compute correspondence analysis
X <- ca(colours)

## Plot rows
viz_rows(X, labels = TRUE)


## Plot columns
viz_columns(X, labels = TRUE)


## Get row coordinates
get_coordinates(X, margin = 1)
#>                  F1          F2           F3  .sup
#> marron   -0.4921577 -0.08832151  0.021611305 FALSE
#> noisette -0.2125969  0.16739109 -0.100518284 FALSE
#> vert      0.1617534  0.33903957  0.087597437 FALSE
#> bleu      0.5474139 -0.08295428 -0.004709408 FALSE

## Get column coordinates
get_coordinates(X, margin = 2)
#>                 F1          F2          F3  .sup
#> brun    -0.5045624 -0.21482046  0.05550909 FALSE
#> chatain -0.1482527  0.03266635 -0.04880414 FALSE
#> roux    -0.1295233  0.31964240  0.08315117 FALSE
#> blond    0.8353478 -0.06957934  0.01621471 FALSE

## Get total inertia
sum(get_inertia(X))
#> [1] 0.2335977

## Get row contributions
get_contributions(X, margin = 1)
#>                 F1       F2         F3
#> marron   43.115744 13.04249  6.6795992
#> noisette  3.400961 19.80398 61.0855951
#> vert      1.354851 55.90952 31.9248234
#> bleu     52.128445 11.24401  0.3099822