[R] Question about lme (mixed effects regression)

Bert Gunter gunter.berton at gene.com
Tue Oct 19 00:24:02 CEST 2010


Oh -- I get your question (I think). Not the total, just the random
effects. You have to add them to the fixed effects.

See e.g. p. 39 of Bates and Pinheiro.

-- Bert

On Mon, Oct 18, 2010 at 3:00 PM, Dimitri Liakhovitski
<dimitri.liakhovitski at gmail.com> wrote:
> 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
>



-- 
Bert Gunter
Genentech Nonclinical Biostatistics



More information about the R-help mailing list