[R-sig-ME] level-dependent explanatory variables
Julian PICHENOT
julian.pichenot at cerfe.com
Tue Aug 5 17:26:37 CEST 2008
Dear mixed models list,
I am trying to fit models with lme4 for a data set which has an
unbalanced and hierarchical structure.
The goal is to model the presence/absence (0/1) of a frog species in
ponds, considering potential explanatory variables measured at three
levels (spatial scales).
The nested structure is as follow : 1516 ponds are nested within 134
patches and these patches are nested within 24 landscapes.
There are 3 variables measured at each level :
Pond level : A1,B1,C1
Patch level : D2,E2,F2
Landscape level : G3,H3,I3.
This is the structure of the data set :
> str(msc)
'data.frame': 1516 obs. of 13 variables:
$ y : int 0 1 0 1 0 0 0 1 0 0 ...
$ A1 : num -0.758 -0.835 -0.835 -0.757 -0.757 ...
$ B1 : num -1.77 -1.77 -1.77 -1.80 -1.80 ...
$ C1 : num -0.262 -0.189 -0.189 -0.286 -0.286 ...
$ D2 : num 0.869 0.869 0.869 0.869 0.869 ...
$ E2: num -2.49 -2.49 -2.49 -2.49 -2.49 ...
$ F2 : num -1.09 -1.09 -1.09 -1.09 -1.09 ...
$ G3 : num -0.327 -0.327 -0.327 -0.327 -0.327 ...
$ H3 : num -1.56 -1.56 -1.56 -1.56 -1.56 ...
$ I3 : num 1.15 1.15 1.15 1.15 1.15 ...
$ POND : int 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 ...
$ PATCH : int 1 1 1 1 1 1 1 1 1 1 ...
$ LAND : int 1 1 1 1 1 1 1 1 1 1 ...
Due to the fact that they are measured at a higher level than the
pond, the values of D2,E2,F2 are repeated for each pond in a one
particular patch and the values of G3,H3,I3 are repeated for each pond
of each patch in one particular landscape.
Here is the code that I use :
> glmer(y~A1+B1+C1+D2+EP2+F2+G3+H3+I3+(1|LAND/PATCH),family=binomial,data)
But I find the results a bit strange. Only the variables measured at
the pond level are significant and I have doubts about this.
Is there another way to fit a model that takes into account the
spatial scale of each explanatory variable ?
I use the following packages :
> sessionInfo()
R version 2.7.0 (2008-04-22)
i386-pc-mingw32
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lme4_0.999375-22 Matrix_0.999375-10 lattice_0.17-6
loaded via a namespace (and not attached):
[1] grid_2.7.0
Thanks in advance for your help and answers.
Best regards.
Julian
More information about the R-sig-mixed-models
mailing list