What would be the best solutions to analyse proportions of multiple classes.
The classes are mutually exclusive, with each observation falling into one of the classes (i.e. no other class is possible) and are unordered.
For example, having the following data, where observations in the same experiments are dependent (i.e. for the same Exp A+B+C = 100% in each condition)
| Percentage | Counts | Class | Group | Exp |
|---|---|---|---|---|
| 80 | 2475 | A | Control | 1 |
| 81 | 2906 | A | Control | 2 |
| 76 | 5102 | A | Control | 3 |
| 11 | 351 | B | Control | 1 |
| 11 | 405 | B | Control | 2 |
| 14 | 938 | B | Control | 3 |
| 9 | 280 | C | Control | 1 |
| 8 | 282 | C | Control | 2 |
| 10 | 639 | C | Control | 3 |
| 75 | 2380 | A | Treated | 1 |
| 76 | 2584 | A | Treated | 2 |
| 69 | 2210 | A | Treated | 3 |
| 15 | 480 | B | Treated | 1 |
| 15 | 510 | B | Treated | 2 |
| 16 | 530 | B | Treated | 3 |
| 10 | 310 | C | Treated | 1 |
| 9 | 290 | C | Treated | 2 |
| 15 | 480 | C | Treated | 3 |
prop_data <- data.frame(Percentage = c(80, 81, 76,
11, 11, 14,
9, 8, 10,
75, 76, 69,
15, 15, 16,
10, 9, 15
),
Counts = c(2475, 2906, 5102,
351, 405, 938,
280, 282, 639,
2380, 2584, 2210,
480, 510, 530,
310, 290, 480
),
Class = factor(rep(c("A", "B", "C"), each = 3)),
Group = factor(rep(c("Control", "Treated"), each = 9)),
Exp = 1:3)
I would like to see whether the proportion of A,B and C is dependent on the Group
I thought of doing something like
model <- glm(Percentage ~ Class * Group, data = prop_data, family = poisson)
I am not, however, completely sure whether this is correct. For example, I am not dealing with counts but rather with percentages (so, not integers) here. Also, should I include the experiments as a random factor (I tried using glmer but I get a singular fit)?
I have also considered using a multinomial model but am not quite sure how to set it up.
EDIT:
I have added raw counts to the R code, as suggested in the comments
Classlabels in your original table don't agree with the annotations of thePercentagelines in your construction ofprop_data, but they do agree with the way theClassvalues are set up inClass=factor(rep(c("A", "B", "C"), 3)). To line up instead with the annotations of thePercentagevalues, you would needClass=factor(rep(c("A", "B", "C"), each=3)). Which do you want? Makes a big difference in the results. – EdM Sep 18 '22 at 17:13GroupandExp. I think that what you intend is forClassto be a multinomial outcome, but your example data aren't consistent with that. Why not show the real data? – EdM Sep 19 '22 at 12:31Classvalues "A," "B," and "C," (like one is preferable to the next etc.) or are they simply 3 potential outcome classes without any order? As the answer depends on that, please edit the question to provide that information; comments are easy to overlook and can be deleted. – EdM Sep 19 '22 at 14:24