[R-sig-ME] fixed vs random
Iasonas Lamprianou
lamprianou at yahoo.com
Sun Mar 28 22:21:21 CEST 2010
Dear colleagues,
I am not sure what the difference between those models is:
m0<- lmer(score ~ 1+gender+(1|candidate), mg2006_sub)
m1<- lmer(score ~ 1+(1+gender|candidate), mg2006_sub)
m2 <- lmer(score ~ 1+gender+(1+gender|candidate), mg2006_sub)
the first model is modelling the candidate as a random effect in an examination, where two markers mark each response of a candidate (a repeated measure). I assume that the gender of the candidate is a good predictor of performance on the test, so I can use any of the three models. But I do not understand what the difference is. Why would I get different results between m0 and m1? In effect, I am just adding the gender as a fixed effect.And is m2 a valid model?
thank you
jason
Dr. Iasonas Lamprianou
Assistant Professor (Educational Research and Evaluation)
Department of Education Sciences
European University-Cyprus
P.O. Box 22006
1516 Nicosia
Cyprus
Tel.: +357-22-713178
Fax: +357-22-590539
Honorary Research Fellow
Department of Education
The University of Manchester
Oxford Road, Manchester M13 9PL, UK
Tel. 0044 161 275 3485
iasonas.lamprianou at manchester.ac.uk
--- On Sun, 28/3/10, r-sig-mixed-models-request at r-project.org <r-sig-mixed-models-request at r-project.org> wrote:
> From: r-sig-mixed-models-request at r-project.org <r-sig-mixed-models-request at r-project.org>
> Subject: R-sig-mixed-models Digest, Vol 39, Issue 42
> To: r-sig-mixed-models at r-project.org
> Date: Sunday, 28 March, 2010, 11:00
> Send R-sig-mixed-models mailing list
> submissions to
> r-sig-mixed-models at r-project.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> or, via email, send a message with subject or body 'help'
> to
> r-sig-mixed-models-request at r-project.org
>
> You can reach the person managing the list at
> r-sig-mixed-models-owner at r-project.org
>
> When replying, please edit your Subject line so it is more
> specific
> than "Re: Contents of R-sig-mixed-models digest..."
>
>
> Today's Topics:
>
> 1. Re: Could not get a lmer or glmer
> summary (Eric Edeline)
> 2. Re: Significance and lmer (Ben
> Bolker)
> 3. Re: Significance and lmer (Adam D. I.
> Kramer)
> 4. Re: Significance and lmer (David
> Duffy)
> 5. Re: Significance and lmer (Adam D. I.
> Kramer)
> 6. Very weird lmer results, compared to
> SAS proc mix (Yong Wu)
> 7. Re: Very weird lmer results, compared
> to SAS proc mix
> (hadley wickham)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 27 Mar 2010 14:59:48 +0100
> From: Eric Edeline <edeline at biologie.ens.fr>
> To: David Duffy <David.Duffy at qimr.edu.au>
> Cc: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Could not get a lmer or glmer
> summary
> Message-ID: <4BAE0F54.3000809 at biologie.ens.fr>
> Content-Type: text/plain; charset=ISO-8859-1;
> format=flowed
>
> I have solved my problem, which was apparently due to a
> conflict between
> lme4 and another library (one of these: tree, VGAM, sn,
> Matrix,
> mclust...) about an "rcon" object if I remember well.
> Removing all the
> libraries including lme4 from /usr/local/lib/R/site-library
> and
> re-installing lme4 in /usr/lib/R/site-library made the
> trick. Sorry for
> not providing more detailed information, I just do not
> remember more!
>
> Cheers,
>
> eric
>
>
>
> David Duffy wrote:
> > On Fri, 26 Mar 2010, Eric Edeline wrote:
> >
> >> Dear Ben,
> >>
> >> thank you for your feed-back. I have now tested
> lmer on several
> >> datasets and I always get the same error message
> when asking for
> >> model summary. So the problem is with lme4, not
> with the data. Then,
> >> I ran the exact same models and data on another
> machine and it works
> >> fine! So the lme4 problem is specific to my
> machine. Then, I tried
> >> brute force: uninstalling and re-installing R on
> my machine, but the
> >> lme4 problem remains.
> >
> > Therefore, you either need to "just" extract the
> results you want from
> > m11
> > directly (doing any necessary calculations yourself),
> or step through
> > using a
> > debugger, or send all the files to Douglas Bates ;)
> >
> > Cheers, David Duffy.
>
> --
> Eric Edeline
> Assistant Professor
> UMR 7618 BIOEMCO
> Ecole Normale Sup?rieure
> 46 rue d'Ulm
> 75230 Paris cedex 05
> France
>
> Tel: +33 (0)1 44 32 38 84
> Fax: +33 (0)1 44 32 38 85
>
> http://www.biologie.ens.fr/bioemco/biodiversite/edeline.html
>
>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 27 Mar 2010 15:04:42 +0000 (UTC)
> From: Ben Bolker <bolker at ufl.edu>
> To: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Significance and lmer
> Message-ID: <loom.20100327T160050-336 at post.gmane.org>
> Content-Type: text/plain; charset=us-ascii
>
> Adam D. I. Kramer <adik at ...> writes:
>
> >
> > Dear colleagues,
> >
> > Please consider this series of commands:
> >
> > a <- lmer(log(stddiff+.1539) ~ pred + m*v + option
> + (option|studyID),
> > data=r1, subset=option>1, REML=FALSE)
> >
> > b <- update(a, . ~ . - pred)
> >
> > anova(a,b)
> >
> > ...am I mistaken in thinking that the latter command
> will produce a test of
> > whether "pred" is a significant predictor of
> log(stddiff+.1539)? I am
> > concerned because of the results:
> >
>
> [snip]
>
> > ...a significant result completely unrelated to the
> t-value. My
> > interpretation of this would be that we have no good
> evidence that the
> > estimate for 'pred' is nonzero, but including pred in
> the model improves
> > prediction.
>
> It is possible for Wald tests (as provided by
> summary()) to
> disagree radically with likelihood ratio tests (look up
> "Hauck-Donner
> effects", but my guess is that's not what's going
> on here (it definitely can apply in binomial models, don't
> think
> it should apply to LMMs but ?).
>
> I have seen some wonky stuff happen with update()
> [sorry, can't
> provide any reproducible details], I would definitely try
> fitting
> b by spelling out the full model rather than using update()
> and
> see if that makes a difference.
>
> Other than that, nothing springs to mind.
>
> (Where does the log(x+0.1539) transformation come
> from???)
>
>
>
> ------------------------------
>
> Message: 3
> Date: Sat, 27 Mar 2010 10:09:41 -0700 (PDT)
> From: "Adam D. I. Kramer" <adik at ilovebacon.org>
> To: Ben Bolker <bolker at ufl.edu>
> Cc: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Significance and lmer
> Message-ID: <Pine.LNX.4.64.1003270955500.17783 at ilovebacon.org>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
>
> On Sat, 27 Mar 2010, Ben Bolker wrote:
>
> >> ...a significant result completely unrelated to
> the t-value. My
> >> interpretation of this would be that we have no
> good evidence that the
> >> estimate for 'pred' is nonzero, but including pred
> in the model improves
> >> prediction.
> >
> > It is possible for Wald tests (as provided by
> summary()) to disagree
> > radically with likelihood ratio tests (look up
> "Hauck-Donner effects", but
> > my guess is that's not what's going on here (it
> definitely can apply in
> > binomial models, don't think it should apply to LMMs
> but ?).
>
> There are no Wald tests produced by the summary()...my
> understanding from
> reading this list is that the t-values are provided because
> they are t-like
> (effect / se), but that it is difficult (and perhaps
> foolish) to estimate
> degrees of freedom for t. So my concern is based on the
> fact that t is very
> small.
>
> > I have seen some wonky stuff happen with
> update() [sorry, can't provide
> > any reproducible details], I would definitely try
> fitting b by spelling
> > out the full model rather than using update() and see
> if that makes a
> > difference.
>
> This produces no difference in b's estimates or the anova()
> statistics.
> (That said, I originally was fitting [implicitly] with
> REML=TRUE, which did
> make a difference, but not a big one).
>
> > Other than that, nothing springs to mind.
>
> Well, thanks for the reply. Are you, then, of the opinion
> that the above
> interpretation is reasonable?
>
> > (Where does the log(x+0.1539) transformation
> come from???)
>
> x is power-law distributed with a bunch of zeroes (but not
> ordinal, or I'd
> use family=poisson), and .1539 is the 25th percentile. This
> normalizes is
> pretty well. Good question, though! And thanks ofr the
> response!
>
> --Adam
>
>
>
> ------------------------------
>
> Message: 4
> Date: Sun, 28 Mar 2010 08:04:03 +1000 (EST)
> From: David Duffy <David.Duffy at qimr.edu.au>
> To: "Adam D. I. Kramer" <adik at ilovebacon.org>
> Cc: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Significance and lmer
> Message-ID: <Pine.LNX.4.64.1003280753090.29716 at orpheus.qimr.edu.au>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
> On Sat, 27 Mar 2010, Adam D. I. Kramer wrote:
> > On Sat, 27 Mar 2010, Ben Bolker wrote:
> >
> >>> ...a significant result completely unrelated
> to the t-value. My
> >>> interpretation of this would be that we have
> no good evidence that the
> >>> estimate for 'pred' is nonzero, but including
> pred in the model improves
> >>> prediction.
> >>
> >
> >> I have seen some wonky stuff happen with
> update() [sorry, can't provide
> >> any reproducible details], I would definitely try
> fitting b by spelling
> >> out the full model rather than using update() and
> see if that makes a
> >> difference.
> >
> > This produces no difference in b's estimates or the
> anova() statistics.
> > (That said, I originally was fitting [implicitly] with
> REML=TRUE, which did
> > make a difference, but not a big one).
>
> The two models both have the same number of observations,
> one hopes? How
> many observations per studyID and how many studyIDs?
>
> > Well, thanks for the reply. Are you, then, of the
> opinion that the above
> > interpretation is reasonable?
>
> I would be a bit nervous. My interpretation would be
> that the model is
> inappropriate for the data (as the Wald and LR tests should
> roughly agree
> for a LMM, as Ben pointed out), and would look at
> diagnostic plots of
> residuals etc. The bunch of zeroes you mention may
> still be stuffing
> things up ;) Is a left-censored model plausible?
>
> Just my 2c, David Duffy.
>
> --
> | David Duffy (MBBS PhD)
>
>
> ,-_|\
> | email: davidD at qimr.edu.au
> ph: INT+61+7+3362-0217 fax: -0101 /
> *
> | Epidemiology Unit, Queensland Institute of Medical
> Research \_,-._/
> | 300 Herston Rd, Brisbane, Queensland 4029,
> Australia GPG 4D0B994A v
>
>
>
> ------------------------------
>
> Message: 5
> Date: Sat, 27 Mar 2010 16:17:53 -0700 (PDT)
> From: "Adam D. I. Kramer" <adik at ilovebacon.org>
> To: David Duffy <David.Duffy at qimr.edu.au>
> Cc: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Significance and lmer
> Message-ID: <Pine.LNX.4.64.1003271609530.17783 at ilovebacon.org>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
> The problem turned out to be, indeed, differing numbers of
> observations.
> This is likely due to me relying too much on update() to
> work as I
> expected...it did not drop the observations previously
> dropped. The help
> page for update makes it very clear that it just
> re-evaluates an altered
> call, so this is my fault. Ben's comment about update()
> being wonky should
> have given me a hint.
>
> Preselecting cases using complete.cases() for both models
> brought the t
> values and chi-square values much closer together--when
> t=.51 for the
> coefficient, the chisq of a likelihood test for removing
> the variable from
> the model was chisq=.25, leading to a reasonable p=.62.
>
> Thanks very much to you and Ben Bolker!
>
> --Adam
>
> On Sun, 28 Mar 2010, David Duffy wrote:
>
> > On Sat, 27 Mar 2010, Adam D. I. Kramer wrote:
> >> On Sat, 27 Mar 2010, Ben Bolker wrote:
> >>
> >>>> ...a significant result completely
> unrelated to the t-value. My
> >>>> interpretation of this would be that we
> have no good evidence that the
> >>>> estimate for 'pred' is nonzero, but
> including pred in the model improves
> >>>> prediction.
> >>>
> >>
> >>> I have seen some wonky stuff happen with
> update() [sorry, can't provide
> >>> any reproducible details], I would definitely
> try fitting b by spelling
> >>> out the full model rather than using update()
> and see if that makes a
> >>> difference.
> >>
> >> This produces no difference in b's estimates or
> the anova() statistics.
> >> (That said, I originally was fitting [implicitly]
> with REML=TRUE, which did
> >> make a difference, but not a big one).
> >
> > The two models both have the same number of
> observations, one hopes? How
> > many observations per studyID and how many studyIDs?
> >
> >> Well, thanks for the reply. Are you, then, of the
> opinion that the above
> >> interpretation is reasonable?
> >
> > I would be a bit nervous. My interpretation
> would be that the model is
> > inappropriate for the data (as the Wald and LR tests
> should roughly agree for
> > a LMM, as Ben pointed out), and would look at
> diagnostic plots of residuals
> > etc. The bunch of zeroes you mention may still
> be stuffing things up ;) Is
> > a left-censored model plausible?
> >
> > Just my 2c, David Duffy.
> >
> > --
> > | David Duffy (MBBS PhD)
>
>
> ,-_|\
> > | email: davidD at qimr.edu.au
> ph: INT+61+7+3362-0217 fax: -0101 /
> *
> > | Epidemiology Unit, Queensland Institute of Medical
> Research \_,-._/
> > | 300 Herston Rd, Brisbane, Queensland 4029,
> Australia GPG 4D0B994A v
> >
>
>
>
> ------------------------------
>
> Message: 6
> Date: Sat, 27 Mar 2010 23:25:21 -0500
> From: Yong Wu <wuyong88 at gmail.com>
> To: r-sig-mixed-models at r-project.org
> Subject: [R-sig-ME] Very weird lmer results, compared to
> SAS proc mix
> Message-ID:
> <cfa5b89e1003272125r1677f3ddl8004de6f726683cd at mail.gmail.com>
> Content-Type: text/plain
>
> Sorry to bother you. I am struggling in this issue for long
> time. Wish
> somebody can help me.
>
> I first used lmer to do the following analysis.
> fullmodel=lmer(BMI~1+exposure+(age|ID),data, REML=FALSE)
>
> reducemodel=lmer(BMI~1+(age|ID),data, REML=FALSE)
> anova(full,red)
> The "fullmodel" has AIC of 6874 and "reducemodel" has AIC
> of 7106, which
> cause "anova" analysis giving the p-value< 2.2e-16 .
> This result is
> definitely wrong
>
> I then did the similar study by SAS.
> The fullmodel is:
> proc mixed;
> class exposure;
> model BMI=exposure;
> random age /sub=id;
> run;
> The AIC is 7099.7, and type 3 test of fixed effect,
> exposure, got
> p-value=0.74.
>
> The reducemodel is:
> proc mixed;
> class exposure;
> model BMI=;
> random age /sub=id;
> run;
> The AIC is 7101.2.
>
> The SAS result is correct.
>
> Could somebody help me to explain why lmer is wrong?
>
> I do not even dare to use lmer now, since I can not trust
> its result. Thanks
> in advance for any of your answer.
>
> Best,
> Yong
> ,
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------
>
> Message: 7
> Date: Sat, 27 Mar 2010 23:55:54 -0500
> From: hadley wickham <h.wickham at gmail.com>
> To: Yong Wu <wuyong88 at gmail.com>
> Cc: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Very weird lmer results, compared
> to SAS proc
> mix
> Message-ID:
> <f8e6ff051003272155l4501611dnebf8d57c8cfe9f5e at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Sat, Mar 27, 2010 at 11:25 PM, Yong Wu <wuyong88 at gmail.com>
> wrote:
> > Sorry to bother you. I am struggling in this issue for
> long time. Wish
> > somebody can help me.
> >
> > I first used lmer to do the following analysis.
> > fullmodel=lmer(BMI~1+exposure+(age|ID),data,
> REML=FALSE)
> > ? ? ? ? ?reducemodel=lmer(BMI~1+(age|ID),data,
> REML=FALSE)
> > ? ? ? ? ?anova(full,red)
> > The "fullmodel" has AIC of 6874 and "reducemodel" has
> AIC of 7106, which
> > cause "anova" analysis giving the p-value< 2.2e-16
> . This result is
> > definitely wrong
>
> How do you know? It would be helpful if you provided
> the evidence you
> used to judge SAS correct and R incorrect.
>
> Hadley
>
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/
>
>
>
> ------------------------------
>
> _______________________________________________
> R-sig-mixed-models mailing list
> R-sig-mixed-models at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
> End of R-sig-mixed-models Digest, Vol 39, Issue 42
> **************************************************
>
More information about the R-sig-mixed-models
mailing list