gam.helpers {UCS}R Documentation

Helper Functions for GAM Equations (gam)


gam.yates and gam.yates.inv implement an invertible version of the discounting function used by Yates' correction. signed.sqrt,, b.norm and are standard abbreviations used in the definition of generalised association measures in terms of ebo-coordinates.



  b.norm(b), b, N)


d difference between observed and expected frequency, to which the generalised Yates' correction is applied
d.corr difference between observed and expected frequency with generalised Yates' correction applied, from which the original difference can uniquely be reconstructed
x a vector of positive or negative real numbers
b a vector of balance (b) values in the ebo coordinate system
e a vector of expectation (e) values in the ebo coordinate system
N sample size N


The standard discounting function for Yates' correction is d* := d - 1/2 for d ≥ 0 and d* := d + 1/2 for d < 0, where d is the difference between observed and expected frequency. This definition does not lead to a continuous and invertible function of d, so a GAM with Yates' correction applied does not satisfy the soundness conditions. The generalised Yates' correction implemented by gam.yates and gam.yates.inv is a monotonic (and hence invertible) function that is identical to the standard discounting function for d >= 1 and uses linear interpolation for -1 < d < 1.

The functions signed.sqrt,, b.norm and compute the standard abbreviation +/- sqrt(x), b*, ||b|| and \bar{e} (“e bar”) used by Evert (2004) for the definition of GAMs in terms of ebo-coordinates.


all functions return a vector of real numbers


Evert, Stefan (2004). The Statistics of Word Cooccurrences: Word Pairs and Collocations. PhD Thesis, IMS, University of Stuttgart.


d <- runif(20, -2, 2)
d.corr <- gam.yates(d)
all(d == gam.yates.inv(d.corr))


[Package UCS version 0.5 Index]