I want to explore the relationship between the abundance of an organism and several possible explanatory factors. I have doubts regarding what variables should be called as fixed or random in the GLMM.
I have a dataset with the number of snails in different sites within a national park (all sites are under the same climatic conditions). But there are local parameters whose effects over the snail abundance haven't been studied yet.
This is a longitudinal study, with repeated measures over time (every month, for almost two years). The number of snails were counted in the field at night, always in the same 21 sites (each site has a 6x6 square meters plot, delimitated with wooden stakes).
In case it could influence the analysis, note that some parameters may vary over time, such as the vegetation cover in each plot, or the presence of the snail natural predator (measured with yes/no values). Others, however, are always the same, because they are specific to each site, such as the distant to the nearest riverbed or the type of soil.
Here is a subset of my data:
> snail.data
site time snails vegetation_cover predator type_soil distant_riverbed
1 1 1 9 NA n 1 13
2 1 2 7 0.8 n 1 13
3 1 3 13 1.4 n 1 13
4 1 4 14 0.6 n 1 13
5 1 5 12 1.6 n 1 13
10 2 1 0 NA n 1 136
11 2 2 0 0.0 n 1 136
12 2 3 0 0.0 n 1 136
13 2 4 0 0.0 n 1 136
14 2 5 0 0.0 n 1 136
19 3 1 1 NA n 2 201
20 3 2 0 0.0 n 2 201
21 3 3 0 0.0 y 2 201
22 3 4 3 0.0 n 2 201
23 3 5 2 0.0 n 2 201
28 4 1 0 NA n 2 104
29 4 2 0 0.0 n 2 104
30 4 3 0 0.0 y 2 104
31 4 4 0 0.0 n 2 104
32 4 5 0 0.0 n 2 104
37 5 1 1 NA n 3 65
38 5 2 0 2.4 n 3 65
39 5 3 3 2.2 n 3 65
40 5 4 2 2.2 n 3 65
41 5 5 4 2.0 y 3 65
46 6 1 1 NA n 3 78
47 6 2 2 3.0 n 3 78
48 6 3 7 2.8 n 3 78
49 6 4 3 1.8 n 3 78
50 6 5 6 1.2 y 3 78
55 7 1 14 NA n 3 91
56 7 2 21 2.8 n 3 91
57 7 3 16 2.6 n 3 91
58 7 4 15 1.6 n 3 91
59 7 5 8 2.0 n 3 91
So I'm interested in investigating if the number of snails is significantly different in each site and if those differences are related to some specific parameter.
So far the best statistical approach I have found is a generalized linear mixed model. But I'm struggling in choosing the correct fixed and random variables. My reasoning is, although I'm checking for the differences among sites (by comparing the number of snails) the focus of the study is the other parameters commented above, thus the site would be a random factor.
Then, my question is: should 'site' and 'time' be considered random factors and the local parameters should be the fixed variables? And should I include interactions between time and other parameters? Since climatic conditions are equal for all sites at the same time, I ruled out the possibility of interactions between time and site, is this correct?
I have set up my command as follows in R:
library(lme4)
mixed_model <- glmer(snails ~ vegetation_cover + predator + type_soil + distant_riverbed + (1|site) + (1|time), data = snails.data, family = poisson)
Would it be the correct syntax for what I have described?
I have read a couple of basic tutorials and other related posts (Generalized Mixed Model with repeated measurements, Fitting a Poisson GLM mixed model with a random slope and intercept, Interactions between random effects) that were helpful to better undertand the mixed effect models, but the context and design of the field surveys are different.