Package 'CA3variants'

Title: Three-Way Correspondence Analysis Variants
Description: Provides four variants of three-way correspondence analysis (ca): three-way symmetrical ca, three-way non-symmetrical ca, three-way ordered symmetrical ca and three-way ordered non-symmetrical ca.
Authors: Rosaria Lombardo, Eric J Beh and Michel van de Velden
Maintainer: Rosaria Lombardo <[email protected]>
License: GPL (> 2)
Version: 3.3.1
Built: 2024-11-03 04:51:24 UTC
Source: https://github.com/cran/CA3variants

Help Index


Correspondence Analysis variants for three-way contingency tables

Description

This function performs four variants of three-way correspondence analysis (CA). It does the three-way symmetrical CA, when ca3type = "CA3", and three-way non-symmetrical CA, when ca3type = "NSCA3", by using the Tucker3 decomposition. It also performs ordered three-way symmetrical CA, when ca3type = "OCA3", and ordered three-way non-symmetrical CA, when ca3type = "ONSCA3", by using the Trivariate Moment Decomposition. The non-symmetrical variants consider the three variables asymmetrically related, such that one of the variables is the response to be predicted given the other two variables. It calculates the coordinates and inertia values of the chosen analyses. Furthermore, it allows to look at the index (Pearson's chi-squared or Marcotorchino's tau) partition.

Usage

CA3variants(Xdata, dims = c(p, q, r), ca3type = "CA3", test = 10^-6, 
resp = "row", norder = 3, sign = TRUE)

Arguments

Xdata

The three-way data. It can be a R object array or raw data (n individuals by three categorical variables, for an example, see museum data). When a three-way non-symmetrical variant is performed, by default, the response variable is the row variable when an array is given, or the first of three columns when a raw data set is given. For changing, consider the parameter resp = "col" or resp = "tube".

dims

The number of components for the first, second and third mode. By default, no dims is given. When using an ordered variant of three-way CA recall to consider the complete dimension, i.e. the number of components for the first, second and third mode must be equal to the number of rows, columns and tubes, respectively.

ca3type

The specification of the analysis to be performed. If ca3type = "CA3", then a three-way symmetrical correspondence analysis will be performed (default analysis). If ca3type = "NSCA3", then three-way non-symmetrical correspondence analysis will be performed. If ca3type = "OCA3", then ordered three-way symmetrical correspondence analysis will be performed. If ca3type = "ONSCA3", then ordered three-way non-symmetrical correspondence analysis will be performed.

test

Threshold used in the algorithm for stopping it after the convergence of the solutions.

resp

The input parameter for specifying in non-symmetrical three-way correspondence analysis variants (ca3type = "NSCA3" and ca3type = "ONSCA3") what is the response variable (logically antecendent to the others). By default, resp = "row", but it could be resp = "col" or resp = "tube".

norder

The input parameter for specifying the number of ordered variable when ca3type = "OCA3" or ca3type = "ONSCA3". By default, all three variables are ordered norder = 3. When norder = 1, you assume that the ordered variable is the column variable. When norder = 2, you assume that the ordered variables are the row and column variable.

sign

The input parameter for changing the sign to the components according to the core sign.

Details

This function recall internally many other functions, depending on the setting of the input parameters. After performing three-way symmetric or non-symmetric correspondence analysis, it recall two functions for printing and plotting the results. These two important functions are print.CA3variants and plot.CA3variants.

Value

The value of output returned depends on the kind of analysis performed. For a detailed description of the output one can see:
the output value of ca3basic if the input parameter is ca3type="CA3"; the output value of nsca3basic if the input parameter is ca3type="NSCA3"; the output value of oca3basic if the input parameter is ca3type="OCA3" the output value of onsca3basic if the input parameter is ca3type="ONSCA3"

Author(s)

Rosaria Lombardo, Eric J Beh and Michel van de Velden.

References

Beh EJ and Lombardo R (2014) Correspondence Analysis, Theory, Practice and New Strategies. John Wiley & Sons.
Kroonenberg PM (1994) The TUCKALS line: a suite of programs for three-way data analysis. Computational Statistics and Data Analysis, 18, 73–96.
Lombardo R, Beh EJ and Kroonenberg PM (2021) Symmetrical and Non-Symmetrical Variants of Three-Way Correspondence Analysis for Ordered Variables. Statistical Science, 36 (4), 542-561.

Examples

data(ratrank)
CA3variants(Xdata = ratrank, dims = c(p=2,q=2,r=1), ca3type = "CA3") 
data(happy)
CA3variants(Xdata = happy, dims = c(p=2,q=2,r=2), ca3type = "NSCA3") 
CA3variants(Xdata = happy, dims = c(p=3,q=5,r=4), ca3type = "OCA3") 
CA3variants(Xdata = happy, dims = c(p=3,q=5,r=4), ca3type = "ONSCA3")

The partition of the Pearson three-way index

Description

When three categorical variables are symmetrically related, we can analyse the strength of the association using the three-way Pearson mean square contingency coefficient, named the chi-squared index. The function chi3 partitions the Pearson phi-squared statistic when in CA3variants we set the parameter ca3type = "CA3".

Usage

chi3(f3, digits = 3)

Arguments

f3

