I'd love a check if anyone is willing!

I am trying to see if there is a statistical difference in female size between sites. Over the years females were repeatedly sampled within sites. I have sampled females opportunistically. Meaning that females were sampled a different number of times between and within sites.

My formula is:

> lmerfit1<-lmer(size ~ (1|FEMALE), data=Data)
> lmerfit2<-lmer(size ~ SITE+(1|FEMALE), data=Data)
> anova(lmerfit1, lmerfit2)
Data: Data
lmerfit1: size ~ (1 | FEMALE)
lmerfit2: size ~ SITE + (1 | FEMALE)
         Df    AIC    BIC  logLik Chisq Chi Df Pr(>Chisq)
lmerfit1  3 2167.8 2179.6 -1080.9                        
lmerfit2  4 2169.8 2185.5 -1080.9     0      1          **1**

A p value of 1 leaves me concerned. The other female traits I ran thru this same formula made sense.


  • $\begingroup$ Just a quick check: FEMALE is supposed to be factor with several levels (actually considered as your random effect), but I would have expected something like lmer(size ~ (1|id), data=Data, subset=gender=="female"), where id is subject number, gender codes for the sex (with two levels, male/female, the analysis being restricted here on females only). Could you explain a little bit more the structure of your data, or just put the results of head(Data)? $\endgroup$
    – chl
    Commented Apr 7, 2011 at 20:58
  • $\begingroup$ Here is the head(data) $\endgroup$
    – MEL
    Commented Apr 8, 2011 at 3:22
  • $\begingroup$ I am only concerned with females because I am doing a nesting study.head(data) FEMALE YEAR SITE FSCLmm FWTg FAGE NOEGGS NumH NumNOTHatch TEMP ONETRI TWOTRI THREETRI HUMIDITY PercHatch perchatch AVHWt 1 WDW1039 2010 SPSWA 155 537 7 4 0 4 18.83456 0.01372995 NaN NaN NaN 0.00000 0.0000000 NaN $\endgroup$
    – MEL
    Commented Apr 8, 2011 at 3:29

2 Answers 2


Firstly, you need to set REML=F:

lmerfit1<-lmer(size ~ (1|FEMALE), data=Data, REML=F)
lmerfit2<-lmer(size ~ SITE+(1|FEMALE), data=Data, REML=F)
anova(lmerfit1, lmerfit2)

This will use MLE instead of REML, which is necessary because likelihoods from mixed models with different fixed effects are not comparable when REML is used.

Secondly, you could do the following quick checks:

summary(lmerfit2) # To see the size of the SITE coefficient
summary(lm(size ~ SITE, data=Data)) # To check the fixed effects estimates
plot(size ~ SITE, data=Data) # Box plot
dotplot(size ~ SITE, data=Data) # Another visual check

But given the non-significance of SITE in your reported test, and the lack of visual difference you reported in your comment, I'm guessing there is no significant main effect of SITE.


How many sites did you have? The models only differ by one df, so either you only have two sites or you treated site as a continuous variable when it should have been categorical. If it should have been a factor, use factor(SITE) instead of SITE.

Also, try plotting the data (always a good idea!) -- do you see any visual differences?

  • $\begingroup$ It is true I have two sites. I have done the plots it's pretty messy but no real visual differences that I can tell. $\endgroup$
    – MEL
    Commented Apr 8, 2011 at 3:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.