[R] extracting random effects from model formula

Darin A. England england at cs.umn.edu
Thu Sep 23 18:24:06 CEST 2010


I've found using the arm package to be very useful.

require(arm)

then use ranef(Full_model) and fixef(Full_model)


On Wed, Sep 22, 2010 at 05:39:41PM +1000, Lorenzo Cattarino wrote:
> Hi again,
> 
>  
> 
> Sorry, probably I was not clear enough.
> 
>  
> 
> I was wondering if there is a way in R to identify (and extract) only
> the random effects, which, because I am using the lmer function, are the
> terms with the symbol | on the left side of the grouping variable
> ("SITE" in my example).
> 
>  
> 
> Thanks 
> 
>  
> 
> Lorenzo
> 
> From: Lorenzo Cattarino 
> Sent: Wednesday, 22 September 2010 5:23 PM
> To: r-help at r-project.org
> Subject: extracting random effects from model formula
> 
>  
> 
> Hi R-users
> 
>  
> 
> I would like to extract the random effects ("1|SITE", "1+SPECIES|SITE"
> and "BA|SITE") from this model formula:
> 
>  
> 
> Full_model <- formula (VAR ~ (1|SITE) + (1+SPECIES|SITE) + (BA|SITE) +
> HEIGHT + COND + NN_DIST)
> 
>  
> 
> I tried:
> 
>  
> 
> terms(Full_model)
> 
> labels(terms(Full_model))
> 
>  
> 
> but I could not distinguish between random and fixed effects.
> 
>  
> 
> thanks 
> 
>  
> 
> Lorenzo
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list