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:
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:
- Do you think shifting the data by the detection-threshold before fitting is a sensible approach to fitting this data?
- 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.
- 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?