Skip to content

Difference lme4 and nlme

12 messages · Iker Vaquero Alba, ONKELINX, Thierry, Andrzej Galecki +2 more

#
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:
#
"(1|PARTY) + (1|J:PARTY)" and "(1|J/PARTY)" are equal

"(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
#
On Wed, Feb 23, 2011 at 8:39 AM, ONKELINX, Thierry
<Thierry.ONKELINX at inbo.be> wrote:
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.
#
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:
#
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)

Thanks,
Daniel
On Wed, Feb 23, 2011 at 12:55 PM, Andrzej Galecki <agalecki at umich.edu> wrote:
--
Daniel Marcelino
Skype: dmsilv
http://sites.google.com/
#
On Wed, Feb 23, 2011 at 12:19 PM, Daniel <dmsilv at gmail.com> wrote:
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.
#
Yes,
I'm try to fit a model of candidates campaign revenues using 3 levels model.
My theoretical assumption is that parties is nested within districts,
thus my model look likes:

REVENUES ~ Incumbency + Gender + GOV + IPC + Partisan  +
(1|DISTRICT:PARTY), data=data, REML = TRUE)

where,
REVENUES = total money received
Level 1
Incumbency = dummy
Gender = dummy

Level 2
GOV = dummy if party runs state government
IPC = Ordinal variable to Intra-party competition

Level 3
Partisan = total of partisan in the state

However, this discussion  drove me to a importante question: am I
account for possible main effect of PARTY or DISTRICT? If these points
is plausible my model should be something like this:

REVENUES ~ Incumbency + Gender + GOV + IPC + Partisan + (1|PARTY)  +
(1|DISTRICT) + (1|DISTRICT:PARTY), data=data, REML = TRUE)

What you think?

Best,

Daniel
On Wed, Feb 23, 2011 at 4:04 PM, Douglas Bates <bates at stat.wisc.edu> wrote:

  
    
#
On Wed, Feb 23, 2011 at 2:01 PM, Daniel <dmsilv at gmail.com> wrote:
Assuming that the set of political parties is more-or-less fixed, I
would put PARTY in the fixed-effects and (1|DISTRICT) +
(1|DISTRICT:PARTY) in the random effects.
#
Hello Daniel,

RE your statement:

"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)"


Scripts  on Brady West's website,  first author of the book, are correct.

In Chapter 4 of our book, we consider models with classid (classes)  
nested within schoolid (schools)

The following examples of syntaxes  can be used in lmer() formula to 
specify nested effects:

1a.   (1 | schoolid) + (1 | schoolid:classid)
   b.   (1 + z1 | schoolid) + (1 | schoolid:classid)

2.   (1 | schoolid)  + (1 | classid)

3.   (1 | schoolid/classid)

re 1. This is the most general syntax. It works regardless, whether we 
define factors using "implicit nesting" or not.  It also allows
         for models similar to (1b) with different sets of random 
effects for schools and classes.

re 2. This is a simplified syntax used on Brady's website. It works, 
only because classid is  sensibly coded as explicitly nested within 
schoolid.  Models similar to (1b) can also be accommodated using this 
syntax.

re 3 This syntax  expands to syntax 1a. It works, regardless, whether we 
use "implicit nesting" of factors or not.  Models similar  to        
(1b) can not be accommodated.

Thank you,

Andrzej
On 2/23/2011 2:04 PM, Douglas Bates wrote:
#
Thank you very much for detailed and patiente explanation guys.
I'm more informed about lmer procedures now.
Best,
Daniel
On Wed, Feb 23, 2011 at 6:03 PM, Andrzej Galecki <agalecki at umich.edu> wrote: