list2CubeOfCovDis: compute a cube of covariance and a cube of distance between...

View source: R/list2CubeOfCov.R

list2CubeOfCovDisR Documentation

compute a cube of covariance and a cube of distance between the items (rows) of a matrix of measurements comprising K different blocks of possibly different number of variables.

Description

list2CubeOfCovDis compute a cube of covariance and a cube of (squared) Euclidean distance between the items (rows) a matrix of measurements comprising K different blocks of possibly different number of variables. The variables describing the items can scaled to norm 1 and centered. The whole matrix for a block can be scaled by its first eigenvalue (a la DISTATIS). Blocks can have different number of variables and when all blocks have same number of variables list2CubeOfCovDis is a more efficient alternative

Usage

list2CubeOfCovDis(Data, Judges, scale = TRUE, center = TRUE, ev.scale = TRUE)

Arguments

Data

a matrix of dimensions I items by J quantitative variables (structured in K blocks of J_k variables each). No Default.

Judges

a J components character vector identifiying the variables corresponding to each block of variables. No Default.

scale

(Default: TRUE), when TRUE scale to norm 1 each column for each slice.

center

(Default: TRUE), when TRUE centers each column.

ev.scale

(Default: TRUE), when TRUE normalizes each slice (i.e., each I items by J matrix) so that its first eigenvalue is equal to 1.

Details

The input of list2CubeOfCovDis is a I items by J quantitative variables that are organized in K blocks (i.e., submatrices) each comprising J_k variables (with sum J_k = J).

By default list2CubeOfCovDis centers and normalizes each column for each block and then normalize each covariance matrix such that the first eigenvalue of each covariance matrix (for a given block) is equal to 1.

A distatis analysis of the Distance matrices with the option Distance = TRUE will give the same results as the distatis analysis of the Covariance matrices with the option Distance = FALSE.

Value

a list with 1) cubeOfCovariance a cube of K I by I covariance matrices; and 2) codecubeOfDistance a cube of K I by I (squared) Euclidean distance matrices.

Author(s)

Herve Abdi

See Also

list2CubeOfCov

Examples

path2file <- system.file("extdata",
                        "BeersFlashProfile.xlsx", 
                        package = 'DistatisR')
# read the data in the excel file with read.df.excel
beerDataFlash  <- read.df.excel(path = path2file,
                               sheet = 'Rankings')$df.data
# Extract the namers of the judges (first 2 characters)
JudgesVars <- colnames(beerDataFlash)
zeJudges <- substr(JudgesVars,1,2)
 # call list2CubeOfCovDis
test.list2 <- list2CubeOfCovDis(Data = beerDataFlash ,
                               Judges =  zeJudges)

DistatisR documentation built on Dec. 5, 2022, 9:05 a.m.