0
$\begingroup$

I have the following data and am really unsure how to analyse it. The actual scenario would take too long to explain so this is an analogous example:

Two groups of participants (n = 8) are asked to roll a die 60 times (each participant rolls 60 times) and record how many of each number they roll. The relative proportions of each number for each participant are then averaged for each of the two groups so we have something like:

GROUP 1 
Number  Av.f
 1. 10
 2. 10
 3. 10
 4. 10
 5. 10
 6. 10

GROUP 2
Number  Av.f
 1. 15
 2. 15
 3. 15
 4. 5
 5. 5
 6. 5

I understand that if these were simple frequencies, then I could use chi-square, but these are averages of frequencies with variance. At the same time, I can't use ANOVA because the means are not independent from one another. (If I know the mean frequency of 5 of the numbers, I can determine the mean of the 6th.) Even if I would analyse just 5 of the 6, this wouldn't help unless ANOVA would somehow know what the total should be.

Does anyone know of a test which would allow me to see whether the two groups differ in the distribution of die rolls?

Thank you very much!! Melissa

$\endgroup$
2
  • $\begingroup$ If you multiply each average by 8, do you get total numbers of times each face comes up? $\endgroup$
    – Henry
    Commented Oct 21, 2011 at 17:32
  • $\begingroup$ Yes, that would be the case. However, I'm not happy about collapsing across participants and trials at the same time because I'm not sure how to treat a variable which is a mixture of within- and between-measures. Obviously with dice, it doesn't matter who throws it, but in our case it is a variable which could conceivably have reliable individual differences (it involves choice rather than pure chance). $\endgroup$
    – Melissa
    Commented Oct 21, 2011 at 18:47

2 Answers 2

1
$\begingroup$

At the extreme of fanciness, you could fit a generalized linear mixed model, with a random effect accounting for possible differences among individuals within each group.

You could also consider doing a permutation test, though with some potential loss of power: just do the $\chi^2$ test based on collapsing the individuals between the groups, put compare the observed statistic to the values you get after permuting the individuals between the two groups.

Here's some R code, simulating data like you mention:

x <- matrix(sample(1:6, 60*8, repl=TRUE), nrow=8)
x <- apply(x, 1, function(a) table(factor(a, levels=1:6)))

p <- rep(c(15,5), each=3)
p <- p/sum(p)
y <- matrix(sample(1:6, 60*8, prob=p,repl=TRUE), nrow=8)
y <- apply(y, 1, function(a) table(factor(a, levels=1:6)))

combined <- cbind(x, y)
ttt <- rep(c(0,1), each=8)

And here's my suggested permutation analysis:

combtab <- cbind(rowSums(combined[,ttt==0]),
                 rowSums(combined[,ttt==1]))
obs <- chisq.test(combtab)$stat

n.perm <- 1000
permres <- 1:n.perm
for(i in 1:n.perm) {
    pttt <- sample(ttt)
    pcombtab <- cbind(rowSums(combined[,pttt==0]),
                      rowSums(combined[,pttt==1]))
    permres[i] <- chisq.test(pcombtab)$stat
}

# p-value
mean(permres >= obs)
$\endgroup$
1
  • $\begingroup$ Karl, Thanks for your excellent reply. I'll see whether I can get your first suggestion to work. As I mentioned in my reply to Henry (above), I'm reluctant to collapse across participants as in this case (unlike with dice rolls), the outcomes could well vary from person to person. $\endgroup$
    – Melissa
    Commented Oct 21, 2011 at 21:22
0
$\begingroup$

What about a multinomial log linear model? There's an implementation in nnet in R. Pinching Karl's simulated data but putting it in a different format:

> x <- sample(1:6, 60*8, repl=TRUE)
> p <- rep(c(15,5), each=3)
> p <- p/sum(p)
> y <- sample(1:6, 60*8, prob=p,repl=TRUE)
> Group <- rep(c("A", "B"), c(60*8,60*8))
> Individual <- factor(rep(1:16, 60))
> mydata <- data.frame(toss=c(x,y), Group, Individual)
> library(nnet)
> model1 <- multinom(toss~Individual+Group, data=mydata)
# weights:  108 (85 variable)
initial  value 1720.089090 
iter  10 value 1628.046281
iter  20 value 1611.722206
iter  30 value 1611.629517
iter  40 value 1611.582204
iter  50 value 1611.576563
final  value 1611.576175 
converged
> model2 <- multinom(toss~Individual, data=mydata)
# weights:  102 (80 variable)
initial  value 1720.089090 
iter  10 value 1641.384242
iter  20 value 1639.327045
iter  30 value 1639.186208
iter  40 value 1639.168971
final  value 1639.166848 
converged
> anova(model1, model2)
Likelihood ratio tests of Multinomial Models

Response: toss
               Model Resid. df Resid. Dev   Test    Df LR stat.   Pr(Chi)
1         Individual      4720       3278                                
2 Individual + Group      4715       3223 1 vs 2     5    55.18 1.198e-10
$\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.