[R-sig-ME] (no subject)
Ben Bolker
bbolker @ending from gm@il@com
Thu Aug 2 05:57:38 CEST 2018
(please keep r-sig-mixed-models in the Cc:)
I'm pretty sure that lmer and lm models are commensurate, in case that
helps. Here's an example rigged to make the random-effects variance
equal to zero, so we can check that the log-likelihoods etc. are identical.
set.seed(101)
dd <- data.frame(y=rnorm(20),x=rnorm(20),f=factor(rep(1:2,10)))
library(lme4)
m1 <- lmer(y~x+(1|f),data=dd,REML=FALSE) ## estimated sigma^2_f=0
m2 <- lm(y~x,data=dd)
all.equal(c(logLik(m1)),c(logLik(m2))) ## TRUE
all.equal(fixef(m1),coef(m2))
anova(m1,m2)
On 2018-08-01 11:41 PM, Peter Paprzycki wrote:
> Thank you. Oh, was just trying to compare my random-effects model to the
> one where my grouping variable (schools) is treated as fixed.
>
> Peter
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> Virus-free. www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Wed, Aug 1, 2018 at 10:32 PM, Ben Bolker <bbolker using gmail.com
> <mailto:bbolker using gmail.com>> wrote:
>
>
> I'm not 100% sure I understand the question, but I think the answer is
> "no": lmer cannot fit a model that doesn't contain any random effects.
> Perhaps you can give more context as to why it won't work for you to
> revert to lm() or plm() in these cases?
>
> On 2018-08-01 11:30 PM, Peter Paprzycki wrote:
> > This is very basic, is there a way to specify in lmer function
> that I would
> > like to run my grouping variable as a fixed factor only, without
> reverting
> > to lm or plm functions. If one does not specify a random variable,
> one gets
> > the error message with lmer function; something that is equivalent
> to the
> > statement, "index = "grouping variable", model = "within"" with
> the plm
> > function.
> >
> >
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>>
> > Virus-free.
> > www.avg.com <http://www.avg.com>
> >
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>>
> > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models using r-project.org
> <mailto:R-sig-mixed-models using r-project.org> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> <https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
> >
>
>
>
>
> --
>
> Peter Paprzycki, Ph.D.
> Visiting Assistant Professor
> Research Support Center Manager
>
> Educational Research and Administration
> College of Education and Psychology
> The University of Southern Mississippi
> USM Box 5093; 118 College Drive
> Hattiesburg, Mississippi 39406-0001
> tel. (601)-266-4708
> email: Peter.Paprzycki using usm.edu <mailto:Peter.Paprzycki using usm.edu>
>
>
> Sidere mens eadum mutato
>
More information about the R-sig-mixed-models
mailing list