# To use the correct test for independence

I have 2 groups (data.frame) in R called good and bad which contains good users and bad users respectively.

The group good contains game_id which is the id for a computergame and number which is how many times this game has been played.

For example good$game_id we get 1 2 3 ... 20. We have 20 games. Similar good$number we get 45214 1254 23 ... 8914 which is the number the game has been played. For example has game_id==1 been played 45214 times in group good.

Similar for bad.
We also have the same number of users in the two groups.

For

head(good)


we get

game_id number

1   45214
2   1254
...
20  8914


I want to investigate if there is dependence between the number of times a fixed computergame has been played.

For game_id==1 I would try to use Pearson's Chi test for 'Independence'. In R I type chisq.test(good[1,2], bad[1,2]) to see if there is indepence between good and bad for game_id==1 but I get an error message: x and y must have same levels.

How can this problem be solved ?

• Can you post the result of head(your_data.frame)? – Antoni Parellada Sep 28 '15 at 13:24