[R] extracting random effects from model formula
David Winsemius
dwinsemius at comcast.net
Wed Sep 22 15:35:25 CEST 2010
On Sep 22, 2010, at 5:09 AM, Lorenzo Cattarino wrote:
> actually I need to extract the random effect from the formula, not
> the model
>
> any idea?
>
> ________________________________
>
> From: Sacha Viquerat [mailto:sacha.vsop at googlemail.com]
> Sent: Wed 22/09/2010 5:55 PM
> To: Lorenzo Cattarino
> Subject: Re: [R] extracting random effects from model formula
>
>
>
> Am 22.09.2010 09:22, schrieb Lorenzo Cattarino:
>> Hi R-users
>>
>>
>>
>> I would like to extract the random effects ("1|SITE", "1+SPECIES|
>> SITE"
>> and "BA|SITE") from this model formula:
> modterm <- attr(terms(Full_model), "term.labels")
> modterm[grep("\\|", attr(terms(Full_model), "term.labels") )]
[1] "1 | SITE" "1 + SPECIES | SITE" "BA | SITE"
>>
>>
>>
>> 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.
>>
>
> try ranef(model).
>
>
>
> [[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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list