The three-way contingency array given as an input parameter in CA3variants.

digits

The number of decimal digits. By default digits=3.

Value

The partition of the Pearson index into three two-way association terms and one three-way association term. It also shows the explained inertia, the degrees of freedom and p-value of each term of the partition.

Author(s)

Rosaria Lombardo, Eric J Beh, Ida Camminatiello.

References

Beh EJ and Lombardo R (2014) Correspondence Analysis, Theory, Practice and New Strategies. John Wiley & Sons.
Carlier A and Kroonenberg PM (1996) Decompositions and biplots in three-way correspondence analysis. Psychometrika, 61, 355-373.

Examples

data(happy)
chi3(f3=happy, digits=3)

The partition of the Pearson three-way index.

Description

When three categorical variables are symmetrically related, we can analyse the strength of the symmetrical association using the three-way Pearson statistic. The function chi3ordered partitions the Pearson phi-squared statistic using orthogonal polynomials when, in CA3variants, we set the parameter ca3type = "OCA3".

Usage

chi3ordered(f3, digits = 3)

Arguments

f3

The three-way contingency array given as an input parameter in CA3variants.

digits

The number of decimal digits. By default digits=3.

Value

The partition of the Pearson index into three two-way association terms and one three-way association term. It also shows the polynomial componets of inertia, the percentage of explained inertia, the degrees of freedom and p-value of each term of the partition.

Author(s)

Rosaria Lombardo, Eric J Beh, Ida Camminatiello.

References

Lombardo R, Beh EJ and Kroonenberg PM (2021) Symmetrical and Non-Symmetrical Variants of Three-Way Correspondence Analysis for Ordered Variables. Statistical Science, 36 (4), 542-561.

Examples

#data(happy)
chi3ordered(f3 = happy, digits = 3)

Three-way contingency table

Description

This three-way contingency table was generated from the database of the European Social Survey 2016. The variables that we selected for our analysis are Education, Households and Happiness.

Usage

data(happy)

Format

The format is: row names [1:4] "ED1", "ED2", "ED3", "ED45" col names [1:6] "HS1", "HS2", "HS3", "HS4", "HS5", "HS>5" tube names [1:4] "low", "middle", "high", "very-high"

References

Beh EJ and Lombardo R (2014) Correspondence Analysis: Theory, Practice and New Strategies. John Wiley & Sons.

Examples

happy <-
structure(c(325, 411, 793, 602, 239, 374, 827, 583, 63, 
181, 361, 303, 42, 129, 229, 224, 16, 49, 89, 54, 
11, 37, 31, 21, 357, 477, 1049, 929, 327, 610, 1447, 
1446, 115, 303, 763, 832, 64, 250, 591, 638, 35, 105, 
183, 185, 15, 56, 99, 71, 265, 327, 769, 928, 342, 
565, 1461, 1808, 104, 314, 768, 1006, 69, 312, 729, 
977, 21, 122, 215, 362, 14, 57, 126, 129, 214, 241, 
554, 660, 419, 561, 1467, 1861, 130, 290, 786, 938, 
89, 319, 741, 1022, 36, 121, 289, 408, 35, 87, 153, 
171), .Dim = c(4, 6, 4), .Dimnames = list(c("ED1", 
"ED2", "ED3", "ED45"), c("HS1", "HS2", "HS3", "HS4", "HS5", "HS>5"
), c("low", "middle", "high", "very-high")))
dim(happy)

Raw data: Three variables from a Dutch survey on happiness

Description

This raw data table represents a possible data set selected from a large survey on happiness. The rows are individuals. The first column concerns four level of happiness, the second column concerns the number of households in a family, and the third column their level of Education.

Usage

data(museum)

Format

The format is: row names [1:4] "low", "middle", "high", "very-high" col names [1:5] "HS1", "HS2", "HS3", "HS4", ">HS5" tube names [1:4] "ED1", "ED2", "ED3", "ED45"

References

Lombardo R, van de Velden M and Beh E J (2022) Three-way Correspondence Analysis in R. (submitted)

Examples

happyNL<-structure(c(11L, 12L, 15L, 7L, 2L, 6L, 17L, 13L, 0L, 2L, 4L, 
6L, 0L, 5L, 7L, 3L, 0L, 3L, 3L, 1L, 14L, 56L, 52L, 22L, 11L, 
39L, 70L, 65L, 1L, 14L, 19L, 14L, 5L, 12L, 16L, 20L, 2L, 3L, 
10L, 4L, 14L, 44L, 44L, 15L, 6L, 27L, 79L, 47L, 4L, 17L, 40L, 
27L, 2L, 25L, 49L, 38L, 1L, 12L, 12L, 11L, 10L, 41L, 66L, 24L, 
4L, 32L, 100L, 90L, 1L, 8L, 40L, 28L, 3L, 15L, 49L, 35L, 1L, 
4L, 23L, 15L), .Dim = c(4L, 5L, 4L), .Dimnames = list(happy = c("low", 
"middle", "high", "very-high"), hhmmb = c("HS1", "HS2", "HS3", 
"HS4", ">HS5"), edulvla = c("ED1", "ED2", "ED3", "ED45")), class = "table")
dim(happyNL)
data(happyNL)

Raw data: Three variables from a survey

Description

