48
$\begingroup$

I'm currently trying to apply a linear model (family = gaussian) to an indicator of biodiversity that cannot take values lower than zero, is zero-inflated and is continuous. Values range from 0 to a little over 0.25. As a consequence, there is quite an obvious pattern in the residuals of the model that I haven't managed to get rid of: enter image description here

Does anyone have any ideas on how to solve this?

$\endgroup$
3
  • 4
    $\begingroup$ If it's zero-inflated it cannot be continuous, since continuous variables cannot have any jumps in the cdf (and there's clearly one at 0). It may be continuous aside from the 0's. $\endgroup$
    – Glen_b
    Dec 21, 2015 at 22:54
  • $\begingroup$ Related: stats.stackexchange.com/questions/105320 $\endgroup$
    – amoeba
    Nov 12, 2017 at 0:40
  • $\begingroup$ When it comes to modelling of the probability density function (PDF), you need to use the Dirac delta function in order to get a positive probability mass at zero (if you just try to define the PDF as an ordinary function f(x) with a specific value f(0) = y at zero, the integral of f will be independent of y and the limit of the integral from -a to a over f where a approaches 0 will be 0, so the probability mass at zero will be 0). $\endgroup$ Jan 10 at 13:24

2 Answers 2

62
$\begingroup$

There are a variety of solutions to the case of zero-inflated (semi-)continuous distributions:

  • Tobit regression: assumes that the data come from a single underlying Normal distribution, but that negative values are censored and stacked on zero (e.g. censReg package). Here is a good book about Tobit model, see chapters 1 and 5.
  • see this answer for other censored-Gaussian alternatives
  • hurdle or "two-stage" model: use a binomial (specifically, Bernoulli) model to predict whether the values are 0 or >0, then use a linear model (or Gamma, or truncated Normal, or log-Normal) to model the observed non-zero values (typically you need to roll your own by running two separate models; combined versions where you fit the zero component and the non-zero component at the same time exist for count distributions such as Poisson (e.g glmmTMB, pscl); glmmTMB will also do 'zero-inflated'/hurdle models for Beta or Gamma responses)
  • Tweedie distributions: distributions in the exponential family that for a given range of shape parameters ($1<p<2$) have a point mass at zero and a skewed positive distribution for $x>0$ (e.g. tweedie, cplm, glmmTMB packages)

Or, if your data structure is simple enough, you could just use linear models and use permutation tests or some other robust approach to make sure that your inference isn't being messed up by the interesting distribution of the data.

There are R packages/solutions available for most of these cases.

There are other questions on SE about zero-inflated (semi)continuous data (e.g. here, here, and here), but they don't seem to offer a clear general answer ...

See also Min & Agresti, 2002, Modeling Nonnegative Data with Clumping at Zero: A Survey for an overview.

$\endgroup$
5
  • $\begingroup$ @Ben Bolker Would you "use a linear model (or Gamma, or truncated Normal, or log-Normal) to model the" predicted or actual non-zero values? $\endgroup$
    – rolando2
    Jan 14, 2017 at 15:05
  • $\begingroup$ The packages gamlss and gamlss.inf provide the function gamlssZadj which allows to fit a two-part model for any distribution defined on the positive real line. It fits logit-model for the zeros and a gamlss model for the positive part of the data simultaneously. $\endgroup$ Oct 3, 2021 at 20:57
  • $\begingroup$ If feels like a Bernoulli model would be more suitable than a binomial model in the two-stage model for modelling whether the values are 0 or > 0. $\endgroup$ Jan 10 at 13:50
  • $\begingroup$ I don't usually differentiate between binomial and Bernoulli (which is just binomial with n=1). $\endgroup$
    – Ben Bolker
    Jan 10 at 13:54
  • $\begingroup$ Oh, that's true, so we mean the same thing. I guess I just like to be specific. $\endgroup$ Jan 10 at 16:19
1
$\begingroup$

You can also use the Poisson Pseudo-Maximum Likelihood (PPML). It was firstly developed by Santos Silva and Tenreyero (2006) for the application of international trade among countries. In 2011, the same authors extended the analysis of the PPML's performance (see in here). They also have this page with some material about the model. Later, it was used in many other applications. In my field, it was used in the energy economics, policy and regulation fields (for instance, Zhao et al. (2013), De Groote et al. (2016), Gautier and Jacqmin (2020))

In Stata you can use with the ppmlhdfe command and its implementation is here.

$\endgroup$

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.