[R-lang] GIGP - random sample? CDF?
Stefan Evert
stefan.evert at collocations.de
Thu Apr 9 10:00:34 PDT 2009
Hi David!
> I have collocation data that fits the Generalized Inverse Gaussian-
> Poisson distribution quite well (via the ZipfR package). Now I'd
> like to randomly sample from such a distribution. Does anyone know
> how to do that?
There's a reason why zipfR doesn't offer a random sample generator for
GIGP models: my (straightforward) implementation of random sampling
transforms uniform random numbers into LNRE-distributed types using
the quantile function (i.e. the inverses of the cumulative
distribution function) and the cumulative type distribution function.
Since ...
> For starters, I could probably do with an integral-free cumulative
> distribution function for a GIGP, as that would get me 3/4 of the
> way there.
... I'm not aware of any closed-form expression (or even taylor
expansions or such) for incomplete integrals of the GIGP density
function, I haven't implemented these functions yet. The complete
integrals (from 0 to +inf) have closed-form expressions involving
Bessel functions, given in Baayen (2001).
BTW, this is one of the main reasons why I prefer the simplistic ZM/
fZM models over GIGP.
> (I can think of some iterative/numerical way, but that wouldn't be
> very elegant - I might as well sample from the corpus data in that
> case.)
Exactly. I would stay away from numerical integration in this case.
Your goal is probably to run simulation experiments, so you will need
a large number of random draws, and each of this would require to
calculate several numerical integrals with high precision (this is
essential for the transformation from a uniform distribution to a LNRE
distribution).
I've toyed with the possibility of using rejection sampling or a
similar approach for GIGP, but haven't found a feasible solution yet.
Any suggestions (or code :-) are highly welcome.
Best regards,
Stefan Evert
[ stefan.evert at uos.de | http://purl.org/stefan.evert ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.ucsd.edu/pipermail/r-lang/attachments/20090409/302b45e7/attachment-0001.htm>
More information about the R-lang
mailing list