Reputation: 1
I am looking at average home range size on two sites (one that has undergone habitat restoration and the other is an experimental control) during three phases of the restoration process (before, during, and two years after). I am wanting to see if differences in mean home range size differ across sites and periods. Based on having two categorical variables (site and period), I assume this would be done using a repeated measures ANOVA? I was needing to see what code would be used since I have never done an ANOVA in R before.
rm (list = ls())
hrdata=read.csv(xxx)
hrdata
Upvotes: 0
Views: 450
Reputation: 2232
I think you could do this with a linear model, but see (https://stats.stackexchange.com/questions/20002/regression-vs-anova-discrepancy-aov-vs-lm-in-r) for a discussion of anova vs regression.
the code would look something like this:
lm1 <- lm(HRS ~ Site * Period, data=hrdata)
The first bit of this code is simply storing this linear model (lm
) as an R object, which we have named lm1
.
then you can do:
summary(lm1)
This would look at the effects of Site (habitat restoration vs control), Period (before, during, and after), and the interaction between the two.
There are lots of posts about interpreting these summary results. I have posted some below. This first one may be useful if you aren't sure how to interpret the interaction terms:
Upvotes: 0