0

I would like to use a generalized linear mixed effect model. My data follows a gamma distribution but contains NA and 0 values. However, the gamma family does not allow me to compute these models if I have 0 values. Does anyone know of a way to go around this problem?

I heard that the glmmTMB package allows the use of gamma distributions with negative values, but I work on a mac, and it seems that I cannot download this package.

When I try, I get an error code stating "clang: error: unsupported option '-fopenmp'". It would be great if any of you had an idea.

socialscientist
  • 3,759
  • 5
  • 23
  • 58
  • Does this answer your question? [Running a GLM with a Gamma distribution, but data includes zeros](https://stackoverflow.com/questions/43615260/running-a-glm-with-a-gamma-distribution-but-data-includes-zeros) – socialscientist Jul 22 '22 at 02:00

1 Answers1

1

The Gamma distribution has no support on the non-positive real numbers. Accordingly, you are basically asking it to model data which it could never produce and therefore the software throws an error.

Similarly, the missing data cannot be modelled because the model you specify does not itself model or marginalize out the missing data. You will need to either replace the missing values with some number (impute missing values) deterministically/probabilistically or drop the observations with missing values.

In short, you will need to employ an alternative model. You could use the zero-inflated gamma model or the gamma hurdle. See here for an example. There is no "correct" alternative model: it is a model and you will need to think about their relative strengths and weaknesses (assumptions, etc.).

socialscientist
  • 3,759
  • 5
  • 23
  • 58
  • 1
    And in particular `family=ziGamma(link="log"), ziformula = ~1`should work if you want to fit the zero-inflated Gamma – Ben Bolker Jul 22 '22 at 02:46