# [R] Simulating underdispersed counts

Greg Snow Greg.Snow at imail.org
Thu Dec 4 19:03:36 CET 2008

```Yes, that is basically truncation, but the original poster said they wanted something fast and did not give detail.  If they just wanted some data to put into a glm model to demonstrate, then this would work.

Another idea that I had is instead of dropping all the extreme values, is take the extreme values and replace them with a new draw, this would still allow for the possibility of some extreme values, but would reduce the number of them.  This fits the idea "if my results don't match what I expected, something must have gone wrong and I will just do it again" that is sometimes seen in researchers who don't fully understand the idea of variation (Mendel's gardener/assistant as a possible example).

Another approach:  One way to think of a regular Poisson process is to have several bins and place objects in the bins at random.  If the probability of placing something into a bin is independent of how many objects are already in that bin (and the others) then the counts of objects per bin will follow a Poisson distribution.  Doing the same thing but having the probability of which bin to place the object into depend on the number of objects already in bins would lead to over or under dispersion (over if the next object is more likely to go into bins already containing objects, under if more likely to go into bins containing no/fewer objects).  It should not be too hard to write a function that would put m balls in n bins based on a probability model proportional to current counts, some experimentation would probably be needed to get the probability model to match the amount of over/under-dispersion desired.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111

> -----Original Message-----
> From: Gerard M. Keogh [mailto:GMKeogh at justice.ie]
> Sent: Thursday, December 04, 2008 10:34 AM
> To: Greg Snow
> Cc: R-help at r-project.org; r-help-bounces at r-project.org; René Holst
> Subject: Re: [R] Simulating underdispersed counts
>
> V interesting point Greg.
>
> But are you not just suggesting left and right truncation?
> It strikes me that if the data are Poission then a mixture is likely to
> be
> better - something akin to zero-deflated.
> Neg binomail works for greater variance == mix a gamma and poisson, but
> I'm
> unsure what to mix to deflate the variance - maybe bernoulli.
>
> In any event, one possibility is that the data are dependnent (e.g.
> family
> data) so to get a underdispersion you could draw from the poisson and
> then
> redraw from the result based on some condition such as closeness (e.g.
> as a
> proxy for family size).
>
> Hope this helps!
> Gerard
>
>
>
>
>
>              Greg Snow
>              <Greg.Snow at imail.
>              org>
> To
>              Sent by:                  René Holst <rho at aqua.dtu.dk>,
>              r-help-bounces at r-         "R-help at r-project.org"
>              project.org               <R-help at r-project.org>
>
> cc
>
>              04/12/2008 17:21
> Subject
>                                        Re: [R] Simulating
> underdispersed
>                                        counts
>
>
>
>
>
>
>
>
>
>
> Accurate probably depends on what exactly you want to accomplish with
> the
> simulation, but one simple approach would be to generate more data than
> you
> need from a regular Poisson distribution, then throw away the extreme
> values on both sides.
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow at imail.org
> 801.408.8111
>
>
> > -----Original Message-----
> > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> > project.org] On Behalf Of René Holst
> > Sent: Thursday, December 04, 2008 6:40 AM
> > To: R-help at r-project.org
> > Subject: [R] Simulating underdispersed counts
> >
> > Hello,
> >
> > Anyone who knows a fast and accurate algorithm for generating draws
> > from an underdispersed Poisson distribution. Or even better, if there
> > is a package containing such an implementation.
> >
> > Thanks
> >
> > Rene
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> ***********************************************************************
> ***********
> The information transmitted is intended only for the person or entity
> to which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited. If you
> material from any computer.  It is the policy of the Department of
> Justice, Equality and Law Reform and the Agencies and Offices using its
> IT services to disallow the sending of offensive material.
> Should you consider that the material contained in this message is
> offensive you should contact the sender immediately and also
> mailminder[at]justice.ie.
>
> Is le haghaidh an duine nó an eintitis ar a bhfuil sí dírithe, agus le
> haghaidh an duine nó an eintitis sin amháin, a bheartaítear an
> fhaisnéis a tarchuireadh agus féadfaidh sé go bhfuil ábhar faoi rún
> agus/nó faoi phribhléid inti. Toirmisctear aon athbhreithniú, atarchur
> nó leathadh a dhéanamh ar an bhfaisnéis seo, aon úsáid eile a bhaint
> aisti nó aon ghníomh a dhéanamh ar a hiontaoibh, ag daoine nó ag
> eintitis seachas an faighteoir beartaithe. Má fuair tú é seo trí
> dhearmad, téigh i dteagmháil leis an seoltóir, le do thoil, agus scrios
> an t-ábhar as aon ríomhaire. Is é beartas na Roinne Dlí agus Cirt,
> Comhionannais agus Athchóirithe Dlí, agus na nOifígí agus na
> nGníomhaireachtaí a úsáideann seirbhísí TF na Roinne, seoladh ábhair