ctr4Variables: Compute contributions (or squared cosines) for (qualitatitve)...

View source: R/goodies4MCA.R

ctr4VariablesR Documentation

Compute contributions (or squared cosines) for (qualitatitve) variables in Multiple Correspondence Analysis (e.g., as performed by ExPosition::epMCA).

Description

ctr4Variables: Computes contributions (or squared cosines) for (qualitatitve) variables in Multiple Correspondence Analysis (e.g., as performed by ExPosition::epMCA).

Usage

ctr4Variables(ctrJ)

Arguments

ctrJ

a matrix or data frame of contributions or squared cosines (e.g., from ExPosition::epMCA, the contributions are in cj, the squared cosines are in ri).

Details

In MCA, the contribution (resp. squared cosine) of a variable is the sum of (resp. squared cosine) contributions of all its levels.

ctr4Variables finds the levels of a given variable by stripping the contribution columns names of their extension (e.g., toto.1 and toto.2 are two levels of the qualitative variable toto). This is performed with the function tools::file_path_sans_ext.

Value

A qualitative variables by dimensions data frame.

Author(s)

Hervé Abdi

See Also

getVarNames

Examples

library(ExPosition)
data(mca.wine)
resMCA    <- epMCA(mca.wine$data, graphs = FALSE)
contriVar <- ctr4Variables(resMCA$ExPosition.Data$cj)

HerveAbdi/data4PCCAR documentation built on Sept. 11, 2022, 4:19 p.m.