# Check of R command and output of unbalanced repeated measures ANOVA

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
Models:
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.

thanks!

-
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)? –  chl Apr 7 '11 at 20:58
Here is the head(data) –  MEL Apr 8 '11 at 3:22
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 –  MEL Apr 8 '11 at 3:29

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.