I'm trying to compare differences in text content between sites from medical societies from USA and UK.

My plan is to describe with wordclouds, tables and other graphs for the descriptive part.

In case of a comparison between sites, which could be an appropriate statistical analysis?

I was reading Agresti (2002), chapter 13: Other Mixture Models for Categorical Data about Latent Class Models, but I'm not sure if this would be correct.

Thanks in advance.

Agresti, A., 2002. Categorical data analysis 2nd ed., New York: Wiley-Interscience.


1 Answer 1


When you have two sources of text and want to compare them, one of my favorite types of analysis is to find which words are more or less likely to come from each source using the log odds ratio.

In pseudocode, you want to find

log odds ratio =  log((n1 / total1) / (n2 / total2))

for each word. You can check out this chapter or these blog posts for how to implement it.

I will often use a base 2 logarithm (log2() in R), because then you can easily get out some nice numbers. A log odds ratio of 0 indicates words used the same from both sources, a base 2 log odds ratio of 1 indicates words used twice as much from one source, a base 2 log odds ratio of 2 indicates four times as much from one source, etc.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.