5
$\begingroup$

I ran a GLMM model with a binomial response to analyse bear presence at feeding sites (0 = absent, 1 = present) within two years. My code is:

m2b <- glmer(bear_pres ~ day_sc + day_sq_sc + carrion + year + cos_time_sc + year*day_sc + year*day_sq_sc + year*carrion + (1|FS), family=binomial, data=df3)

day_sc - continuous: consecutive day in the year, scaled + centered
day_sq_sc - continuous: squared cons day in the year, scaled + centered
carrion - factor: 0 = maize, 1 = carrion
year - factor: 2016, 2017
cos_time_sc - continuous: cosinus of circadian time, scaled + centered

FS (feeding site) was used as a random factor

Feeding site use throughout the year follows a quadratic function since the bears are sleeping in winter time.

The model output is:

Fixed effects:
                   Estimate Std. Error z value Pr(>|z|)    
(Intercept)        -4.96735    0.20004 -24.832   <2e-16 ***
day_sc              2.77092    0.11324  24.469   <2e-16 ***
day_sq_sc          -2.91139    0.11433 -25.464   <2e-16 ***
carrion1           -0.01297    0.05498  -0.236    0.814    
year2017           -0.08360    0.05375  -1.555    0.120    
cos_time_sc         1.04995    0.01331  78.858   <2e-16 ***
day_sc:year2017    -1.24212    0.14718  -8.439   <2e-16 ***
day_sq_sc:year2017  1.36397    0.14726   9.262   <2e-16 ***
carrion1:year2017   0.85209    0.10202   8.352   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) day_sc dy_sq_ carrn1 yr2017 cs_tm_ d_:201 d__:20
day_sc      -0.037                                                 
day_sq_sc    0.039 -0.987                                          
carrion1    -0.148  0.013 -0.012                                   
year2017    -0.150  0.137 -0.144  0.879                            
cos_time_sc -0.054  0.006 -0.006 -0.001 -0.001                     
dy_sc:y2017  0.028 -0.760  0.749 -0.008 -0.150 -0.001              
dy_sq_:2017 -0.030  0.757 -0.766  0.004  0.152  0.001 -0.987       
crrn1:y2017  0.128  0.001 -0.001 -0.914 -0.909  0.004 -0.003  0.009

So for the simple effects of day_sc and day_sq_sc:

day_sc 2.77092 # positive beta for the linear term - use of feeding sites goes up at the beginning of the year

day_sq_sc -2.91139 # negative beta for the quadratic term - use of feeding sites goes down after an inflection point - concave

So my questions are:

1) Are the simple effects for day_sc and day_sq_sc then just for the year 2016 OR year 2016 and maize feeding sites?

2) How do I interpret the interaction? I red that the best way to do it is to plot the results, but I have difficulties to interpret the plots.

day_sc:year2017    -1.24212    0.14718  -8.439   <2e-16 ***
day_sq_sc:year2017  1.36397    0.14726   9.262   <2e-16 ***  

A) This plot shows the feeding site use in 2016 and 2017
Note: I excluded the winter months (Dec, Jan, Feb) due to a lack of data.

interaction.plot(df4$day, df4$year, df4$all, col=1:2)

enter image description here

These are some interaction plots I tried

1) Using the effects package following this link
https://quantdev.ssri.psu.edu/tutorials/five-ish-steps-create-pretty-interaction-plots-multi-level-model-r

ef1 <- effect(term="day_sc:year", xlevels= list(days_sq_sc=c(-1, 1)), mod=m2b)
efdata1<-as.data.frame(ef1) #convert the effects list to a data frame
efdata1 

efdata1$year<-as.factor(efdata1$year)


ggplot(efdata1, aes(x=day_sc, y=fit, color=year,group=year)) + 
  geom_point() + 
  geom_line(size=1.2) +
  geom_ribbon(aes(ymin=fit-se, ymax=fit+se, fill=year),alpha=0.3) + 
  labs(x= "days_sc", y="fit", color="year", fill="year") + theme_classic() + theme(text=element_text(size=20))

B) enter image description here

C) enter image description here

And in the jtools package

interact_plot(m2b, pred=day_sc, modx=year, data = df3)

D) enter image description here

interact_plot(m2b, pred=day_sq_sc, modx=year)

E) enter image description here

While plots B & D and C & E are showing similar results, I can't see how this relationship arises from plot A, why 2016 lies above 2017. When doing a simple model with only main effects, feeding site use was generally higher in 2017, however, plot A shows that bears used FS more during the summer in 2016. Is this connected to the interpretation as I used scaled predictors? Zero in the scaled plots corresponds to day 205 in the year (23.07.2016 and 24.07.2017 resp.). Any help with interpretation would be greatly appreciated!

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.