0
$\begingroup$

I am trying to apply a model to my dataset. The way my response variable has been generated is a bit convoluted but it's been checked by my supervisor - I have strings of numbers (e.g 112222333322111) and I count the length of each run of numbers (1-2, 2-4, 3-4, 1-3). I then find the median length of these blocks (here, the median of 2,4,4,3 so 3.5). This median is my response variable. Thus, the values are all positive and non-zero but can have decimals (rounding wouldn't be appropriate).

A linear model lm(median ~ Nymph + TOD, data = all_median) using an untransformed response indicates a heavy right skew (see attached).QQplot for linear model median ~ Nymph +TOD I have tried square root, log, inverse and box cox transforming my response variable but I don't get a QQplot that looks remotely normal. I then tried a gamma family with log link function GLM but my model was underdispersed(Residual deviance: 942.32 on 1812 degrees of freedom = 0.52). My predictors are both categorical (Nymph, holding a value of Adult or Nymph) and TOD (AM, MID, PM). I will be including two random effects (ID and Date) but for now, I'm trying to figure out what sort of model to do. As it is, I've run out of things to try. Would a GAM be appropriate, if so how is this done in R?

$\endgroup$

1 Answer 1

0
$\begingroup$

Welcome to the site.

Rather than change the data to try to fit a model, why not choose a model that works with the data?

There are several types of regression that could fit your data. Two that seem very appropriate are robust regression and quantile regression. I have a paper (using SAS) that discusses these at a fairly introductory level. It's on the web in a bunch of spots, the title is Alternate methods of regression when OLS is not right

$\endgroup$
1
  • 1
    $\begingroup$ Hi Peter, I'll have a read! I have to admit my stats education does go much beyond linear mixed models and GLMMs. $\endgroup$
    – lmnop
    Commented Jul 8, 2023 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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