Dear R_help
list members!
 
I’m
studding forest carnivores and I have data on resting site selection and use!
 
I’m trying
to model the probability that a forest carnivore might have in be located in a
tree hollow (1) (the main resting site selected) rather than elsewhere (0)
(other resting site types, dens, nests, etc.). 
The model
should be related with several variables such as for instance:
 
SHRUB_CV –
shrub cover;
D_RIPARIAN
– distance to riparian habitats
FOREST_PP –
forest habitat (tree availability) proportion in each sampling unit (1 km
buffer around each resting site)
D_RIP_KM –
distance to the nearest riparian habitat..
Day – day
of the year…
 
My data
consist of a daily resting site monitoring of 21 animals (during the time that
each radio-collar battery allowed) ranging from 40-380 days…The study was
conducted in the 2010-12 period…
So, in the
final I got a data base with more than 3300 observation events (an event is an
animal present in a resting site each day).
Several
resting sites were used more than once by the same individual, but some times
the same resting site were used by two or more animals (few times I had two
animals in the same day and in the same resting)…leading to, that for some
covariates, the values are the same across animals when they…
Also, in most
of the days I had more than one resting site event because during most of the
study I followed more than one animal at the same time…
Because I was not
interest if there is an animal effect on tree hollow probability use, I used
animal as random effect in the models. In addition, we assume that an
individual from the forest carnivore population will behave more or less the
same way concerning tree hollow use. This lead me to the mixed-effects
modelling techniques. 
Additionally,
because I get truly non-linear relationship between some of the covariates
(e.g. SHRUB_CV) with the response variable it leads me to the gamm option…
I start the
model building procedure by finding firstly the best fixed structure and after
the best random effect structure and finally the best model.
 
I my case
my first attempt final model was obtained by:
 
Model <-
gamm4(TREE_01 ~ s(Day) + T_MAX + SHRUB_CV + D_AV5RS_KM + 
D_RIP_KM +
FOREST_PP, random = ~ (1 | fAnimal),
method =
"REML", control = lmc, family = binomial, data = RSTEMP_01_X2)
summary(Model$gam)
 
Family:
binomial 
Link
function: logit 
Formula:
TREE_01 ~
s(Day) + T_MAX + SHRUB_CV + D_AV5RS_KM + D_RIP_KM + 
    FOREST_PP
Parametric
coefficients:
                               Estimate    Std. Error     z value     Pr(>|z|)    
(Intercept)              5.83792     0.91031    6.413    1.43e-10 ***
T_MAX                -0.06309    0.02161   -2.919    0.003509 ** 
SHRUB_CV         -7.72088    0.46859   -16.477   < 2e-16 ***
D_AV5RS_KM     1.94569     0.53025     3.669     0.000243 ***
D_RIP_KM           4.65035      0.60978      7.626     2.42e-14 ***
FOREST_PP          2.09453     0.58465      3.583     0.000340 ***
Signif.
codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05
‘.’ 0.1 ‘ ’ 1 
Approximate
significance of smooth terms:
                edf      Ref.df  Chi.sq  p-value   
s(Day)    5.332   5.332    18.57    0.00316 **
Signif.
codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05
‘.’ 0.1 ‘ ’ 1 
R-sq.(adj) =  0.541     glmer.ML score = 1117.3  Scale
est. = 1         n = 3358
 
I used the
‘gamm4’ package because it performs better than the ‘mgcv’ for binomial
response variables…
However,
now I have to check for temporal correlations structures since my monitoring
programs was in a daily basis it seems, at least, biologically that I would
have temporal correlation between days, i.e. the resting site that an animal
use in one day is correlated with the one used in the day after… 
I used the
formula ‘acf’ from the ‘nlme’ package, I got the temporal autocorrelation plot,
and I confirmed that I have correlation, especially in the first 5 days…
The
problems arrived after this, when I try to add some correlation structures in
the model I got the following error:
 
Error in
Initialize.corARMA(X[[2L]], ...) : 
covariate
must have unique values within groups for "corARMA" objects for
instance…
 
How can I
solve this problem, it is because I have the same value for some covariates
across the same animal and between animals?
If it is?
How can I manage that, because my data should allowed for this because it is normal
under this ecological data that a animal during their life time use several
times the same resting site and some times they are shared between males and
females and females and juveniles/sub-adults. 
Should I
have to create a grouping variable that can disentangle the parts…?
Should I
have to change the random effect part…?
 
Anyone can
help me?
 
Best
regards!
 
Filipe
Carvalho
 
Filipe Carvalho, MSc, PhD student.
Unidade de Biologia da Conservação (UBC) e
Centro de Investigação em Biodiversidade e 
Recursos Genéticos (CIBIO),
Universidade de Évora,
Casa Cordovil, 2º Andar, Rua Dr. 
Joaquim Henrique da Fonseca, 
7000-890 Évora, (PORTUGAL)
Telefone: + 351266759350


Filipe Carvalho, MSc, PhD student.
Conservation Biology Unit (UBC) and
Research Center in Biodiversity and 
Genetic Resources (CIBIO),
University of Évora,
Casa Cordovil, 2º Andar, Rua Dr. 
Joaquim Henrique da Fonseca, 
7000-890 Évora, (PORTUGAL)
Phone: + 351266759350

	[[alternative HTML version deleted]]

