Learn R Programming

ClustBlock (version 6.1.0)

preprocess_JAR_liking: Preprocessing JAR and Liking Data for CLUSCATA-liking

Description

Preprocesses Just-About-Right (JAR) and liking data for use with CLUSCATA-liking. JAR responses are converted into binary data, where 1 indicates a JAR response and 0 indicates a non-JAR response. The function also reshapes the JAR and liking data into the formats required by CLUSCATA-liking.

Usage

preprocess_JAR_liking(Data, nprod, nsub, liking_col,
                      levelsJAR = 3, scale = FALSE)

Value

A list containing:

  • Datafinal: combined JAR and liking data ready for CLUSCATA-liking.

  • CATA: binary JAR data in CLUSCATA format, with 1 = JAR and 0 = non-JAR.

  • liking: liking matrix with products in rows and subjects in columns.

  • JAR_binary: binary JAR data before conversion to CLUSCATA format.

  • NameSub: subject names in the order used in the analysis.

  • NameProd: product names in the order used in the analysis.

Arguments

Data

A data frame where the first column contains the subjects, the second column contains the products, and the remaining columns contain the JAR attributes and the liking variable.

nprod

Integer. Number of products.

nsub

Integer. Number of subjects.

liking_col

Character. Name of the column containing the liking scores.

levelsJAR

Integer. Number of levels of the JAR scale. Must be either 3 or 5. For a 3-level scale, level 2 is considered JAR. For a 5-level scale, level 3 is considered JAR. All other levels are considered non-JAR.

scale

Logical. Should the liking data be scaled when combining JAR and liking data? Default is FALSE.

References

Llobell, F. & Guksch, T. (2026). Beyond penalty analysis: Joint clustering of consumers using JAR and liking data. EuroSense, Oslo, Norway.

See Also

cluscata_liking

Examples

Run this code
data(croissant)

# Use a subset of 40 subjects for a faster example
subjects <- unique(croissant[[1]])[1:40]
croissant40 <- croissant[croissant[[1]] %in% subjects, ]

prepro <- preprocess_JAR_liking(
  Data = croissant40,
  nprod = 6,
  nsub = 40,
  liking_col = "OVL_Overall Liking",
  levelsJAR = 5,
  scale = FALSE
)

CATA <- prepro$CATA
liking <- prepro$liking
Data <- prepro$Datafinal

res <- cluscata_liking(
  Data,
  nblo = 40,
  NameBlocks = prepro$NameSub,
  printlevel = FALSE
)

summary(res)

plot(
  res,
  prepro$CATA,
  prepro$liking,
  scale = FALSE
)

Run the code above in your browser using DataLab