mrCA: Multiple-response Correspondence Analysis (MR-CA)

View source: R/mrCA.R

mrCAR Documentation

Multiple-response Correspondence Analysis (MR-CA)

Description

This functions performs a multiple-response Correspondence Analysis (MR-CA) as defined in Mahieu, Schlich, Visalli, and Cardot (2021)

Usage

mrCA(
  data,
  proj.row = NULL,
  proj.row.obs = NULL,
  proj.col = NULL,
  ellipse = FALSE,
  nboot = 2000,
  nbaxes.sig = Inf
)

Arguments

data

A data.frame of observations in rows whose first column is a factor (the categories) and subsequent columns are binary numeric or integer, each column being a response option

proj.row

Optional. A contingency table with new categories to be projected as supplementary rows within the MR-CA space in rows and the same response options as data in columns

proj.row.obs

A numeric vector whose length equals nrow(proj.row) and giving the number of observations within each projected rows. Useless if proj.row=NULL

proj.col

Optional. A contingency table with new response options to be projected as supplementary columns within the MR-CA space in columns and the same categories as data in rows

ellipse

Logical. Are confidence ellipses for the categories to be computed? Default is FALSE. See details

nboot

Number of virtual datasets used in the total bootsrap procedure. Useless when ellipse=FALSE. See details

nbaxes.sig

The number of significant axes retuned by mr.dimensionality.test. By default, all axes are considered significant. Useless when ellipse=FALSE. See details

Details

  • ellipse: When ellipse=TRUE, confidence ellipses for the categories are computed using a total bootstrap procedure (Cadoret & Husson, 2013). nboot virtual datasets are generated by randomly sampling with replacement response vectors within each category. A MR-CA is then performed on these virtual dataset and the resulting virtual configurations are adjusted to the actual configuration using Procrustes rotations accounting for nbaxes.sig axes (Mahieu, Schlich, Visalli, & Cardot, 2021). Finally, for each category, a confidence ellipse is constructed using the position of its bootstrap replicates. The ellipses are plotted when using plot.mrCA Pairwise total bootstrap tests as proposed in Castura et al. (2023) are also performed between the categories.

Value

A list with the following elements:

eigen

Eigenvalues and their corresponding percentages of inertia

row.coord

Rows coordinates

col.coord

Columns coordinates

proj.row.coord

Projected rows coordinates

proj.col.coord

Projected columns coordinates

svd

Results of the singular value decomposition

bootstrap.replicate.coord

Coordinates of the rotated bootstrap replicates

total.bootstrap.test.pvalues

P-values of the pairwise total bootstrap tests

References

Mahieu, B., Schlich, P., Visalli, M., & Cardot, H. (2021). A multiple-response chi-square framework for the analysis of Free-Comment and Check-All-That-Apply data. Food Quality and Preference, 93.

Loughin, T. M., & Scherer, P. N. (1998). Testing for Association in Contingency Tables with Multiple Column Responses. Biometrics, 54(2), 630-637.

Cadoret, M., & Husson, F. (2013). Construction and evaluation of confidence ellipses applied at sensory data. Food Quality and Preference, 28(1), 106-115.

Castura, J. C., Varela, P., & Næs, T. (2023). Evaluation of complementary numerical and visual approaches for investigating pairwise comparisons after principal component analysis. Food Quality and Preference, 107.

Examples

nb.obs=200
nb.response=5
nb.category=5
vec.category=paste("C",1:nb.category,sep="")
right=matrix(rbinom(nb.response*nb.obs,1,0.25),nb.obs,nb.response)
category=sample(vec.category,nb.obs,replace = TRUE)
dset=cbind.data.frame(category,right)
dset$category=as.factor(dset$category)

res=mrCA(dset)

plot(res)

MahieuB/MultiResponseR documentation built on June 22, 2024, 8:08 a.m.