[R-sig-ME] Difference lme4 and nlme

Douglas Bates bates at stat.wisc.edu
Wed Feb 23 20:04:46 CET 2011


On Wed, Feb 23, 2011 at 12:19 PM, Daniel <dmsilv at gmail.com> wrote:
> This sound a controversial issue. If I change  "(1|J) + (1|J:PARTY)"
> for  "(1|PARTY) + (1|J:PARTY)" I get great different outcomes. So,
> first I need to place third level (J) and second PARTY nested within
> J, right?
>
> So, I take this opportunity to inform that scripts of "Linear Mixed
> Models: A Practical Guide Using Statistical Software" by Brady et al;
> perhaps are wrong. Scripts can be found at
> (http://www-personal.umich.edu/~bwest/chapter4.html)

As Andrzej is one of the authors of that book I'll let him respond
about the scripts.

Can you give us some background to the study - in particular, what
does  J represent and what does PARTY represent?

This sort of confusion is, in my opinion, unnecessary.  If the factors
are defined sensibly - avoiding what I call "implicit nesting" - then
the model specification is straightforward.

>
> Thanks,
> Daniel
>
> On Wed, Feb 23, 2011 at 12:55 PM, Andrzej Galecki <agalecki at umich.edu> wrote:
>>
>> Hello to everyone,
>>
>> Actually, the same type of mistake occurred in an earlier email.
>>
>>
>> "If you do indeed want to have PARTY nested within J then your call to
>> lmer should use the formula
>>
>> REVENUES ~ INCUMBENCY + (1|PARTY) + (1|J:PARTY)"
>>
>>
>> Preferred notation was used incorrectly. It should be:
>>
>> REVENUES ~ INCUMBENCY + (1|J) + (1|J:PARTY)
>>
>>
>> Thank you
>>
>> Andrzej Galecki
>> University of Michigan
>>
>>
>>
>>
>>
>>
>>
>>
>> On 2/23/2011 10:39 AM, Douglas Bates wrote:
>>>
>>> On Wed, Feb 23, 2011 at 8:39 AM, ONKELINX, Thierry
>>> <Thierry.ONKELINX at inbo.be>  wrote:
>>>>
>>>> "(1|PARTY) + (1|J:PARTY)" and "(1|J/PARTY)" are equal
>>>
>>> Actually (1|PARTY) + (1|J:PARTY) is equal to (1|PARTY/J).  It is easy
>>> to confuse these which is why I prefer not to use the (1|F/G)
>>> notation.
>>>
>>>> "(1|PARTY) + (1|J:PARTY)" and "(J|PARTY)" are not equal
>>>>
>>>> ----------------------------------------------------------------------------
>>>> ir. Thierry Onkelinx
>>>> Instituut voor natuur- en bosonderzoek
>>>> team Biometrie&  Kwaliteitszorg
>>>> Gaverstraat 4
>>>> 9500 Geraardsbergen
>>>> Belgium
>>>>
>>>> Research Institute for Nature and Forest
>>>> team Biometrics&  Quality Assurance
>>>> Gaverstraat 4
>>>> 9500 Geraardsbergen
>>>> Belgium
>>>>
>>>> tel. + 32 54/436 185
>>>> Thierry.Onkelinx at inbo.be
>>>> www.inbo.be
>>>>
>>>> To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
>>>> ~ Sir Ronald Aylmer Fisher
>>>>
>>>> The plural of anecdote is not data.
>>>> ~ Roger Brinner
>>>>
>>>> The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
>>>> ~ John Tukey
>>>>
>>>>
>>>>> -----Oorspronkelijk bericht-----
>>>>> Van: r-sig-mixed-models-bounces at r-project.org
>>>>> [mailto:r-sig-mixed-models-bounces at r-project.org] Namens Iker
>>>>> Vaquero Alba
>>>>> Verzonden: woensdag 23 februari 2011 15:30
>>>>> Aan: Daniel; Douglas Bates
>>>>> CC: R-sig-mixed-models at r-project.org
>>>>> Onderwerp: Re: [R-sig-ME] Difference lme4 and nlme
>>>>>
>>>>>
>>>>>
>>>>>    Just a technical question: Would "(1|PARTY) + (1|J:PARTY)"
>>>>> be equal to "(1|J/PARTY)" and this to "(J|PARTY)"?
>>>>>
>>>>>    I've tried the last two ones and as long as I saw, I got
>>>>> the same results, but I might have overlooked something.
>>>>>
>>>>>    Thank you. Regards.
>>>>>
>>>>>    Iker
>>>>>
>>>>> --- El mié, 23/2/11, Douglas Bates<bates at stat.wisc.edu>  escribió:
>>>>>
>>>>> De: Douglas Bates<bates at stat.wisc.edu>
>>>>> Asunto: Re: [R-sig-ME] Difference lme4 and nlme
>>>>> Para: "Daniel"<dmsilv at gmail.com>
>>>>> CC: R-sig-mixed-models at r-project.org
>>>>> Fecha: miércoles, 23 de febrero, 2011 15:08
>>>>>
>>>>> Notice that the first model has 27 levels for J and the
>>>>> second model has 465 levels for PARTY %in% J.  That's the difference.
>>>>>
>>>>> If you do indeed want to have PARTY nested within J then your
>>>>> call to lmer should use the formula
>>>>>
>>>>> REVENUES ~ INCUMBENCY + (1|PARTY) + (1|J:PARTY)
>>>>>
>>>>>
>>>>> On Wed, Feb 23, 2011 at 6:27 AM, Daniel<dmsilv at gmail.com>  wrote:
>>>>>>
>>>>>> Hello list,
>>>>>>
>>>>>> I'm just try to find out how can I produce the results
>>>>>
>>>>> using both packages.
>>>>>>
>>>>>> Perhaps I'm using different equation. Trailer model are
>>>>>
>>>>> consistent to
>>>>>>
>>>>>> Stata output using (tmixed REVENUES INCUMBENCY || J: || PARTY:)
>>>>>>
>>>>>> lme2<-
>>>>>
>>>>> lmer(REVENUES~INCUMBENCY+(1|J)+(1|PARTY),data=data,na.action =
>>>>>>
>>>>>> "na.omit", REML=TRUE)
>>>>>>
>>>>>> Linear mixed model fit by REML
>>>>>> Formula: REVENUES ~ INCUMBENCY + (1 | J) + (1 | PARTY)
>>>>>>  Data: data
>>>>>>  AIC   BIC logLik deviance REMLdev
>>>>>> 78123 78153 -39057    78154   78113
>>>>>> Random effects:
>>>>>> Groups   Name        Variance   Std.Dev.
>>>>>> J        (Intercept) 9.6263e+08  31026 PARTY    (Intercept)
>>>>>
>>>>> 1.7502e+09
>>>>>>
>>>>>> 41836 Residual             3.0534e+10 174741 Number of obs: 2894,
>>>>>> groups: J, 27; PARTY, 27
>>>>>>
>>>>>> Fixed effects:
>>>>>>           Estimate Std. Error t value
>>>>>> (Intercept)    34244      11657   2.938 INCUMBENCY    211495
>>>>>> 9536  22.178
>>>>>>
>>>>>> Correlation of Fixed Effects:
>>>>>>          (Intr)
>>>>>> INCUMBENCY -0.097
>>>>>>
>>>>>> lme3<- lme(REVENUES~INCUMBENCY, random=~1
>>>>>> |J/PARTY,data=data,na.action = "na.omit", REML=TRUE)
>>>>>>
>>>>>> Linear mixed-effects model fit by REML
>>>>>>  Data: data
>>>>>>  Log-restricted-likelihood: -39078.07
>>>>>>  Fixed: REVENUES ~ INCUMBENCY
>>>>>> (Intercept)  INCUMBENCY
>>>>>>   52469.19   220521.74
>>>>>>
>>>>>> Random effects:
>>>>>>  Formula: ~1 | J
>>>>>>        (Intercept)
>>>>>> StdDev:    25424.31
>>>>>>
>>>>>>  Formula: ~1 | PARTY %in% J
>>>>>>        (Intercept) Residual
>>>>>> StdDev:     45574.5 173465.7
>>>>>>
>>>>>> Number of Observations: 2894
>>>>>> Number of Groups:
>>>>>>           J PARTY %in% J
>>>>>>          27          465
>>>>>>
>>>>>> --
>>>>>> Daniel Marcelino
>>>>>> Skype: dmsilv
>>>>>> http://sites.google.com/
>>>>>>
>>>>>>        [[alternative HTML version deleted]]
>>>>>>
>>>>>> _______________________________________________
>>>>>> R-sig-mixed-models at r-project.org mailing list
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>>>
>>>>> _______________________________________________
>>>>> R-sig-mixed-models at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>       [[alternative HTML version deleted]]
>>>>>
>>>>>
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>>
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
>
> --
> Daniel Marcelino
> Skype: dmsilv
> http://sites.google.com/
>




More information about the R-sig-mixed-models mailing list