2

I am analyzing the duration of discrete events that were detected in time-series data using a duration-threshold of 300 ms, i.e. the detected events can only be longer than 300 ms. When I had a look at my data I expected it to follow a shifted Gamma-distribution. This indeed seemed to be the case; when I fit the shifted data (Duration - 300 ms) to a glmer model with the Gamma(log) family I get the following DHARMa results:

DHARMa scaled residual plots

Despite the KS-test indicating otherwise I think the qqplot looks reasonable and the residuals-vs-predicted-values plot looks like there's almost no bias and no non-linearities. So I decided to move forward and do hypothesis testing between levels of a categorical factor in the model using a parametric bootstrapping procedure. Since the factor was significant I followed up with post-hoc tests using the emmeans package. However, here I run into issues since the EMMs are based on the model that was fit with shifted data: so the contrast estimate between levels of the categorical factor are now expressed as a ratio (using log-link), which obviously is wrong since I subtracted the threshold previously.

Here are a few questions that I have:

  1. Do you think shifting the data by the detection-threshold before fitting is a sensible approach to fitting this data?
  2. Is there any other distribution that I could try within the limits of glmer? I tried log-normal transformed data but it significantly underestimates the means compared to the shifted Gamma-distribution.
  3. Do you have any suggestions how to deal with the issue that I encounter during post-hoc testing?

I hope my problem and questions are somewhat clear. How would you handle this data?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
avaruus
  • 23
  • 3
  • 1
    For (3), do something like this: `emm <- emmeans(...); emmr <- regrid(emm); pairs(emmr)`. The regrid() function back-transforms the EMMs and resets everything so the comparisons won’t be in ratios. – Russ Lenth Jan 26 '20 at 15:13
  • @rvl thank you so much for your very helpful answer. I didn't know about the regrid() function. – avaruus Jan 26 '20 at 15:56

0 Answers0