In a study on a bird species, I observe 558 locations. Each location is assigned one of 4 cases:
- never occupied by the species (never)
- occupied in the past but abandoned now (past)
- occupied in the past and now (always)
- not occupied in the past, but occupied now (current)
I have a set of explanatory variables (climate and landscape-structure). A simplified version of the data looks like this:
>bird.data
location_ID case region temperature forest.coverage
1 current A 7.6 33
2 always A 8.1 65
3 current B 7.4 82
4 never A 9.0 11
5 always C 6.8 22
6 past A 8.1 46
7 past B 7.8 51
8 current C 7.9 52
... ... ... ... ...
In R, I want to test weather the explanatory variables have an effect on the past and current occurence of the bird species. As a start, I want to compute univariate glmm using the lme4
-package. region
is supposed to act as a random factor. Similar to anova, I hope that this can help to show wether the four groups differ in their explanatory variables.
I would try something like
lmer(case~temperature + forest.coverage + (1|region), data=bird.data)
However, I am not familiar with modeling categorical response variables. Are there any rules to follow? Especially: where can I start in Order to determine a useful family for my case?
glmer
function (as suggested above)family = binomial
. Edit: @Björn 's suggestion is also nice. This would require transforming your data into long format with a variable occupied (yes/no) and time (past/present). It really depends on what you want to know exactly. $\endgroup$glmer
so far, so I will have a read on it - thank you! $\endgroup$