An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20110223/7911fe72/attachment.pl>
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:
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20110223/410dab82/attachment.pl>
"(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
-----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]]
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]]
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
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:
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/
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/
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 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/
Daniel Marcelino Skype: dmsilv http://sites.google.com/
On Wed, Feb 23, 2011 at 2:01 PM, Daniel <dmsilv at gmail.com> wrote:
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)
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.
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 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/
-- Daniel Marcelino Skype: dmsilv http://sites.google.com/
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:
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/
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:
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:
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/