0

I wanted to explore if the change in speed between day and night is similar among a set of individuals. To me, the logic way of testing this hypothesis is running a random intercept model and a random slopes model, and see which one has a lower AIC for instance. However, the response variable (speed) is not normally distributed.

enter image description here

I tried a log transformation, and the variable became more similar to a Gaussian distribution, so I run these two models:

 ri=lmer(logspeed ~ daytime + sex + 
     total_length +(1|tag_id), 
     allspeed_daytime)
 ris=lmer(logspeed ~ daytime + sex + 
     total_length + (daytime|tag_id), 
     allspeed_daytime)

where "ri" represents a random intercept model, and "ris" a random slopes model.

Before checking which one is better, I wanted to plot the change of my response, logspeed, over daytime (the categorial variable with two values: "day" and "night") as predicted from the models. As expected, the random intercept model results in parallel lines for the different individuals, and the random slopes model allows more flexibility and fits different slopes for the different individuals:

enter image description here

But of course I´m not interested in logspeed, but rather on the original scale, to understand if the rate of change in speed is the same among individuals or not. The "problem" is that if I back transform "logspeed" by taking exponential, and do the plot on the "speed" scale, the random intercept model results in a plot with different slopes actually, where individuals differ in their intercept, but also in their rate of change between day and night.

enter image description here

My second attempt was to not transform speed, and use a Gamma family distribution. However, if I use the "link=log" I get similar results to the ones above, as expected, because the underlying transformation is also a logarithm.

I´m completely aware about why I get the plots I get, but my question is, **how can I test then if individuals vary in their rate of change in speed between day and night **?

David VR
  • 125
  • You could maybe try a gamma generalized linear mixed model? – kjetil b halvorsen May 07 '22 at 18:12
  • Thanks. Using a Gamma distribution with link log was my second attempt, as I initially posted, but since link=log also uses a logarithmic transformation, the problem still persists: I still don´t know how to test if individuals vary in their rate of change in speed between day and night ...cheers. – David VR May 08 '22 at 20:47
  • If mean speeds differ, then log of mean speeds differ! You will be interested in the good answers at https://stats.stackexchange.com/questions/47840/linear-model-with-log-transformed-response-vs-generalized-linear-model-with-log – kjetil b halvorsen May 20 '22 at 12:10
  • Thanks you, but how this relates to my question which is about testing plasticity (i.e. random slopes) using a variable that is non-Gaussian...? – David VR May 21 '22 at 19:00

0 Answers0