<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi David!</div><br><div><blockquote type="cite"><div>I have collocation data that fits the Generalized Inverse Gaussian-Poisson distribution quite well (via the ZipfR package). &nbsp;Now I'd like to randomly sample from such a distribution. &nbsp;Does anyone know how to do that?<br></div></blockquote><div><br></div><div>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. &nbsp;Since ...</div><br><blockquote type="cite"><div>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.<br></div></blockquote><div><br></div><div>... 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. &nbsp;The complete integrals (from 0 to +inf) have closed-form expressions involving Bessel functions, given in Baayen (2001).</div><div><br></div><div>BTW, this is one of the main reasons why I prefer the simplistic ZM/fZM models over GIGP.</div><br><blockquote type="cite"><div>(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.)<br></div></blockquote></div><br><div>Exactly. &nbsp;I would stay away from numerical integration in this case. &nbsp;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).</div><div><br></div><div>I've toyed with the possibility of using rejection sampling or a similar approach for GIGP, but haven't found a feasible solution yet. &nbsp;Any suggestions (or code :-) are highly welcome.</div><br><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div>Best regards,</div><div>Stefan Evert</div><div><br></div><div>[ <a href="mailto:stefan.evert@uos.de">stefan.evert@uos.de</a> |&nbsp;<a href="http://purl.org/stefan.evert">http://purl.org/stefan.evert</a> ]</div></span><br class="Apple-interchange-newline"></span></span></span></span><br class="Apple-interchange-newline"></div></span> </div><br></body></html>