Skip to content

adding objects into "glmerMod" fits

3 messages · vito muggeo, Ben Bolker, Henrik Singmann

#
dear all,
for some reasons I would like to add some new components (vectors,  
matrices) to a "glmerMod" fit. I am not familiar with S4, so borrowing  
from S3 classes my first tentative was

o <- glmer(y ~ ..)
o at new<-1:3

But it clearly does not work. Is there any solution?
thanks in advance for your time,
best,
vito
#
Unfortunately for you, S4 classes are much fussier than S3 classes
about their composition.  Your only choices, I think, are

(1) modify the definition of a glmerMod (by copying the entire code of
the package, or forking it on Github)
(2) construct a class that extends the glmerMod  (i.e with
setClass("myGlmerMod", contains="glmerMod"))

e.g.

 setClass("myGlmerMod",contains="glmerMod",representation(new="data.frame"))

seems to work - at least it doesn't complain.

(3) add the additional information as one or more attributes

On Tue, Oct 3, 2017 at 5:39 PM, Vito Michele Rosario Muggeo
<vito.muggeo at unipa.it> wrote:
#
FWIW, the approach of extending the class via setClass is also the one 
taken by lmerTest. And lmerTest works quite well. See:
https://github.com/cran/lmerTest/blob/master/R/classes.R

Best,
Henrik


Am 04.10.2017 um 00:41 schrieb Ben Bolker: