1
$\begingroup$

I have three categorical variables that describe each item, and I know how many items I have for each combination of a pair of variables. I am looking to find out exactly how many items I have for each specific combination of the three variables.

For example: The variables are Colour (Red, Blue), Shape (Circle, Square), and Size (Large, Medium, Small). I know how the Shape is broken down into colours: how many red circles there are and how many blue ones, as well as the number of squares in different colours. I know the same for all other pairs of variables – Size & Shape, and Colour & Size.

Based on this existing data, how do I figure out how many items are in each Colour, Shape and Size combination? Is it even possible to answer this question?

Any pointers will help!

$\endgroup$

1 Answer 1

1
$\begingroup$

In general it is not possible to find the individual counts without additional information. It is possible for different combinations of the 3-characteristic items to give the same 2-way summaries.

For example, here are two datasets with X1 as either Red or Blue, X2 as either Circle or Square, and X3 as either Large or Medium (no small). The first dataset has 8 elements, one of each combination: RCL, RCM, RSL, etc. The second dataset only has 4 of the possible combinations, with each one repeated twice, yet it still has the same 2-way counts.

dat1 <- data.frame(
  X1 = factor(c("R", "R", "R", "R", "B", "B", "B", "B")),
  X2 = factor(c("C", "C", "S", "S", "C", "C", "S", "S")),
  X3 = factor(c("L", "M", "L", "M", "L", "M", "L", "M")))
dat2 <- data.frame(
  X1 = factor(c("R", "R", "R", "R", "B", "B", "B", "B")),
  X2 = factor(c("C", "C", "S", "S", "C", "C", "S", "S")),
  X3 = factor(c("L", "L", "M", "M", "M", "M", "L", "L")))
# One of every combination
table(dat1$X1, dat1$X2)
#>     C S
#>   B 2 2
#>   R 2 2
table(dat1$X1, dat1$X3)
#>     L M
#>   B 2 2
#>   R 2 2
table(dat1$X2, dat1$X3)
#>     L M
#>   C 2 2
#>   S 2 2

# There is no RCM, RSL, BCL, or BSM
table(dat2$X1, dat2$X2)
#>     C S
#>   B 2 2
#>   R 2 2
table(dat2$X1, dat2$X3)
#>     L M
#>   B 2 2
#>   R 2 2
table(dat2$X2, dat2$X3)
#>     L M
#>   C 2 2
#>   S 2 2
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.