Test for whether two data sets are significantly different There are 1400 red snails, 800 blue snails, and 500 green snails.
There are three parks: Park A, Park B and Park C
I find that
- 800 red snails live in Park A , 200 red snails live in Park B and 400 red snails in Park C.
- 100 blue snails live in Park A , 600 blue snails live in Park B and 100 blue snails in Park C.
- 400 green snails live in Park A , 50 green snails live in Park B and 50 green snails in Park C.
How would I show that the proportion of coloured snails that go to different Parks is statistically significantly different. I can work out the proportion of snails that go to each park but I want to be able to say with statistical confidence that their proportions are different. How would I do that with this example above?
 A: This can be approached like a chi square test of homogeneity. You want to see if there are differences from a theoretical uniform distribution across parks in the counts of snails coming from different populations or groups (colors). The margins of the tabulated data are considered random variables, and used to cross multiply and get the expected counts in each cell.
Here is your tabulated data with actual and expected counts:
> addmargins(round(snails, 0))
       park
snails     A   B   C  Sum
  red    800 200 400 1400
  blue   100 600 100  800
  green  400  50  50  500
  Sum   1300 850 550 2700
> addmargins(round(chisq.test(snails)$expected,0))
       park
snails     A   B   C  Sum
  red    674 441 285 1400
  blue   385 252 163  800
  green  241 157 102  500
  Sum   1300 850 550 2700

The chi square test can be run in R as follows:
chisq.test(snails)

    Pearson's Chi-squared test

data:  snails
X-squared = 1123, df = 4, p-value < 2.2e-16

So there is evidence that the distribution of the different snail types across parks is not homogeneous.
Here is some plotting of the results and standardized residuals:

Perhaps the most interesting part of your question is to discuss what to do with the results of an omnibus test on a larger than $2 \times 2$ contingency table. On this the jury is still out (amazingly) - on this you can check this very helpful reference. But the residuals, or standardized residuals are a start, and you can find them graphically plotted, and color coded. A lot of conclusions can be drawn from looking at the residuals mosaic plot, and after all, it seems like at least some authors are still condoning some post-chi "eye-balling."
On the article I link there are procedures for a more detailed post-hoc analysis of the data. A different approach altogether could be a generalized linear regression model.
Here is the interpretation, and the code:
snails <- matrix(c(800, 200, 400, 
                   100, 600, 100,
                   400, 50, 50), nrow = 3, byrow = T)
dimnames(snails) = list(snails = c("red", "blue", "green"),
                       park = c("A", "B", "C"))
snails

addmargins(round(snails, 0))
addmargins(round(chisq.test(snails)$expected,0))
chisq.test(snails)
library(vcd)
mosaic(snails, shade=TRUE, legend=TRUE)

