Learn R Programming

polmineR (version 0.7.11)

pmi: Calculate Pointwise Mutual Information (PMI).

Description

Pointwise mutual information (PMI) is calculated as follows, see Manning/Schuetze (1999) for an explanation: $$I(x,y) = log\frac{p(x,y)}{p(x)p(y)}$$ Note that the computation uses log base 2, not the natural logarithm you find in examples (e.g. https://en.wikipedia.org/wiki/Pointwise_mutual_information).

Usage

pmi(.Object)

# S4 method for context pmi(.Object)

Arguments

.Object

An object.

References

Manning, Christopher D.; Schuetze, Hinrich (1999): Foundations of Statistical Natural Language Processing. MIT Press: Cambridge, Mass., pp. 178-183.

See Also

See ll, chisquare and t_test.

Examples

Run this code
# NOT RUN {
y <- cooccurrences("REUTERS", query = "oil", method = "pmi")
N <- size(y)[["partition"]]
I <- log2((y[["count_coi"]]/N) / ((count(y) / N) * (y[["count_partition"]] / N)))
# }

Run the code above in your browser using DataLab