Title: Analysis of Data from Multiple-Response Questionnaires
Version: 1.4.1
Description: Provides a multiple-response chi-square framework for the analysis of contingency tables arising from multiple-response questionnaires, such as check-all-that-apply tasks, where response options are crossed with a known grouping factor. The framework accommodates within-block (e.g., within-subject) designs, as commonly encountered in sensory evaluation. It comprises a multiple-response chi-square test of homogeneity with an associated dimensionality test, a multiple-response Correspondence Analysis (CA), and per-cell multiple-response hypergeometric tests. These methods extend their classical counterparts by grounding inference in a null model that properly accounts for the multiple-response nature of the data, treating evaluations, rather than individual citations, as the experimental units, yielding more statistically valid conclusions than standard contingency table analyses. Details may be found in Mahieu, Schlich, Visalli, and Cardot (2021). <doi:10.1016/j.foodqual.2021.104256>.
License: GPL (≥ 3)
Encoding: UTF-8
LazyData: false
RoxygenNote: 7.3.3
Depends: R (≥ 4.5.0)
Imports: flextable, officer, ggplot2, ggrepel, ellipse, stats, utils
NeedsCompilation: no
Packaged: 2026-03-18 13:46:29 UTC; benjamin.mahieu
Author: Benjamin Mahieu [aut, cre]
Maintainer: Benjamin Mahieu <benjamin.mahieu@oniris-nantes.fr>
Repository: CRAN
Date/Publication: 2026-03-23 09:40:12 UTC

MultiResponseR: Analysis of Data from Multiple-Response Questionnaires

Description

Provides a multiple-response chi-square framework for the analysis of contingency tables arising from multiple-response questionnaires, such as check-all-that-apply tasks, where response options are crossed with a known grouping factor. The framework accommodates within-block (e.g., within-subject) designs, as commonly encountered in sensory evaluation. It comprises a multiple-response chi-square test of homogeneity with an associated dimensionality test, a multiple-response Correspondence Analysis (CA), and per-cell multiple-response hypergeometric tests. These methods extend their classical counterparts by grounding inference in a null model that properly accounts for the multiple-response nature of the data, treating evaluations, rather than individual citations, as the experimental units, yielding more statistically valid conclusions than standard contingency table analyses. Details may be found in Mahieu, Schlich, Visalli, and Cardot (2021). doi:10.1016/j.foodqual.2021.104256.

Author(s)

Maintainer: Benjamin Mahieu benjamin.mahieu@oniris-nantes.fr

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.

See Also

mr.chisq.test

mr.dimensionality.test

mr.sig.cell

mrCA

sensory.mr.dimensionality.test

sensory.mr.sig.cell

sensory.mrCA


Check-All-That-Apply data

Description

Data coming from a Check-All-That-Apply experiment on milk chocolates. This dataset corresponds to the flavor data used as examples and described more precisely in Mahieu, Schlich, Visalli, and Cardot (2021)

Usage

data(milkchoc)

Format

An object of class data.frame with 280 rows and 8 columns.

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.

Examples

data(milkchoc)

Multiple-response chi-square test

Description

Performs a multiple-response chi-square test as defined in Loughin and Scherer (1998) using random permutations to estimate the null distribution.

Usage

mr.chisq.test(data, nperm = 300)

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.

nperm

Number of permuted datasets to estimate the distribution of the statistic under the null hypothesis. See details.

Details

Value

A list with the following elements:

statistic

Observed multiple-response chi-square statistic

p.value

p-value of the test

References

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

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.

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)


mr.chisq.test(dset)

Multiple-response dimensionality test

Description

Performs a multiple-response dimensionality test as defined in Mahieu, Schlich, Visalli, and Cardot (2021) using random permutations to estimate the null distribution.

Usage

mr.dimensionality.test(data, nperm = 300, alpha = 0.05)

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.

nperm

Number of permuted datasets to estimate the distribution of the statistic under the null hypothesis. See details.

alpha

The alpha risk of the test

Details

Value

A list with the following elements:

dim.sig

The number of significant dimensions

statistics

Observed multiple-response chi-square statistic of each dimension

p.values

P-value of the test of each dimension adjusted for closed testing procedure

References

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

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.

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)


mr.dimensionality.test(dset)


Multiple-response tests per cell

Description

This function performs for each pair of category and response option a multiple-response hypergeometric test as defined in Mahieu, Schlich, Visalli, and Cardot (2021) using random hypergeometric samplings to estimate the null distribution.

Usage

mr.sig.cell(data, nsample = 300, nbaxes.sig = Inf, two.sided = TRUE)

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.

nsample

Number of randomly sampled datasets to estimate the distribution of the value under the null hypothesis. See details

nbaxes.sig

The number of significant axes retuned by mr.dimensionality.test. By default, all axes are considered significant. See details.

two.sided

Logical. Should the tests be two-sided or not?

Details

Value

A list with the following elements:

original.cont

Observed number of times each category chosen each response option

percent.cont

Within each category, percentage of observations where the response options were chosen

null.cont

Expected number of times each category chosen each response option under the null hypothesis

