1
$\begingroup$

I have camera trap data where for each site and hour I have the abundance of wild herbivores. I want to create a model where I can estimate the effect of predator activity on the activity and behavior of these herbivores.

Looking at the kernel density of all the data (see figure), there is clear periodicity (24 hour) in activity with drops during dawn and dusk (predator avoidance). There is also a subtle drop during the hottest period of the day which is related to resting. There's a lot of zero's (as with any camera trap study) so Ive included a zero inflation formula.

kernel density of wild herbivore, diel cycle

Im quite new to periodic regression, but if I understand it correctly I should include a 'fundamental'period of 24 hours, and optionally some harmonics to modulate the signal.

The following model is one of the best models (based on AIC):

model <- glmmTMB(Abundance ~ 
                     cos(hour*2*pi/24) + sin(hour*2*pi/24) + 
                     cos(2*hour*2*pi/24) + sin(2*hour*2*pi/24)

                   +(1|site)

                   ,ziformula = ~1,   

                   family = nbinom2, 
                   data = wb) 

The graph with the predicted values looks as follows:

predicted values

It kind of resembles the kernel density, so I feel that it should be ok BUT the p values of the sinus terms are not significant (in all the models that I considered). Also, the zero inflation part is not significant.

The output for the above model:

Family: nbinom2  ( log )
Formula:          Abundance ~ cos(hour * 2 * pi/24) + sin(hour * 2 * pi/24) + cos(2 *  
    hour * 2 * pi/24) + sin(2 * hour * 2 * pi/24) + (1 | site)
Zero inflation:             ~1
Data: wb

     AIC      BIC   logLik deviance df.resid 
  3024.3   3072.4  -1504.1   3008.3     3016 

Random effects:

Conditional model:
 Groups Name        Variance Std.Dev.
 site   (Intercept) 0.1461   0.3823  
Number of obs: 3024, groups:  site, 6

Overdispersion parameter for nbinom2 family (): 0.0765 

Conditional model:
                          Estimate Std. Error z value Pr(>|z|)    
(Intercept)               -1.50487    0.17534  -8.583  < 2e-16 ***
cos(hour * 2 * pi/24)     -0.85531    0.11930  -7.169 7.53e-13 ***
sin(hour * 2 * pi/24)      0.10085    0.11358   0.888  0.37458    
cos(2 * hour * 2 * pi/24) -0.29770    0.10491  -2.838  0.00454 ** 
sin(2 * hour * 2 * pi/24) -0.02808    0.12349  -0.227  0.82013    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Zero-inflation model:
            Estimate Std. Error z value Pr(>|z|)
(Intercept)   -16.56    2659.26  -0.006    0.995

My specific questions:

  • Is it a problem that the sinus predictor is not significant? Should I drop it and just keep the cos predictor? why?

    • How do I interprete the non significant p value for the zero inflation part?
$\endgroup$
0
$\begingroup$

You should think about the science before worrying about the tests/p-values. Think about what a cosine only model really means. That model puts the extreme values (highest peak and lowest valley) happening at exactly noon and midnight (for the 24 hour part, add in 6:00 and 18:00 for the 12 hour cycle). Does it make sense from a scientific background of where your data comes from for the extremes to be at exactly those times? If no, then the tests on the sine pieces is not answering a question of interest. If yes, then is comparing the model with constrained times for the extremes to one where the extremes could occur at different times an interesting scientific question? if yes, then the p-values for those tests can be interesting, but remember that they are testing the single term conditional on the other terms being in the model, it is possible that dropping one of the sine terms will cause the other to become significant.

I am not familiar with the specific function that you are using, but I would be very nervous about the huge standard error. Google "Hauck Donner effect", when using Wald approximations for binomial distributions it is possible to get results like this and you should really look at a likelihood ratio style test (again, if the question is truly of scientific interest).

$\endgroup$
  • $\begingroup$ Clear. I tried a cosine only model and indeed the peak and low are exactly at noon and midnight and this obviously doesnt make sense from a scientific background. So, would it be OK to just keep the non significant sin predictor? what would be the difference in interpretation between a significant and non-significant sin term? $\endgroup$ – Inger Jun 11 at 16:07
  • $\begingroup$ @Inger, yes, when the goal is prediction/estimation rather than testing, there is nothing wrong (and a lot right) with keeping "non-significant" terms. If you go back to trigonometry class and look at the formula for sine (or cosine) of a sum along with a little algebra you can see that using the combination of sin and cos is equivalent to fitting a sine or cosine curve with an offset of where the peaks/valleys are. You can use algebra to calculate the exact offset, or estimate from plots. $\endgroup$ – Greg Snow Jun 11 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.