# Testing distributions with different sample sizes for similarity

Let's say that I am counting cars passing on a road and dividing them by colour. I am interested in testing whether the ratios between colours change from one day to another.

The first day I count {black: 10, white: 5, red: 2}.

The next day I count {black: 72, white: 35, red: 18}.

Since there aren't a fixed number of trails (cars passing), I would expect the number of a certain coloured car to follow a poison distribution. However, as in my example above, the total amount of cars might vary wildly.

So, how would you test the null-hypothesis that the ratios between the colours are constant (or rather, that the cars are picked from the same parent distribution)?

• If it is a home work or self study then please add "self-study" tag. Sep 24, 2015 at 11:49

## 1 Answer

You can do this with a chi-square test.

day <- c(rep("Monday", 17), rep("Tuesday", 72+35+18))
color <- c(rep("Black", 10), rep("White", 5), rep("Red", 2),
rep("Black", 72), rep("White", 35), rep("Red", 18))
chisq.test(color,day, simulate.p.value = TRUE)


I used simulate.p.value because the table has many small expected values