0
$\begingroup$

I have many data frames like the one reproduced below in R. I am trying to find cases where one group only is very different from the other groups (I have a variable number of groups for the different data frames). I have tried with ANOVA, but this test only tells me if the group means are different from each other, and almost all are, but what I am looking for is either a test or a measure that can point to whether each individual with one measure per group varies a lot by one group more than the others, some kind of across individual variability. Maybe I can try with repeated measures ANOVA with unbalanced data (I have missing values)? Is this the right way to do this?

df = structure(list(groups = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("group1", "group2", "group3"), class = "factor"), individuals = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L), .Label = c("sample1", "sample2", "sample3", "sample4", "sample5", "sample6", "sample7", "sample8", "sample9", "sample10", "sample11", "sample12", "sample13", "sample14", "sample15", "sample16", "sample17", "sample18", "sample19", "sample20", "sample21", "sample22", "sample23", "sample24", "sample25", "sample26", "sample27", "sample28", "sample29", "sample30", "sample31", "sample32", "sample33", "sample34"), class = "factor"), value = c(0, 0.126889234269648, 0.0568617212177722, 0.0655431535336275, 0, 0, 0.0567384158931187, 0.0109376655462734, 0, 0.0948086895930572, 0, 0, 0.0824709304159648, 0, 0, 0, 0, 0, 0.033917835818341, 0.0198035710833954, 0.133552284941515, 0.0664567537955113, 0.0430308231270825, 0.0160783942164045, 0.0738182676544177, 0.120422772617204, 0.135233112827437, 0.0860623347815552, 0.0200020675534846, 0, 0.0973088048201884, 0, 0, 0.038283321330165, 0.225376778959931, 0.137536577951645, 0.426342384989027, 0, 0.337720200488891, 0.384254666977513, 0.0108438100713879, 0.278754009620225, 0.381097277894091, 0.154981762820021, 0.0864810371628134, 0.218313535529244, 0.202077489447883, 0.117036020922844, 0.129779767219537, 0, 0.559959304303877, 0.240102470306958, 0.252798090888197, 0.100823988780093, 0.126391112137011, 0.108138613814024, 0.0692924355684719, 0.459841817208745, 0.138288519068394, 0.113182370152051, 0.0525657185927877, 0.177169361598713, 0.355934492361351, 0.186605323013182, 0.148750791970728, 0, 0.155418848968847, 0.0600295032575727, 0.774623221040069, 0.735574187778708, 0.5167958937932, 0.934456846466373, 0.662279799511109, 0.615745333022487, 0.932417774035493, 0.710308324833502, 0.618902722105909, 0.750209547586922, 0.913518962837187, 0.781686464470756, 0.715451580136152, 0.882963979077156, 0.870220232780463, 1, 0.440040695696123, 0.759897529693041, 0.713284073293462, 0.879372440136512, 0.740056602921473, 0.825404632390465, 0.887676741304446, 0.524079788574851, 0.787893213277188, 0.766394857230745, 0.812201168579775, 0.736768303619732, 0.624063440085165, 0.813394676986818, 0.720479745676339, 1, 0.786220846027069, 0.901687175412262)), .Names = c("groups", "individuals", "value"), row.names = c(2L, 6L, 10L, 14L, 18L, 22L, 26L, 30L, 34L, 38L, 42L, 46L, 50L, 54L, 58L, 62L, 66L, 70L, 74L, 78L, 82L, 86L, 90L, 94L, 98L, 102L, 106L, 110L, 114L, 118L, 122L, 126L, 130L, 134L, 1L, 5L, 9L, 13L, 17L, 21L, 25L, 29L, 33L, 37L, 41L, 45L, 49L, 53L, 57L, 61L, 65L, 69L, 73L, 77L, 81L, 85L, 89L, 93L, 97L, 101L, 105L, 109L, 113L, 117L, 121L, 125L, 129L, 133L, 3L, 7L, 11L, 15L, 19L, 23L, 27L, 31L, 35L, 39L, 43L, 47L, 51L, 55L, 59L, 63L, 67L, 71L, 75L, 79L, 83L, 87L, 91L, 95L, 99L, 103L, 107L, 111L, 115L, 119L, 123L, 127L, 131L, 135L), class = "data.frame")

Any help is very much appreciated! Thanks in advance, Francesca

$\endgroup$
  • $\begingroup$ Could you clarify: "...whether each individual with one measure per group varies a lot by one group more than the others, some kind of across individual variability." $\endgroup$ – rolando2 Jan 4 '15 at 17:07
  • $\begingroup$ Hi Rolando, sorry for the unclear statement, I would like to know whether there is one group mean that is significantly different from the others, something like what Joshua suggested but I don't think this works because I need to account for the repeated measurements on the same individuals and I cannot assume a linear model (so I can't use ANOVA and neither mixed models). If I just use this TukeyHSD(aov(value~groups, data=df)) the p-values are significant for group2 against 3, which is not what the plot shows: plot(value ~ groups, data=df).. $\endgroup$ – Francesca Jan 5 '15 at 11:28
1
$\begingroup$

Check out post-hoc comparisons (Tukey's HSD is one): http://www.statmethods.net/stats/anova.html

$\endgroup$
  • $\begingroup$ Thanks very much Joshua, I didn't know about the Turkey's HSD method, but it is not working with either of the ANOVA approaches I am trying probably because I am confused about the initial ANOVA model.. If I use this: TukeyHSD(aov(value~groups*individuals, data=df)) I get all NaN, or if I use this: TukeyHSD(aov(value~groups+Error(individuals/groups)), data=df) I get an erorr message.. Am I missing something in the ANOVA model maybe? thanks v much for your help! $\endgroup$ – Francesca Jan 4 '15 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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