Chi2DistanceFromSort: 'Chi2DistanceFromSort': Creates a 3-dimensional chi2 distance...

View source: R/Chi2DistanceFromSort.R

Chi2DistanceFromSortR Documentation

Chi2DistanceFromSort: Creates a 3-dimensional chi2 distance array from the results of a sorting task.

Description

Chi2DistanceFromSort: Takes the results from a (plain) sorting task where K assessors sort I observations into (mutually exclusive) groups (i.e., one object is in one an only one group). Chi2DistanceFromSort creates an I*I*K array of distance in which each of the k "slices" stores the (sorting) distance matrix of the kth assessor. In one of these distance matrices, the distance between rows is the Chi2 distance between rows when the results of the task are coded as 0/1 group coding (i.e., the "complete disjunctive coding" as used in multiple correspondence analysis, see Abdi & Valentin, 2007, for more)

Usage

Chi2DistanceFromSort(X)

Arguments

X

gives the results of a sorting task (see example below) as a objects (row) by assessors (columns) matrix.

Details

The ouput ot the function Chi2DistanceFromSort is used as input for the function distatis.

The input should have assessors as columns and observations as rows (see example below)

Value

Chi2DistanceFromSort returns an I*I*K array of K distances matrices (between the I observations)

Author(s)

Herve Abdi

References

See examples in

Abdi, H., Valentin, D., Chollet, S., & Chrea, C. (2007). Analyzing assessors and products in sorting tasks: DISTATIS, theory and applications. Food Quality and Preference, 18, 627–640.

Abdi, H., & Valentin, D., (2007). Some new and easy ways to describe, compare, and evaluate products and assessors. In D., Valentin, D.Z. Nguyen, L. Pelletier (Eds) New trends in sensory evaluation of food and non-food products. Ho Chi Minh (Vietnam): Vietnam National University-Ho chi Minh City Publishing House. pp. 5–18.

Abdi, H., & Valentin, D. (2007). Multiple correspondence analysis. In N.J. Salkind (Ed.): Encyclopedia of Measurement and Statistics. Thousand Oaks (CA): Sage. pp. 651-657.

These papers are available from https://personal.utdallas.edu/~herve/

See Also

distatis

Examples


#  1. Get the data from the 2007 sorting example
#      this is the eay they look from Table 1 of
#      Abdi et al. (2007).
#                       Assessors
#                  1 2 3 4 5 6 7 8 9 10
# Beer        Sex  f m f f m m m m f m
#            -----------------------------
#Affligen          1 4 3 4 1 1 2 2 1 3
#Budweiser         4 5 2 5 2 3 1 1 4 3
#Buckler_Blonde    3 1 2 3 2 4 3 1 1 2
#Killian           4 2 3 3 1 1 1 2 1 4
#St. Landelin      1 5 3 5 2 1 1 2 1 3
#Buckler_Highland  2 3 1 1 3 5 4 4 3 1
#Fruit Defendu     1 4 3 4 1 1 2 2 2 4
#EKU28             5 2 4 2 4 2 5 3 4 5

#
# 1.1. Create the
#     Name of the Beers
BeerName <- c('Affligen', 'Budweiser','Buckler Blonde',
              'Killian','St.Landelin','Buckler Highland',
              'Fruit Defendu','EKU28')
# 1.2. Create the name of the Assessors
#      (F are females, M are males)
Juges <- c('F1','M2', 'F3', 'F4', 'M5', 'M6', 'M7', 'M8', 'F9', 'M10')

# 1.3. Get the sorting data
SortData <- c(1, 4, 3, 4, 1, 1, 2, 2, 1, 3,
              4, 5, 2, 5, 2, 3, 1, 1, 4, 3,
              3, 1, 2, 3, 2, 4, 3, 1, 1, 2,
              4, 2, 3, 3, 1, 1, 1, 2, 1, 4,
              1, 5, 3, 5, 2, 1, 1, 2, 1, 3,
              2, 3, 1, 1, 3, 5, 4, 4, 3, 1,
              1, 4, 3, 4, 1, 1, 2, 2, 2, 4,
              5, 2, 4, 2, 4, 2, 5, 3, 4, 5)
# 1.4 Create a data frame
Sort <- matrix(SortData,ncol = 10, byrow= TRUE, dimnames = list(BeerName, Juges))
#
#-----------------------------------------------------------------------------
# 2. Create the set of distance matrices (one distance matrix per assessor)
#    (use the function DistanceFromSort)
DistanceCube <- Chi2DistanceFromSort(Sort)
#-----------------------------------------------------------------------------
# 3. Call the DISTATIS routine with the cube of distance
#       obtained from DistanceFromSort as a parameter for the distatis function
testDistatis <- distatis(DistanceCube)


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