I'm having trouble finding an appropriate model for my data. The data comprises behavioural observations of chimpanzees, where I instantaneously sampled their locomotor behaviours and parameters of the environment in which they were moving every minute. I'm interested in how age influences the types of locomotor behaviours (Modes), and the use of their environment (height in trees, diameter of branches used). I've been trying to build different models to ask a couple of different questions each with different response variables, but for simplicity I will just provide one example here.

structure(list( ID = c("BEL", "BEL", "BEL", "MYS", "MYS", "PAN", "PAN", "PAN", 
"PAN", "PAN", "PAN", "PAN", "PAN", "PAN", "PAN", "PAN", "FAU", 
"FAU", "FAU", "FAU"), Height1 = c(4, 34, 19, 9, 9, 4, 9, 4, 4, 
4, 4, 39, 34, 9, 4, 4, 24, 4, 9, 19), Dia_fac = structure(c(2L, 
3L, 2L, 3L, 1L, 2L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 3L, 2L, 3L, 3L, 
3L, 3L, 3L), .Label = c(">0_4cm", "20_80cm", "4_20cm"), class = "factor"), 
    Age_2018 = c(42, 42, 42, 43, 43, 23, 23, 23, 23, 23, 23, 
    23, 23, 23, 23, 23, 19, 19, 19, 19), Age2 = structure(c(6L, 
    6L, 6L, 6L, 6L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    1L, 1L, 1L, 1L), .Label = c("<20", "20-25", "25-30", "30-35", 
    "35-40", "40-45", "45-50", "50-55"), class = "factor"), Mode = c("Pronograde_Compressive", 
    "Pronograde_Compressive", "Vertical_Descent", "Vertical_Climb", 
    "Vertical_Descent", "Pronograde_Compressive", "Pronograde_Compressive", 
    "Pronograde_Compressive", "Pronograde_Compressive", "Vertical_Climb", 
    "Vertical_Climb", "Vertical_Descent", "Pronograde_Compressive", 
    "Gap_Crossing", "Pronograde_Compressive", "Vertical_Climb", 
    "Vertical_Climb", "Vertical_Descent", "Vertical_Climb", "Vertical_Climb"
    )), row.names = c(NA, -20L), class = c("tbl_df", "tbl", "data.frame"

For this model I want to know whether height in the tree is influenced by age. Locomotor mode and diameter of branch used are included as co-variates, as these will probably vary with height and possibly age, and I want to be able to account for these in the model. So far I have tried modelling this with log-linear, however the contingency table suffered from a large number of zeros, even after recategorisation of the variables.

Next I tried using GLMMs, and after having gone through several different iterations of the modelling process, I can't seem to get a model that has an appropriate specification. Currently my best model is the following, which specifies a zero inflated GLMM with a negative binomial distribution, and includes a random effect for ID. However there seems to be some unusual artefacts in residuals as seen in the DHARMa output below.

glmmTMB(Height1 ~ Mode * Dia_fac * scale(Age_2018)  + (1 | ID), ziformula = ~ Age_2018 + (Age_2018 | ID) , family = "nbinom1", data = df3)

enter image description here

After discussion with my supervisor, we think that we may need to specify higher-order terms, so the next step might be to try modelling with a GAM in order to help identify the terms we need to produce a well-fitted model (perhaps then returning to GLMMs with the terms we have identified). However this is not something either of us have experience of, and I was looking for some validation about whether this is the right sort of approach, or if we are missing something that we can model with the GLMM?

Thanks in advance!

  • $\begingroup$ OK, I see you have only integer-values for height, but this is likely because of the way you measured your data. Height is not likely to have the properties of count data, so I wonder how much sense it makes to treat this with a negative-binomial (which has a log-link, and all the properties that one would expect for count data). Moreover, why zero-inflation? In the data you provide, there are no zeros. $\endgroup$ – Florian Hartig Oct 30 '19 at 21:36
  • $\begingroup$ @FlorianHartig yes the height variable was measured in range categories, and then converted to integer by taking the midpoint and adding 0.5. The data represented here is just a subset which I selected randomly from the whole dataset, so it may not be very representative. When plotting out height vs the other variables, it is clear that there are no observations of specific behaviours in the highest categories for height. I'm fairly new to this, but perhaps you might have a suggestion for how to better provide a more representative sample to help people understand the data? $\endgroup$ – David Pettifer Oct 31 '19 at 16:07
  • $\begingroup$ A good representation of the data is always helpful, but in general, I think you have a normal continuous response, so there is no reason to use a GLM, start with an LM, LMM or GAM. If you are concerned that you have only positive values (which is not necessarily a problem), you can use a transformation, or fit a continuous positive model, e.g. Gamma. But I would consider this only if I see a problem with a standard model. $\endgroup$ – Florian Hartig Nov 1 '19 at 8:19

Your Answer

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

Browse other questions tagged or ask your own question.