[R] Question about lme (mixed effects regression)

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Tue Oct 19 00:00:09 CEST 2010


Thank you very much, but not I am not sure now - does ranef(fm1) give
the (total) slope and
intercept values directly for each group or not?
Thanks a lot for clarifying - because I might well have been wrong.
Dimitri

On Mon, Oct 18, 2010 at 5:57 PM, Bert Gunter <gunter.berton at gene.com> wrote:
> Dmitri:
>
> Not quite sure what you mean by easier ... fixef() and ranef() will
> both give coefficients which can be easily manipulated to produce the
> results for all subjects.
>
> However, note that there are numerous built-in lme
> functions(especially for graphics) that do this internally to produce,
> e.g. graphs of coefficient shrinkage. So if this is the sort of thing
> you want to do with the BLUPS, you may not need to do it manually.
>
> HTH.
>
> Cheers,
> Bert
>
> On Mon, Oct 18, 2010 at 2:15 PM, Dimitri Liakhovitski
> <dimitri.liakhovitski at gmail.com> wrote:
>> Hello!
>>
>> If I run this example:
>>
>> library(nlme)
>> fm1 <- lme(distance ~ age+Sex, Orthodont, random = ~ age + Sex| Subject)
>> If I run:
>> summary(fm1)
>> then I can see the fixed effects for age and sex (17.7 for intercept,
>> 0.66 for age, and -1.66 for SexFemale)
>>
>> If I run:
>> ranef(fm1)
>> Then it looks like it's producing the random effects for each subgroup
>> (in this example - each subject). For example, for MO1 it's:
>> 1.25 for intercept, 0.106 for age, and -1.52 for SexFemale.
>>
>> So, in order to get the the total effects, i.e., the regression
>> equation, for each subgroup (Subject) I need to do this:
>> For example, for Subject MO1:
>> y(M01) = (17.71+1.25)+(0.66+0.106)*Age+(-1.66-1.52)*SexFemale = 18.96
>> + 0.766*Age -3.18*SexFemale
>>
>> Question: Is there an easier way to get such an equation for each
>> level of Subject?
>>
>> Thank you very much!
>>
>> --
>> Dimitri Liakhovitski
>> Ninah Consulting
>> www.ninah.com
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> --
> Bert Gunter
> Genentech Nonclinical Biostatistics
>



-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com



More information about the R-help mailing list