[Rd] proposed simulate.glm method

Ben Bolker bolker at ufl.edu
Thu Feb 12 19:45:59 CET 2009


  Elsewhere (at least in lme4), refit(sim(model)) does the
same thing [and so one would need something like
apply(sim(model,1000),2,refit)].

  sim() is quite interesting, as is Zelig, but I'm not
sure I am ready to leap to it yet -- this was basically
a suggestion that simulate.glm could be included in
"vanilla" R ...

  Also (for better or worse), it looks like sim() also
does parametric bootstrapping on the parameter values,
whereas simulate.[g]lm() just uses "plug-in" estimates.

  cheers
    Ben Bolker


Alex D'Amour wrote:
> 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: http://gking.harvard.edu/zelig/.
> 
> 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.
> 
> Best,
> Alex D'Amour
> Statistical Programmer
> Harvard Institute for Quantitative Social Science
> 
> 
> 2009/2/12 Ben Bolker <bolker at ufl.edu>:
>>  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
>> bolker at ufl.edu / www.zoology.ufl.edu/bolker
>> GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc
>>
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>


-- 
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bolker at ufl.edu / www.zoology.ufl.edu/bolker
GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc



More information about the R-devel mailing list