# Interpreting residuals in chi-squared test

Newbie statistician looking for help...

I'm trying to determine whether birds in two different area have different diets, based on 8 categories of food items. Running a chi-squared test in R (using chisq.test()) gets me a beautiful, tiny p-value, indicating diet is indeed different between these areas. But I'd like to know how, exactly, they're different. I pulled the standardized residuals from the test using stdres which gets me this:

 corvid      grouse    thrush    mammal   squirrel   unknown       bird       hare
tz  2.065822  0.05288435 -2.659504  2.464809  0.3361617 -1.785988  0.4370721  0.8356943
cs -2.065822 -0.05288435  2.659504 -2.464809 -0.3361617  1.785988 -0.4370721 -0.8356943


First of all, is this the correct way to pinpoint which categories differ between the groups? And, in very plain and applied language, how do I interpret these residuals? Is it accurate, for example, to say that birds in the tz area consume many more corvids than expected? Can I safely say there is no significant difference in the amount of squirrels consumed between the two area? There doesn't seem to be a lot of material about using residuals with chi-squared tests and what's out there uses more technical language like which category "contributes most" which isn't super helpful when I'm trying to make a concrete ecological statement.

Edit to clarify what is being counted: my birds are carnivorous raptors, so each count represents a prey item (like one squirrel or one thrush) eaten by some bird in that zone. Each bird can belong to only one zone, but each bird can consume any number of different prey items. The original dataset looks like this:

   corvid grouse thrush mammal squirrel unknown bird hare
tz     12      6     36     50      248      36   21    2
cs      0      2     24      7       84      20    6    0


p.s. I know the counts for some categories are a bit small, this is just a preliminary look and more data are coming :)

• Difficult to explain this clearly without the $2\times 8$ contingency table of counts you used as input to chisq.test. Can you add it to your question? – BruceET Nov 11 '20 at 11:04
• Can you clarify what it is that you are counting? Do you have individual birds that you categorize as “this bird comes from area tz” and “has a diet which consists exclysively of corvid”? Or is it possible that the same bird can have a diet which includes both “corvid” and “mammal”, say? Also, you mentioned “amounts of squirrel” consumed by a bird - can you elaborate more on what you mean by that? The “type of diet” (e.g., corvid, mammal) is quite different from the “amount of diet”. Does your research question involved “type” or “amount” of diet? – Isabella Ghement Nov 11 '20 at 14:00
• Type of diet doesn't really make sense in this context because diet is diverse and overlap is high. ie, no population eats just squirrels or just thrushes, so you can't say there is a squirrel-type diet or a thrush-type diet. I'm interested in whether the population of one area eats, say, more thrushes and less squirrels than the other area, which could be phrased as amount, though perhaps percent or proportion would be more accurate. Hope that clarifies! – user302385 Nov 12 '20 at 17:31