0
$\begingroup$

I have 3 set of items:

sample1 -> #trump: 25, #hilary: 0, #hillarycrooked: 2, ...
sample2 -> #hilary: 1, #notmypresident: 15, #trump: 0, ...
sample3 -> #obama: 5, #tcot: 10, #hilary: 0, ...

I wanted to use the chi-square test to see how my sample2 and sample3 are similar to my sample1. So I wanted to compare the result of the chi-squared(sample1,sample2) opposed to chi-squared(sample1, sample3) where sample1 would have been my expected values.

The problem is that the expected value may sometime be equal to 0 (so not applicable with the chi square test). What other statistical tool can I use to reach my purpose knowing that my expected and observed data may be <= 0

$\endgroup$
  • $\begingroup$ @NickCox All my sample are group of twitter users. I count how many times they use some hashtags. For example the sample1 us 25 the hashtag "#trump" but 0 times the hashtag #hilary. $\endgroup$ – mel Apr 19 '17 at 17:27
1
$\begingroup$

I don't get the idea why you apply a chi^2 test if, as far as i see, you are only interessted in the similarity between your samples...

So, why not apply a simple cosine similarity function (pairwise) on your samples?

Note, instead of a similarity you can also go for a distance function and transform the resulting distance $d$ into a similarity score $s \in [0 ; 1]$, for example through: $$ s = \frac{1}{1 + d}, \;\textrm{or: }\; s = \frac{1}{\textrm{exp}\{d\}} $$

I recommend my favorite distance function, the Manhatten distance M$(\cdot)$: $$ d = \textrm{M}(X,Y) = \sum^{n}_{i = 1} |x_i - y_i| $$

Here, $X$ and $Y$ refer to sample1 and sample 2, respectively.

$\endgroup$

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.