Re: [Rd] proposed simulate.glm method

From: Alex D'Amour <>
Date: Thu, 12 Feb 2009 12:11:09 -0500

There is functionality similar to this included in the Zelig package with it's "sim" method. The "sim" method goes a step further and replicates the fitted model's analysis on the generated datasets as well. I would suggest taking a look -- Zelig supports most (if not all) glm models and a wide range of others.

The Zelig maintainers' site can be found at:

Full disclosure: I am an employee of the Institute for Quantitative Social Science, which performs most of the development and support for the Zelig package.

Alex D'Amour
Statistical Programmer
Harvard Institute for Quantitative Social Science

2009/2/12 Ben Bolker <>:
> I have found the "simulate" method (incorporated
> in some packages) very handy. As far as I can tell the
> only class for which simulate is actually implemented
> in base R is lm ... this is actually a little dangerous
> for a naive user who might be tempted to try
> simulate(X) where X is a glm fit instead, because
> it defaults to simulate.lm (since glm inherits from
> the lm class), and the answers make no sense ...
> Here is my simulate.glm(), which is modeled on
> simulate.lm . It implements simulation for poisson
> and binomial (binary or non-binary) models, should
> be easy to implement others if that seems necessary.
> I hereby request comments and suggest that it wouldn't
> hurt to incorporate it into base R ... (I will write
> docs for it if necessary, perhaps by modifying ?simulate --
> there is no specific documentation for simulate.lm)
> cheers
> Ben Bolker
> --
> Ben Bolker
> Associate professor, Biology Dep't, Univ. of Florida
> /
> GPG key:
> ______________________________________________
> mailing list
> mailing list Received on Thu 12 Feb 2009 - 16:15:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 Feb 2009 - 18:30:22 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive