I am trying to fit a weibull distribution to my wind speed data with the following code:

fitdistr(av_ws, densfun  = "weibull") #av_ws is the wind speed data

The error appears, that the data also contains some zero's... does the function fitdistr() not working with zero's in the data? As the lowest values from a weibull distribution can be 0 I don't understand why the function is not working...

  • $\begingroup$ Welcome to CV! Please include a minimal working example, or a summary of your data and the exact error message. Also note that questions strictly about programming are off-topic here, so depending on what exactly you want to know, your question might be better suited on stackoverflow. $\endgroup$ Sep 29, 2018 at 11:46
  • $\begingroup$ If you have multiple exact zeros your data cannot reasonably be regarded random draws from a Weibull.distribution, since obtaining even a single value at least that low has probability 0; the problem is with the model rather than the function. The suggestion to consider whether you have left censored values is a good one. $\endgroup$
    – Glen_b
    Sep 29, 2018 at 22:55

1 Answer 1


If you look at the likelihood you'll see that a value of 0 results in a log- likelihood term involving $\log 0$, which is obviously problematic. In fact, i don't think that exact values of zero should occur under a Weibull distribution.

One way out would be, if your wind speed measurement device cannot measure wind speeds below some very low minimum. Then your 0s are really left censored observations (i.e. you know the speed is some number below this minimum). R, SAS, python et al. all have function for censored data (survival analysis).


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.