# Using chi square on unequal groups with unequal repeated trials

My dataset includes four groups (A, B, C, D) of unequal numbers of individuals. Each individual engages in an activity that results in one of three categorical outcomes (X, Y, Z). The individuals repeated this activity multiple times, with the total number of trials varying across individuals. That is, everyone has counts of X, Y, and Z, but counts vary across individuals, as does the sum of X+Y+Z.

I was planning to a run a test of independence on this data, comparing group (A, B, C, D) by outcome (X, Y, Z). In doing so, I originally, sought to account for the varying number of individuals per group by setting probabilities (argument p within chisq.test in R) based on the relative group sizes.

However, I'm unsure if the above is appropriate. The frequencies used for analysis are not actually counts of the number of individuals per group that experienced each outcome. Rather, the frequencies reflect the total number of trials across all individuals within that group that resulted in each outcome.

More, even if appropriate, I'm now unsure if this is possible. Can one set expected probabilities for one variable when conducting a test of independence between two variables? Or is setting expected probabilities only possible for comparing observations in a goodness of fit test? In which case, I could conceivably compare groups A, B, C, and D in three separate tests (one per outcome X, Y, and Z).

In turn, I am wondering:

1) Is it possible and appropriate to run a single test of independence in this scenario or instead three separate tests (one per outcome) to compare groups?

2) In either case is there a means to separately account for both the variability in group size and the variability in trials?

3) Do either of these variabilities even need to be accounted for, considering chi square tests are non-parametric, and unequal sample sizes are thought to be a non-issue?

4) Alternatively, is there a different predictive test that can be used in this scenario? Logistic regression, notably, would require require a continuous predictor (rather than nominal groups).

Thanks your guidance, technical and conceptual.

• You say that individuals repeated this activity for multiple times, does that mean that you have repeated measures, that is each individual was measured multiple times? – user2974951 Feb 19 at 8:13
• Correct. Each individual was measured across multiple trials. The total number of trials/measures varied across individuals (based on the number they could complete within a set amount of time). First paragraph now updated to better clarify. Thanks! – jjcii Feb 20 at 0:53