My dataset consists of several morphological measurements for 5 island populations of a certain lizard species. I want to test for each population if there is a significant difference in the measurements between males and females (sexual dimorphism or SD). Additionally I want to test whether there is a significant difference in the magnitude of SD between the populations.
My professor said I should do an ANOVA in R with sex and population as factors. This is my code:
lm3 <- lm(logSVL ~ sex + Place + sex:Place)
For the morphological measurement SVL (general indication of body size) I see a significant effect of sex and population (both p<0.0001) and no significant interaction between sex and population (p=0.5). When I try to look at two by two differences in population (I guess this is how I see if there is a significant difference between each population) with this code:
TukeyHSD(aov(logSVL ~ Place + sex))
I get the next error:
Error in rep.int(n, length(means)) : unimplemented type 'NULL' in 'rep3'
In addition: Warning message:
In replications(paste("~", xx), data = mf) : non-factors ignored: sex
What did I do wrong?
My professor also said that an ANCOVA with SVL as covariate might be more correct than an ANOVA. I tried an ANCOVA as follows:
lm1 <- lm(logSVL ~ Place + sex + sex:Place)
My handbook for R said that I should then do several tests like summary(lm1)
, coef(lm1)
but I don't know how to interpret the output. I also don't know how to check if all the assumptions are met, the handbook is a bit confusing.
Did I do the ANOVA and ANCOVA right? If no, what did I do wrong? Is ANCOVA really better in my case? My thesis is due to the 13th, I know it's a lot of questions but I really hope someone can/wants to help me. Thanks anyway.