p.values

P-values of the tests per cell fdr adjusted by response option

derived.cont

The derived contingency table corresponding to nbaxes.sig axes

percent.derived.cont

Within each category, percentage of observations where the response options were chosen in the derived contingency table corresponding to nbaxes.sig axes

References

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

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.

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=mr.sig.cell(dset)

plot(res)

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 = 300,
  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

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)

Plot significant cells

Description

This function plots the results coming from mr.sig.cell.

Usage

## S3 method for class 'mr.sig.cell'
plot(
  x,
  alpha.1 = 0.05,
  alpha.2 = 0,
  choice = "percent.derived.cont",
  col.greater.1 = "green3",
  col.lower.1 = "orangered",
  col.greater.2 = "lightgreen",
  col.lower.2 = "lightsalmon",
  ...
)

Arguments

x

A list returned by mr.sig.cell.

alpha.1

The alpha risk to consider the tests as significant.

alpha.2

The alpha risk to consider the tests as showing a trend. If trends are not to be considered, alpha.2 can be set to 0 (Default).

choice

Which table from res should be plotted? Default is percent.derived.cont.

col.greater.1

The color used to highlight significant positive associations.

col.lower.1

The color used to highlight significant negative associations.

col.greater.2

The color used to highlight positive associations showing a trend.

col.lower.2

The color used to highlight negative associations showing a trend.

...

further arguments passed to or from other methods.

Value

A table with cells highlighted.

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=mr.sig.cell(dset)

plot(res)

Plot factor plan resulting from multiple-response Correspondence Analysis (MR-CA).

Description

This function plots the results coming from mrCA.

Usage

## S3 method for class 'mrCA'
plot(
  x,
  axes = c(1, 2),
  alpha.total.bootstrap.test = 0.05,
  alpha.ellipse = alpha.total.bootstrap.test,
  select.rep = rownames(x$col.coord),
  rev.x = FALSE,
  rev.y = FALSE,
  size.points = 3.5,
  size.lab = 6,
  size.head.arrow = 0.4,
  expansion = 1.25,
  title = NULL,
  ...
)

Arguments

x

A list returned by mrCA.

axes

Which dimensions of the MR-CA should be plotted?

alpha.total.bootstrap.test

The alpha risk of the total bootstrap tests. Only useful if the MR-CA was computed using mrCA and ellipse=TRUE. See details.

alpha.ellipse

The alpha risk of the confidence ellipses. Only useful if the MR-CA was computed using mrCA and ellipse=TRUE.

select.rep

A character vector specifying the response options to plot. By default, all response options are plotted.

rev.x

Should the horizontal plotted dimension be reversed? Useful in case of map comparisons to align categories.

rev.y

Should the vertical plotted dimension be reversed? Useful in case of map comparisons to align categories.

size.points

The size of the points used to represent the categories on the map.

size.lab

The size of the label on the map.

size.head.arrow

The size of the head of the arrows used to represent the response options on the map.

expansion

The factor of expansion applied to response options coordinates to increase readability.

title

An optional title to be added to the plot.

...

further arguments passed to or from other methods.

Details

Value

A MR-CA factor map.

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)

Plot significant cells

Description

This function plots the results coming from sensory.mr.sig.cell.

Usage

## S3 method for class 'sensory.mr.sig.cell'
plot(
  x,
  alpha.1 = 0.05,
  alpha.2 = 0,
  choice = "percent.derived.cont",
  col.greater.1 = "green3",
  col.lower.1 = "orangered",
  col.greater.2 = "lightgreen",
  col.lower.2 = "lightsalmon",
  ...
)

Arguments

x

A list returned by sensory.mr.sig.cell.

alpha.1

The alpha risk to consider the tests as significant.

alpha.2

The alpha risk to consider the tests as showing a trend. If trends are not to be considered, alpha.2 can be set to 0 (Default).

choice

Which table from res should be plotted? Default is percent.derived.cont.

col.greater.1

The color used to highlight significant positive associations.

col.lower.1

The color used to highlight significant negative associations.

col.greater.2

The color used to highlight positive associations showing a trend.

col.lower.2

The color used to highlight negative associations showing a trend.

...

further arguments passed to or from other methods.

Value

A table with cells highlighted.

Examples

data(milkchoc)

dim.sig=sensory.mr.dimensionality.test(milkchoc)$dim.sig

res=sensory.mr.sig.cell(milkchoc,nbaxes.sig=dim.sig)

plot(res)

Plot factor plan resulting from multiple-response Correspondence Analysis (MR-CA) applied on sensory data

Description

This function plots the results coming from sensory.mrCA.

Usage

## S3 method for class 'sensory.mrCA'
plot(
  x,
  axes = c(1, 2),
  alpha.total.bootstrap.test = 0.05,
  alpha.ellipse = alpha.total.bootstrap.test,
  select.desc = rownames(x$desc.coord),
  rev.x = FALSE,
  rev.y = FALSE,
  size.points = 3.5,
  size.lab = 6,
  size.head.arrow = 0.4,
  expansion = 1.25,
  title = NULL,
  ...
)

