3
$\begingroup$

As everybody knows, the pdf of the Weibull distribution is defined by $ f(x)= \left(\dfrac{a}{b}\right)\left(\dfrac{x}{b}\right)^{a-1}exp\left(-\left(\dfrac{x}{b}\right)^a\right)\quad \text{for } x \in \mathbb{R}^+ $, sometimes with $x \geq 0$.

I have to fit a weibull distribution to wind speed data, which sometimes occurs to be $v_i=0$ ("calm"). Using the function fitdistr from the MASSpackage in R, I've got error message:

Weibull values must be > 0

There shouldn't be a big difference, because $f(0)=0$ in every case, but I have to give a reason, why I excluded $v_i=0$ for the calculation of the Weibull distribution. Is it because of the lnin formula(10) from this article?

In case somebody wants a MWE:

library(MASS)
a = rweibull(200, shape=1.65, scale=2)
a[55]=0
fitdistr(a, densfun="weibull",lower = c(0, 0))
$\endgroup$
  • 6
    $\begingroup$ When $x=0$ for just one value in a dataset, the likelihood will be zero no matter what you set the parameters to: that's hardly useful for estimation. Although you can fix that by treating zeros as values censored below some positive amount, the presence of calm speeds implies your model is incorrect, because using the Weibull distribution is tantamount to supposing the wind is never truly calm. Consider asking about what a more appropriate model might be, because this could be a dead end. $\endgroup$ – whuber May 29 '18 at 18:09
  • 4
    $\begingroup$ "As everybody knows"... :) $\endgroup$ – Steve S May 29 '18 at 18:59
  • $\begingroup$ @whuber: "When x=0 for just one value in a dataset, the likelihood will be zero no matter what you set the parameters to". It's actually the opposite problem: if x = 0 for even a single value in the data set, then the likelihood will be unbounded if the shape parameter is less than 1. Note that if the shape parameter is 1, we have the exponential distribution (for which the likelihood function is bounded and strictly positive). $\endgroup$ – Cliff AB May 29 '18 at 19:43
  • $\begingroup$ So perhaps you can explore a zero-biased weibull distribution. $\endgroup$ – Alex R. May 29 '18 at 21:25
  • 1
    $\begingroup$ Since there is surely a lower threshold to the sensitivity of the instrument, a principled approach would be to treat zeros as left-censored at the threshold value. If the threshold is unknown, you might just infer it from the raw data. $\endgroup$ – HStamper May 29 '18 at 22:08
4
$\begingroup$

Zero values occur with probability zero under the Weibull distribution, since it is continuous. As others have pointed out, the problem here is that the likelihood for the Weibull distribution has a power term $x^{a-1}$ in it. This power form favours low values of $a$ when $x$ is low, and in the extreme case where $x=0$ this forces $a \downarrow 0$ in inference. (You have zero likelihood if $a>1$ and infinite likelihood if $a<1$.) There are two possible ways around this.

Method 1 (censoring): This method has been suggested by some of the commenters in your post. Under this method you treat the zero value as a censored value below some threshold representing the measurement limits of your instrument. This is appropriate if you think that the underlying observations have a true Weibull distribution --i.e., if there is never really a zero wind speed, but just a wind speed that is low enough that it shows up as zero in your measurement. This method can be implemented by imposing a small censoring threshold on your model and then estimating this as an additional parameter. Alternatively, you could get a reasonable approximation by replacing the zero values with a chosen (positive) threshold value.

Method 2 (zero-padding): Under this method you fit the data to a zero-inflated Weibull distribution, which allows for a discrete part to the distribution with a non-zero probability of a zero value. This is appropriate if you think that there are genuine zeros in the underlying data that occur with positive probability --i.e., there are genuine cases of zero wind speed, not just low undetectable wind speed. This method can be implemented by adding an additional parameter that represents the probability of a zero in the data, and fitting your data to this zero-padded distribution. (Note that the way you generated your random data in your post is via an implicit zero-padded distribution; that is, you generated values from an underlying Weibull distribution and then replaced a value with a zero.)

| cite | improve this answer | |
$\endgroup$
3
$\begingroup$

The issue is that the likelihood function is unbounded if there are any zeros in the dataset.

In particular, note that we can write the PDF of a Weibull distribution as

$ x^{a-1} c(a, b, x) $

with $c(a,b,0) = ab^{-a}$. Thus, if $x = 0$, then the PDF evaluates to 0 if $a > 1$, $\frac{1}{b}$ if $a = 1$ and the limit as $x \rightarrow_+ 0$ is unbounded from above if $a < 1$.

Therefore, if there is a single 0 in your dataset, the likelihood function is unbounded from above as well. So the MLE is undefined.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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