Word dispersion calculator (DP, Juilland's D, KLD)
Paste the size of each corpus part and how often each word occurs in it. Get DP, DPnorm, KL divergence and the classic dispersion measures side by side, checked against the worked examples in Gries' papers.
Paste part sizes and frequencies
Everything is computed in your browser; nothing is uploaded.
LIVE RESULT
INSTANTDispersion of the first word
Dispersion depends on how the corpus is divided: report what the parts are (texts, files, speakers, registers) and how many. Values for different divisions are not comparable.
Why frequency is not enough
Two words with the same frequency can be used very differently: one spread across almost every text, the other concentrated in a few texts by one author or on one topic. Dispersion measures how evenly a word's occurrences are spread over the parts of a corpus, taking the size of each part into account. It is used to build frequency lists and vocabulary lists, to check whether a keyword is typical of a whole corpus or of a few texts, and to compare registers.
The measures
With part shares s (each part's size divided by the corpus size), the word's frequency v in each part, its total frequency f, and p the share of each part made up by the word:
DP = ½ × Σ |vᵢ ÷ f − sᵢ|
DPnorm = DP ÷ (1 − min s)
KLD = Σ (vᵢ ÷ f) × log₂((vᵢ ÷ f) ÷ sᵢ)
Juilland's D = 1 − (SD(p) ÷ mean(p)) ÷ √(n − 1)
- DP (deviation of proportions), Gries (2008): the share of the word's occurrences that would have to move to other parts for it to be spread exactly in proportion to part sizes. 0 is perfectly even; values near 1 are concentrated in a small part. DPnorm rescales DP to run from 0 to 1, using the correction of Lijffijt and Gries (2012).
- Kullback–Leibler divergence, suggested by Gries (2020): how far the word's distribution is from the part sizes, in bits. 0 is perfectly even, with no fixed maximum.
- Juilland's D, Carroll's D2 and Rosengren's S: the classic measures, where 1 is perfectly even. D and D2 here use the within-part proportions p, so they handle parts of different sizes, as in Gries (2020). Rosengren's S has a minimum of 1/n for equal parts. Its adjusted frequency, S × f, is a frequency discounted for uneven spread.
- Range (the number of parts containing the word), standard deviation, variation coefficient and chi-square, for reference. Lyne's D3 is shown for completeness but assumes equally sized parts.
Worked example
The default data is the small corpus from Gries (2020): five parts of 9 to 11 words. The word a occurs 1, 2, 3, 4 and 5 times: DP = 0.18, DPnorm = 0.22, Juilland's D = 0.785 and KLD = 0.137. The word b occurs twice in every part: DP = 0.02 and D = 0.968, very even (not exactly 0, because the parts differ slightly in size). The word i occurs once, in the smallest part: DP = 0.82, DPnorm = 1, as clumpy as possible. Every value matches the published example, and the test suite also checks Gries (2008) and Lijffijt and Gries (2012).
Notes on versions
Gries (2008) computed Juilland's D with the sample standard deviation of the frequencies, which gives 0.736 for the 2008 equal-parts example; the 2020 chapter, followed here, uses the population standard deviation of the within-part proportions. The original DPnorm, DP ÷ (1 − 1/n), only works for equal parts; this calculator uses the corrected 1 − min s. Be explicit about the version when you compare with published figures.
For comparing a word's frequency between two corpora, use the keyness calculator; for vocabulary range within a text, the lexical diversity calculator. The guide how to measure word dispersion in a corpus explains how to choose parts and report the results. Sources: Gries, S. Th. (2008), International Journal of Corpus Linguistics 13(4), 403–437; Lijffijt, J. and Gries, S. Th. (2012), IJCL 17(1), 147–149; Gries, S. Th. (2020), “Analyzing dispersion”, in A Practical Handbook of Corpus Linguistics.