Arguments

x

A list returned by sensory.mrCA.

axes

Which dimensions of the MR-CA should be plotted?

alpha.total.bootstrap.test

The alpha risk of the total bootstrap tests. See details.

alpha.ellipse

The alpha risk of the confidence ellipses.

select.desc

A character vector specifying the descriptors to plot. By default, all descriptors are plotted.

rev.x

Should the horizontal plotted dimension be reversed? Useful in case of map comparisons to align products.

rev.y

Should the vertical plotted dimension be reversed? Useful in case of map comparisons to align products.

size.points

The size of the points used to represent the products on the map.

size.lab

The size of the label on the map.

size.head.arrow

The size of the head of the arrows used to represent the descriptors on the map.

expansion

The factor of expansion applied to descriptors coordinates to increase readability.

title

An optional title to be added to the plot.

...

further arguments passed to or from other methods.

Details

Value

A MR-CA factor map

Examples

data(milkchoc)

dim.sig=sensory.mr.dimensionality.test(milkchoc)$dim.sig

res=sensory.mrCA(milkchoc,nbaxes.sig=dim.sig)

plot(res)

Multiple-response dimensionality test for sensory data

Description

Performs a multiple-response dimensionality test as defined in Mahieu, Schlich, Visalli, and Cardot (2021) using random permutations to estimate the null distribution. The difference with mr.dimensionality.test is that random permutations are performed within subjects rather than along all evaluations.

Usage

sensory.mr.dimensionality.test(data, nperm = 300, alpha = 0.05)

Arguments

data

A data.frame of evaluations in rows whose first two columns are factors (subject and product) and subsequent columns are binary numeric or integer, each column being a descriptor.

nperm

Number of permuted datasets to estimate the distribution of the statistic under the null hypothesis. See details.

alpha

The alpha risk of the test.

Details

Value

A list with the following elements:

dim.sig

The number of significant dimensions

statistics

Observed multiple-response chi-square statistic of each dimension

p.values

P-value of the test of each dimension adjusted for closed testing procedure

References

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

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.

Examples

data(milkchoc)

sensory.mr.dimensionality.test(milkchoc)

Multiple-response tests per cell for sensory data

Description

This function performs for each pair of product and descriptor a multiple-response hypergeometric test as defined in Mahieu, Schlich, Visalli, and Cardot (2021) using random hypergeometric samplings to estimate the null distribution. The difference with mr.sig.cell is that random hypergeometric samplings are performed within subjects in sensory.mr.sig.cell.

Usage

sensory.mr.sig.cell(data, nsample = 300, nbaxes.sig = Inf, two.sided = TRUE)

Arguments

data

A data.frame of evaluations in rows whose first two columns are factors (subject and product) and subsequent columns are binary numeric or integer, each column being a descriptor.

nsample

Number of randomly sampled datasets to estimate the distribution of the value under the null hypothesis. See details.

nbaxes.sig

The number of significant axes retuned by sensory.mr.dimensionality.test. By default, all axes are considered significant. See details.

two.sided

Logical. Should the tests be two-sided or not?

Details

Value

A list with the following elements:

original.cont

Observed number of times each product was described by each descriptor

percent.cont

For each product, percentage of evaluations where each descriptor was cited for this product

null.cont

Expected number of times each product was described by each descriptor under the null hypothesis

p.values

P-values of the tests per cell fdr adjusted by descriptor

derived.cont

The derived contingency table corresponding to nbaxes.sig axes

percent.derived.cont

For each product, percentage of evaluations where each descriptor was cited for this product in the derived contingency table corresponding to nbaxes.sig axes

References

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

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.

Examples

data(milkchoc)

dim.sig=sensory.mr.dimensionality.test(milkchoc)$dim.sig

res=sensory.mr.sig.cell(milkchoc,nbaxes.sig=dim.sig)

plot(res)

Multiple-response Correspondence Analysis (MR-CA) for sensory data

Description

This function performs the MR-CA of the data as well as the total bootstrap procedure (Cadoret & Husson, 2013) and the pairwise total bootstrap tests as proposed in Castura et al. (2023). The difference with mrCA used with ellipse=TRUE is that the total bootstrap procedure is stratified with respect to subjects in sensory.mrCA.

Usage

sensory.mrCA(data, nboot = 300, nbaxes.sig = Inf)

Arguments

data

A data.frame of evaluations in rows whose first two columns are factors (subject and product) and subsequent columns are binary numeric or integer, each column being a descriptor.

nboot

The number of bootstrapped panel of the total bootstrap procedure.

nbaxes.sig

The number of significant axes returned by sensory.mr.dimensionality.test. By default, all axes are considered significant. See details.

Details

Value

A list with the following elements:

eigen

Eigenvalues of the MR-CA and their corresponding percentages of inertia

prod.coord

Products coordinates

desc.coord

Descriptors 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

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.

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.

Examples


data(milkchoc)

dim.sig=sensory.mr.dimensionality.test(milkchoc)$dim.sig

res=sensory.mrCA(milkchoc,nbaxes.sig=dim.sig)

plot(res)