This raw data table represents a possible data set selected from a large survey on customer satisfacyion during museum visiting. The rows are individuals. The first column concerns the number of visits, the second column concerns if they like it, and the third column their satisfaction.

Usage

data(museum)

Format

The format is: num [1:223, 1:3] "often" "much" "excellent" ...

References

Beh EJ and Lombardo R (2014) Correspondence Analysis: Theory, Practice and New Strategies. John Wiley & Sons.

Examples

museum<-structure(list(nvis = structure(c(2L, 2L, 4L, 4L, 1L, 3L, 3L, 
2L, 4L, 1L, 3L, 3L, 4L, 2L, 4L, 3L, 4L, 2L, 2L, 3L, 4L, 4L, 2L, 
4L, 3L, 4L, 2L, 2L, 4L, 1L, 2L, 2L, 4L, 1L, 4L, 2L, 2L, 2L, 4L, 
1L, 1L, 1L, 1L, 2L, 2L, 3L, 2L, 3L, 4L, 4L, 1L, 3L, 2L, 2L, 3L, 
3L, 3L, 2L, 4L, 3L, 2L, 4L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 
3L, 3L, 3L, 2L, 2L, 4L, 4L, 4L, 4L, 3L, 2L, 3L, 3L, 3L, 4L, 2L, 
2L, 2L, 4L, 1L, 1L, 1L, 1L, 2L, 2L, 3L, 2L, 3L, 4L, 4L, 1L, 3L, 
3L, 2L, 4L, 3L, 2L, 4L, 3L, 2L, 4L, 2L, 3L, 3L, 2L, 2L, 2L, 3L, 
2L, 3L, 2L, 2L, 3L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 3L, 2L, 3L, 3L, 
3L, 4L, 4L, 1L, 3L, 3L, 2L, 1L, 1L, 1L, 1L, 3L, 4L, 2L, 4L, 3L, 
4L, 2L, 2L, 3L, 4L, 2L, 3L, 3L, 3L, 4L, 2L, 2L, 2L, 4L, 1L, 3L, 
1L, 1L, 2L, 2L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 2L, 2L, 2L, 1L, 1L, 
2L, 2L, 2L, 1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unsuff"), class = "factor")), class = "data.frame", row.names = c("1", 
"2", "3", "5", "6", "8", "9", "10", "12", "13", "14", "16", "17", 
"18", "19", "20", "21", "22", "23", "24", "25", "27", "30", "31", 
"32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", 
"43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "54", 
"55", "56", "57", "58", "59", "60", "61", "64", "65", "66", "67", 
"68", "69", "70", "71", "72", "73", "74", "75", "78", "80", "81", 
"82", "84", "85", "86", "87", "88", "89", "90", "91", "92", "95", 
"96", "97", "98", "99", "100", "101", "102", "104", "105", "106", 
"107", "108", "109", "110", "111", "112", "113", "115", "116", 
"117", "118", "119", "120", "121", "122", "123", "124", "125", 
"126", "127", "128", "129", "130", "131", "132", "133", "136", 
"138", "139", "140", "142", "143", "144", "145", "146", "147", 
"148", "149", "150", "151", "153", "154", "155", "156", "157", 
"158", "159", "160", "162", "163", "165", "166", "167", "168", 
"169", "170", "171", "173", "174", "175", "176", "177", "178", 
"179", "180", "181", "182", "183", "184", "185", "186", "187", 
"189", "190", "191", "192", "193", "194", "195", "196", "197", 
"198", "200", "201", "202", "203", "204", "205", "206", "207", 
"208", "209", "210", "211", "212", "213", "214", "215", "217", 
"218", "219", "220", "221", "222", "223", "224", "225", "227", 
"228", "229", "230", "231", "232", "233", "234", "235", "236", 
"237", "238", "239", "240", "241", "242", "243", "244", "245", 
"246", "247", "248", "249", "250", "251", "252", "253"))
dim(museum)
data(museum)

Three-way contingency table

Description

This three-way contingency table represents an historical data set found in Agresti (1990).

Usage

data(olive)

Format

The format is: row names [1:6] "A", "B", "C", "D", "E", "F" col names [1:3] "NW", "NE", "SW" tube names [1:2] "urban", "rural"

References

Beh EJ and Lombardo R (2014) Correspondence Analysis: Theory, Practice and New Strategies. John Wiley & Sons.

Examples

olive <-structure(c(20, 15, 12, 17, 16, 28, 18, 17, 18, 18, 
6, 25, 12, 9, 23, 21, 19, 30, 30, 22, 21, 17, 8, 
12, 23, 18, 20, 18, 10, 15, 11, 9, 26, 19, 17, 24
), .Dim = c(6L, 3L, 2L), .Dimnames = list(c("A", "B", "C", "D", 
"E", "F"), c("NW", "NE", "SW"), c("urban", "rural")))
dim(olive)
data(olive)

Graphical display resulting from CA3variants

Description

The function plot.CA3variants allows the analyst to graphically display six types of biplots for symmetrical 3-way variants and two types of biplots for non-symmetrical 3-way variants. The six types of biplots for CA3 and OCA3 are the following. When the input parameter is biptype = "column-tube" (or biptype = "col-tube"), the function displays the column-tube interactive biplot, where the column and tube variables are coded interactively and have principal coordinates and the row variable has standard coordinates. When the input parameter is biptype = "row", the function displays the row biplot, where the rows have principal coordinates. When the input parameter is biptype = "col", the function displays the column biplot, where the columns have principal coordinates. When the input parameter is biptype = "row-tube", the function displays the row-tube biplot, where the row-tubes have principal coordinates. When the input parameter is biptype = "tube", the function displays the tube biplot, where the tubes have principal coordinates When the input parameter is biptype = "row-column" (or biptype = "row-col"), the function displays the row-column interactive biplot, where the row-columns have principal coordinates. The two types of biplots for NSCA3 and ONSCA3 are the following. When the input parameter is biptype = "pred", the function displays the biplot where the predictors are coded interactively and have principal coordinates and the response has standard coordinates. When the input parameter is biptype = "resp", the function displays the biplot where the response variable has principal coordinates and the predictors (interactively coded) have standard coordinates.

By default, biptype = "column-tube".

Usage

## S3 method for class 'CA3variants'
plot(x, firstaxis = 1, lastaxis = 2, thirdaxis = 3, cex = 0.8,  
biptype="column-tube", scaleplot = NULL,  plot3d = FALSE, pos = 1, 
size1 = 1, size2 = 3, addlines = TRUE,...)

Arguments

x

The output parameters of the main function CA3variants.

firstaxis

The dimension reflected along the horizontal axis.

lastaxis

The dimension reflected along the vertical axis.

thirdaxis

The dimension reflected along the third axis when plot3d = TRUE.

cex

The parameter that specifies the size of character labels of points in graphical displays. By default, it is equal to 0.8.

biptype

The input parameter for specifying what kind of biplot is requested. By default, it is equal to column-tube, but could be row-tube, row-column, row, column and tube.

scaleplot

The scaling parameter for biplots to pull points away from the origin (see gamma biplot in Gower et al 2011). By default, it is equal to the overall average for the sum of squares of the two sets of coordinates (principal and standard ones), because of the average sum of squares for the two sets of points is the same (see Van de Velden et al 2017).

plot3d

The logical parameter specifies whether a 3D plot is to be included in the output or not. By default, plot3d = FALSE.

pos

The input parameter for changing the label position. By default, it is equal to 1.

size1

The input parameter for specifying the size of pointers. By default, it is equal to 1.

size2

The input parameter for specifying the label size. By default, it is equal to 2.

addlines

The input parameter for plotting lines in biplots (the points in standard coordinates are represented using lines). By default, it is equal to addlines = TRUE.

...

Further arguments passed to or from other methods.

Details

It is utilised by the main function CA3variants and uses the secondary graphical function graph2poly.

Value

Graphical displays of three-way correspondence analysis variants. Interactive plots or biplots are the graphical results of this function.

Author(s)

Rosaria Lombardo, Eric J Beh and Michel van de Velden.

References

Beh EJ and Lombardo R (2014) Correspondence Analysis, Theory, Practice and New Strategies. John Wiley & Sons.
Van de Velden M, Iodice D'Enza A, Palumbo F (2017) Cluster Correspondence Analysis. Psychometrika, 82, 158–185.
Gower JC, Lubbe SG, and Le Roux, NJ (2011) Understanding biplots. New York: Wiley.
Lombardo R, Beh EJ and Kroonenberg PM (2021) Symmetrical and Non-Symmetrical Variants of Three-Way Correspondence Analysis for Ordered Variables. Statistical Science, 36 (4), 542-561.

Examples

data(happy)
res.ca3<-CA3variants(happy, dims = c(p = 2, q = 2, r = 2), ca3type = "CA3") 
plot(res.ca3)
res.nsca3<-CA3variants(happy, dims = c(p = 2, q = 2, r = 2), ca3type = "NSCA3") 
plot(res.nsca3, biptype = "resp", plot3d = TRUE)
res.oca3<-CA3variants(happy, dims = c(p = 3, q = 5, r = 4), ca3type = "OCA3", norder = 3) 
plot(res.oca3, biptype = "tube",firstaxis=4,lastaxis=7)
res.onsca3<-CA3variants(happy, dims = c(p = 3, q = 5, r = 4), ca3type = "ONSCA3", norder = 3) 
plot(res.onsca3,biptype="resp",firstaxis=6,lastaxis=7)

Graphical display resulting from tunelocal

Description

The function plot.tunelocal allows the analyst to graphically display the optimal model dimension using a convex hull.

Usage

## S3 method for class 'tunelocal'
plot(x,...)

Arguments

x

The results of the function tunelocal. It shows the models that are located on the boundary of the convex hull and selects an optimal model by means of the scree test values (st). When using boots=F, it gives the set of possible dimension combination of the original data using only the original data array. When using boots=T, it gives the set of possible dimension combination of the original data using bootstrapped data arrays.

...

Further arguments passed to or from other methods.

Value

Graphical displays of a convex hull computed using the original data and the bootstrapped data when in tunelocal the input parameter boot=TRUE computed bootstrapped data too.

Author(s)

Rosaria Lombardo, Michel van de Velden and Eric J. Beh.

References

Beh EJ and Lombardo R (2014) Correspondence Analysis, Theory, Practice and New Strategies. John Wiley & Sons.
Wilderjans TF, Ceulemans E, and Meers K (2013) CHull: A generic convex hull based model selection method. Behavior Research Methods, 45, 1-15.
Ceulemans E, and Kiers H A L (2006) Selecting among three-mode principal component models of different types and complexities: A numerical convex hull based method. British Journal of Mathematical & Statistical Psychology, 59, 133-150.

Examples

res.tunelocal<-tunelocal(happy, ca3type = "CA3",boots = FALSE, 
          nboots = 0)
plot(res.tunelocal)

Print of three-way correspondence analysis results

Description

This function prints the results of three-way symmetrical or non-symmetrical correspondence analysis. If the input parameter, in CA3variants, is ca3type="CA3", the function prints the results of three-way symmetrical correspondence analysis. If the input parameter, in CA3variants, is ca3type="NSCA3", the function prints the results of three-way non-symmetrical correspondence analysis. If the input parameter, in CA3variants, is ca3type="OCA3", the function prints the results of ordered three-way symmetrical correspondence analysis. If the input parameter, in CA3variants, is ca3type="ONSCA3", the function prints the results of ordered three-way non-symmetrical correspondence analysis. When the input parameter, in print.CA3variants, is digits = 3, the function prints all the results using three digital numbers.

Usage

## S3 method for class 'CA3variants'
print(x, printall= FALSE, digits = 3,...)

Arguments

x

The name of the output of the main function CA3variants.

printall

The logical parameter that specifies if to print all the results or some of them. By default, printall = FALSE.

digits

The input parameter specifying the digital number. By default, digits = 3.

...

Further arguments passed to or from other methods.

Value

The value of output returned depends on the kind of three-way correspondence analysis variant performed. It also gives the number of the iteration of the algorithm to reach the convergence of the solution. Depending on the variant of three-way correspondence analysis performed, it gives the related weighted contingency table, the reconstructed table by the components and core array, the explained inertia, the total inertia, the inertia in percentage, the proportion of explained inertia given the defined number of the components, the row standard and principal coordinates, the interactive column-tube standard and principal coordinates, the inner-product matrix of coordinates, the core array and index partitioning. In detail:

CA3variants

The output of the kind of three-way correspondence analysis analysis considered.

Data

The original three-way contingency table.

xs

The centred and weighted three-way contingency table when the input parameters are ctr=T and std=T.

xhat

The three-way contingency table approximated (reconstructed) by the three component matrices (of dimension Ixp, Jxq, and Kxr) and the core array.

nxhat2

The sum of squares of the approximated contingency table.

prp

The ratio between the inertia of the complete contingency table and the inertia of the approximated contingency table.

fi

The principal row coordinates.

fiStandard

The standard row coordinates.

gjk

The principal colum-tube coordinates.

gjkStandard

The standard colum-tube coordinates.

fj

The principal column coordinates.

fjStandard

The standard column coordinates.

gik

The principal row-tube coordinates.

gikStandard

The standard row-tube coordinates.

fk

The principal tube coordinates.

fkStandard

The standard tube coordinates.

gij

The principal row-colum coordinates.

gijStandard

The standard row-colum coordinates.

rows

The row marginals of the three-way data table.

cols

The column marginals of the three-way data table.

tubes

The tube marginals of the three-way data table.

flabels

The row category labels.

glabels

The column category labels.

maxaxes

The maximum dimension to consider.

inertia

The total inertia of a variant of three-way correspondence analysis.

inertiaRSS

The residual inertia of a variant of three-way correspondence analysis.

inertiapc

The percentage contribution of the three components to the total variation.

inertiacoltub

The vector of the percentage contributions of the interactively coded colum-tube components to the total inertia, useful for making interactively coded biplots.

inertiarow

The vector of the percentage contributions of the row components to the total inertia, useful for making response biplots.

iproduct

The inner product between the standard row coordinates (fi) and the column-tube principal coordinates (gjk).

g

The core array (i.e. the generalized singular values) calculated by using the Tuckals3 algorithm.

index3

When ca3type = "CA3" or ca3type = "OCA3", the index3 represents the partition of the Pearson index into three two-way association terms and one three-way association term. It also shows the C statistic of each term, its degrees of freedom and p-value. If ca3type = "NSCA3" or ca3type = "ONSCA3", the index3 returns the partition of the Marcotorchino index into three two-way association terms and one three-way association term. It also shows the C statistic of each term, its degrees of freedom and p-value.

ca3type

The specification of the analysis to be performed. When ca3type = "CA3", then a three-way symmetrical correspondence analysis will be performed (default analysis). If ca3type = "NSCA3", then three-way non-symmetrical correspondence analysis will be performed, where one of the variables is the response to be predicted given the other two variables. These two three-way variants use the Tucker3 method of decomposition. When ca3type = "OCA3" or ca3type = "ONSCA3", then an ordered three-way symmetrical or non-symmetrical correspondence analysis will be performed. Differently, these analysis use a new method of decomposition called Trivariate Moment Decomposition.

Author(s)

Rosaria Lombardo, Eric J Beh and Michel van de Velden.

References

Beh EJ and Lombardo R (2014) Correspondence Analysis, Theory, Practice and New Strategies. John Wiley & Sons.

Examples

data(happy)
ris.ca3<-CA3variants(happy, dims= c(p=2,q=2,r=2), ca3type = "CA3") 
print(ris.ca3)
ris.nsca3<-CA3variants(happy, dims = c(p=2,q=2,r=2), ca3type = "NSCA3") 
print(ris.nsca3)
ris.oca3<-CA3variants(happy, dims = c(p=3,q=5,r=4), ca3type = "OCA3",norder=3) 
print(ris.oca3)
ris.onsca3<-CA3variants(happy, dims = c(p=3,q=5,r=4), ca3type = "ONSCA3",norder=3) 
print(ris.onsca3)

Print of tunelocal function results

Description

This function prints the results of tunelocal for choosing the optimal model dimension of a variant of three-way correspondence analysis. When boots = T the number of different models that is assessed is based on the size of the original data being analysed.
For example, for a 4 x 5 x 4, there are 80 different models that are assessed.
When boots = T, the number of different models that is assessed is based on the size of all models
obtained from the combination of dimensions of the bootstrapped data.
For example, for a 4 x 5 x 4 array, there are 800 different models that are assessed. By defaultnboots = 100,
you can change the parameter value in input of tunelocal function.

Usage

## S3 method for class 'tunelocal'
print(x, digits = 3,...)

Arguments

x

The name of the output of the function tunelocal.

digits

The input parameter specifying the digital number. By default, digits = 3.

...

Further arguments passed to or from other methods.

Value

The value of output returned depends on the kind of sampling chosen. The sampling for making the convex hull can be based on the original data or on the bootstrapped data samples. In detail:

XG

The data samples used for assessing the optimal model dimension (original and/or bootstrapped).

output1

The results of tunelocal. It gives the goodness-of-fit criteria of models that are located
on the boundary of the convex hull and selects the optimal model by means of the scree test values (st);
see Ceulemans and Kiers (2006).

ca3type

It gives information about the kind of variant of three-way CA considered.

boots

The flag parameter to perform the search of optimal dimensions using bootstrap samples. By defaults, boots = FALSE.

Author(s)

Rosaria Lombardo, Michel van de Velden and Eric J. Beh.

References

Wilderjans T F, Ceulemans E, and Meers K (2013) CHull: A generic convex hull based model selection method. Behavior Research Methods, 45, 1-15.
Ceulemans E, and Kiers H A L (2006) Selecting among three-mode principal component models of different types and complexities: A numerical convex hull based method. British Journal of Mathematical & Statistical Psychology, 59, 133-150.

Examples

res.tunelocal<-tunelocal(happy, ca3type = "CA3") 
print(res.tunelocal)

Rating-ranking data a three-way contingency table

Description

This three-way contingency table represents a known data set described in van Herk and van de Velden (2007). The three-way contingency table consists of nine rating values against nine ranking values given by the same participants across five European countries (France, Italy, Germany, UK and Spain).

Usage

data(ratrank)

Format

The format is: row names [1:9] "1", "2", "3", "4", "5", "6","7","8","9" col names [1:9] "rank1", "rank2", "rank3", "rank4", "rank5", "rank6", "rank7", "rank8", "rank9" tube names [1:5] "F", "I","G","U","S"

References

van Herk H and van de Velden M (2007) Insight into the relative merits of rating and ranking in a cross-national context using three-way correspondence analysis. Food Quality and Preference, 18, 1096–1105.

Examples

ratrank<-structure(c(766L, 128L, 38L, 10L, 12L, 3L, 2L, 5L, 9L, 619L, 
234L, 67L, 16L, 15L, 5L, 2L, 8L, 7L, 512L, 277L, 109L, 22L, 23L, 
5L, 11L, 7L, 7L, 385L, 291L, 152L, 64L, 41L, 9L, 12L, 7L, 12L, 
297L, 251L, 192L, 82L, 96L, 17L, 12L, 6L, 20L, 187L, 203L, 259L, 
105L, 119L, 44L, 19L, 8L, 29L, 143L, 144L, 209L, 140L, 170L, 
54L, 51L, 22L, 40L, 77L, 100L, 152L, 148L, 215L, 73L, 62L, 56L, 
90L, 47L, 45L, 84L, 119L, 200L, 82L, 98L, 67L, 231L, 859L, 101L, 
53L, 18L, 18L, 9L, 7L, 2L, 16L, 733L, 205L, 53L, 23L, 21L, 13L, 
11L, 6L, 18L, 622L, 224L, 124L, 41L, 27L, 8L, 12L, 6L, 19L, 547L, 
248L, 102L, 78L, 45L, 19L, 11L, 11L, 22L, 466L, 243L, 139L, 76L, 
76L, 25L, 21L, 9L, 28L, 357L, 239L, 168L, 105L, 95L, 61L, 20L, 
14L, 24L, 293L, 192L, 165L, 128L, 133L, 42L, 58L, 28L, 44L, 215L, 
162L, 161L, 127L, 148L, 60L, 65L, 54L, 91L, 140L, 121L, 142L, 
128L, 157L, 69L, 76L, 75L, 175L, 1219L, 193L, 29L, 13L, 3L, 4L, 
2L, 6L, 3L, 651L, 504L, 111L, 30L, 19L, 8L, 5L, 8L, 6L, 476L, 
335L, 230L, 35L, 13L, 8L, 5L, 4L, 6L, 346L, 324L, 201L, 136L, 
30L, 5L, 5L, 6L, 5L, 239L, 299L, 234L, 101L, 170L, 22L, 14L, 
4L, 6L, 166L, 246L, 265L, 116L, 96L, 71L, 27L, 11L, 16L, 124L, 
179L, 215L, 163L, 139L, 52L, 80L, 20L, 32L, 80L, 114L, 172L, 
148L, 168L, 80L, 84L, 96L, 70L, 63L, 48L, 101L, 115L, 183L, 92L, 
123L, 131L, 292L, 916L, 99L, 40L, 12L, 7L, 3L, 3L, 13L, 42L, 
578L, 224L, 65L, 11L, 15L, 6L, 3L, 18L, 30L, 486L, 207L, 140L, 
34L, 14L, 10L, 7L, 16L, 29L, 405L, 207L, 149L, 64L, 30L, 7L, 
14L, 21L, 19L, 304L, 256L, 157L, 60L, 83L, 9L, 17L, 20L, 21L, 
239L, 222L, 195L, 95L, 55L, 34L, 20L, 18L, 18L, 204L, 169L, 213L, 
113L, 89L, 23L, 45L, 16L, 15L, 165L, 148L, 184L, 128L, 121L, 
46L, 38L, 51L, 23L, 89L, 94L, 147L, 141L, 181L, 70L, 57L, 32L, 
82L, 1086L, 89L, 37L, 10L, 12L, 6L, 9L, 6L, 24L, 501L, 251L, 
55L, 11L, 14L, 7L, 7L, 7L, 11L, 415L, 139L, 188L, 22L, 14L, 8L, 
4L, 4L, 12L, 359L, 148L, 111L, 101L, 21L, 7L, 7L, 3L, 15L, 278L, 
158L, 128L, 49L, 127L, 9L, 12L, 6L, 13L, 240L, 162L, 130L, 48L, 
58L, 49L, 11L, 5L, 12L, 185L, 113L, 148L, 78L, 84L, 26L, 52L, 
7L, 16L, 128L, 91L, 119L, 110L, 118L, 37L, 38L, 35L, 28L, 83L, 
50L, 67L, 89L, 165L, 47L, 66L, 46L, 120L), .Dim = c(9L, 9L, 5L
), .Dimnames = list(c("1", "2", "3", "4", "5","6", "7",
                      "8", "9"), c("rank1", "rank2", "rank3", 
                        "rank4", "rank5", "rank6",
                       "rank7", "rank8", "rank9"),
                      c("F", "I", "G", "U", "S")))
dim(ratrank)
data(ratrank)

Summary of three-way correspondence analysis results

Description

This function prints the summary of the results of three-way symmetrical or non-symmetrical correspondence analysis. In particular it gives information on core and squared core and on the explained inertia when reducing dimensions.

Usage

## S3 method for class 'CA3variants'
summary(object, digits=3, ...)

Arguments

object

The name of the output of the main function CA3variants.

digits

The input parameter specifying the digital number. By default, digits = 3.

...

Further arguments passed to or from other methods.

Value

The value of output returned in short depends on the kind of three-way correspondence analysis variant performed. It gives the core table, the squared core table, the explained inertia, the total inertia and its proportion.

Author(s)

Rosaria Lombardo, Eric J Beh and Michel van de Velden.

References

Beh EJ and Lombardo R (2014) Correspondence Analysis, Theory, Practice and New Strategies. John Wiley & Sons.

Examples

data(happy)
ris.ca3<-CA3variants(happy, dims= c(p=2,q=2,r=2), ca3type = "CA3") 
summary(ris.ca3)
ris.nsca3<-CA3variants(happy, dims = c(p=2,q=2,r=2), ca3type = "NSCA3") 
summary(ris.nsca3)
ris.oca3<-CA3variants(happy, dims = c(p=3,q=5,r=4), ca3type = "OCA3",norder=3) 
summary(ris.oca3)
ris.onsca3<-CA3variants(happy, dims = c(p=3,q=5,r=4), ca3type = "ONSCA3",norder=3) 
summary(ris.onsca3)

Partition of the Marcotorchino three-way index

Description

When the association among three categorical variables is asymmetric such that one variable is a logical response variable to the other variables, we recommend calculating the non-symmetrical three-way measure of predictability such as the Marcotorchino index (Marcotorchino, 1985). The function tau3 partitions the Marcotorchino statistic when, in CA3variants, we set the parameter ca3type = "NSCA3".

Usage

tau3(f3, digits = 3)

Arguments

f3

Three-way contingency array given as an input parameter in CA3variants.

digits

Number of decimal digits. By default digits=3.

Value

z

The partition of the Marcotorchino index into three two-way association terms and one three-way association term. It also shows the C statistic of each term, its degrees of freedom and p-value.

CM

the C statistic of the Marcotorchino index.

devt

The denominator of the Marcotorchino index.

Author(s)

Rosaria Lombardo, Eric J Beh, Ida Camminatiello.

References

Beh EJ and Lombardo R (2014) Correspondence Analysis, Theory, Practice and New Strategies. John Wiley & Sons.

Examples

data(happy)
tau3(happy, digits = 3)

The partition of the Marcotorchino three-way index.

Description

When three categorical variables are symmetrically related, we can analyse the strength of the association using the three-way Marcotorchino index. The function chi3 partitions the Marcotorchino statistic using orthogonal polynomials when, in CA3variants, we set the parameter ca3type = "ONSCA3".

Usage

tau3ordered(f3, digits = 3)

Arguments

f3

The three-way contingency array given as an input parameter in CA3variants.

digits

The number of decimal digits. By default digits=3.

Value

The partition of the Marcotorchino index into three two-way non-symmetrical association terms and one three-way association term. It also shows the polynomial componets of inertia, the percentage of explained inertia, the degrees of freedom and p-value of each term of the partition.

Author(s)

Rosaria Lombardo, Eric J Beh.

References

Beh EJ and Lombardo R (2014) Correspondence Analysis, Theory, Practice and New Strategies. John Wiley & Sons.

Examples

#data(olive)
tau3ordered(f3 = olive, digits = 3)

Dimension selection for three-dimensional correspondence biplot using convex hull.

Description

This function allows to select the optimal dimension number for correspondence biplot, given the set of possible dimension combination of the original data. It determines the models that are located on the boundary of the convex hull and selects an optimal model by means of the scree test values (st). For exploring, it is also possible to check the optimal model dimension by using boostrap samples which have the same marginal proportions and the total number of the original table. When the input parameter boots = T, it does bootstrap sampling. There are three kinds of possible bootstrap sampling. When boottype = "bootnp" it performs a non parametric bootstrap sampling. When boottype = "bootpsimple" it performs a parametric simple bootstrap sampling. When boottype = "bootpstrat", it performs a parametric stratified bootstrap sampling. In particular in case of parametric bootstrap types, when resamptype=1 it considers a multinomial distribution, and when resamptype = 2 it considers a poisson distribution.

Usage

tunelocal(Xdata, ca3type = "CA3", resp = "row", norder = 3, digits = 3, boots = FALSE,  
nboots = 0, boottype= "bootpsimple", resamptype = 1, PercentageFit = 0.01)

Arguments

Xdata

The three-way data. It can be a R object array or raw data (n individuals by three categorical variables, for an example, see museum data). When a three-way non-symmetrical variant is performed, by default, the response variable is the row variable when an array is given, or the first of three columns when a raw data set is given. For changing, consider the parameter resp = "col" or resp = "tube".

ca3type

The specification of the analysis to be performed. If ca3type = "CA3", then a three-way (symmetrical) correspondence analysis will be performed (default analysis). If ca3type = "NSCA3", then three-way non-symmetrical correspondence analysis will be performed. If ca3type = "OCA3", then ordered three-way symmetrical correspondence analysis will be performed. If ca3type = "ONSCA3", then ordered three-way non-symmetrical correspondence analysis will be performed.

resp

The input parameter for specifying in non-symmetrical three-way correspondence analysis variants (ca3type = "NSCA3" and ca3type = "ONSCA3") what is the response variable (logically antecendent to the others). By default resp = "row", but it could be the column variable resp = "col" or the tube variable resp = "tube".

norder

The input parameter for specifying the number of ordered variable when ca3type = "OCA3" or ca3type = "ONSCA3".

digits

The input parameter specifying the digital number. By default, digits = 3.

boots

The flag parameter to perform the search of optimal dimensions using bootstrap samples. By defaults, boots = FALSE.

nboots

The number of bootstrap samples to generate when boots = TRUE. Note that when boots = FALSE,
by default nboots = 0, but when boots = TRUE, by default nboots = 100.

boottype

The specification of the kind of bootstrap sampling to be performed. If boottype = "bootpsimple", then a parametric bootstrap using a simple sampling scheme will be performed (default sampling). If boottype = "bootpstrat", then a parametric bootstrap using a stratified sampling scheme will be performed. If boottype = "bootnp", then a non-parametric bootstrap using a simple sampling scheme will be performed.

resamptype

When the kind of bootstrap is parametric you can set the data distribution using the input parameter resamptype according to two distribution: resamptype=1 corresponds to multinomial distribution and resamptype=2 to Poisson distribution.

PercentageFit

Required proportion of increase in fit of a more complex model. By default, PercentageFit = 0.01.

Value

output1

Chi-square criterion and df of models on the convex hull. It gives the criterion values of the models that are located on the boundary of the convex hull and selects the optimal model by means of the scree test values (st). When using boots = FALSE, it gives the set of possible dimension combination of the original data using only the original data array. When using boots = TRUE, it gives the set of possible dimension combination of the original data using bootstrapped data arrays.

Author(s)

Rosaria Lombardo, Michel van de Velden, Eric J Beh.

References

Wilderjans T F, Ceulemans E, and Meers K (2013) CHull: A generic convex hull based model selection method. Behavior Research Methods, 45, 1-15.
Ceulemans E, and Kiers H A L (2006) Selecting among three-mode principal component models of different types and complexities: A numerical convex hull based method. British Journal of Mathematical & Statistical Psychology, 59, 133-150.

Examples

tunelocal(Xdata = happy, ca3type = "CA3")