Fitting Weibull Parameters via MLE

We show how to estimate the parameters of the Weibull distribution using the maximum likelihood approach. The pdf of the Weibull distribution is

Weibull pdf

and soWeibull distribution likelihood function

Maximizing L(α, β) is equivalent to maximizing LL(α, β) = ln L(α, β). Now

We can now use Excel’s Solver to find the values of α and β which maximize LL(α, β).

Example 1: Find the parameters of the Weibull distribution that best fit the data in range A4:A15 of Figure 1 (i.e. repeat Example 1 of Method of Moments: Weibull Distribution using the MLE approach).

We use Excel’s Solver to maximize LL(α, β) by selecting Data > Analysis|Solver, and then filling in the dialog box appears as shown in Figure 1.

Weibull fit MLE Solver

Figure 1 – Calculating the Weibull parameters using Solver

Prior to using Solver, we place the formula =($E$4-1)*LN(A4)-(A4/$E$3)^$E$4 in cell B4, highlight the range B4:B15 and press Ctrl-D. Next we place the formula =SUM(B4:B15) in cell B16, the formula =COUNT(A4:A15) in cell E5 and the formula =E5*(LN(E4)-E4*LN(E3))+B16 in cell E6, and then we initialize cells E3 and E4 with the results from Figure 2 of Method of Moments: Weibull Distribution, i.e. alpha = 691.0264 and beta = 3.768325.

Upon pressing the OK button, the results shown in Figure 2 appear.

Finding Weibull parameters MLE

Figure 2 – Weibull parameters based on MLE

Examples Workbook

Click here to download the Excel workbook with the examples described on this webpage.

References

Forbes, C., Evans, M., Hastings, N., Peacock, B. (2011) Statistical distribution. Wiley
https://www.academia.edu/49056503/Statistical_distributions

Cohen, A. C. (1965) Maximum likelihood estimation in the Weibull distribution based on complete and on censored samples
https://www.stat.cmu.edu/technometrics/59-69/VOL-07-04/v0704579.pdf

Millard, S. P. (2023) Estimate parameters of a Weibull distribution
https://search.r-project.org/CRAN/refmans/EnvStats/html/eweibull.html

68 thoughts on “Fitting Weibull Parameters via MLE”

  1. With the new LET function (Obtained with Office Insider and if you use Calibri Font for example to have α … ) we have only to paste this line:
    French:
    =LET(α;E$4;β;E3;x;A4:A15;SOMME(LN(LOI.WEIBULL.N(x;α;β;0))))
    English something as:
    =LET(α,E$4,β,E3,x,A4:A15,SUM(LN(WEIBULL.DIST(x;α;β;0))))
    (… It could be corrected and extended for censored data)

    Have you ideas: how to launch the solver in a function as “LET” with the parameters of the solver ? (The solver is not a function, it could be a function ?)

    Thanks in advance

    Reply
  2. Hi Charles

    I’m struggling with Weibull distribution, my excel file is not ending up. Please send me an email.

    Thank you

    Reply
  3. Hello Charles

    Can you explain the reason why multiplying all the function values generates the likelihood? I have read the other articles about MLE and can’t find an explanation for that definition.

    Further on, i don’t understand why you take the log of the likelihood function? Why can’t you just insert the formula with the multiplication in Excel and use the solver function? Is it only to reduce calculation time?

    Thanks in advance

    Kevin

    Reply
    • Hi Kevin,
      If you assume that the sample elements are chosen independently, then the probability that this particular sample is chosen is equal to the product of the probability for each element. P(A & B) = P(A) x P(B).
      If you are using Solver then, as you say, there isn’t a big advantage of taking the log. The only benefit could be with very large numbers since the product of such values might lead to overflow (i.e. a value too big), while the logs of the values are smaller and adding will produce smaller results than multiplying. If you are using other approaches (such as Newton’s method), then using the log simplifies the calculations.
      Charles

      Reply
  4. I just noted that in this definition of the Weibull function the role of alpha and beta is reversed compared to the Excel Weibull.dist() function. At first I tripped over this and couldnt understand why the calculated Fit is “so bad”, but after exchanging the values in Weibull.dist it now makes sense.

    Reply
      • I do like the idea of using the Excel solver to find the best-fit values. (Need to make sure it doesn’t home in on a local minimum I guess.)

        I agree that there isn’t a generally accepted definition of r^2 for the Weibull distribution. However, what is often done is that the results are plotted on a Weibull plot. If you “linearise” the axes, you can then work out an r^2 value. There are some criterea published for estimating whether data is a “good fit” using this approach essentially by finding whether it is within a defined confidence limit.

        Reply
      • Hi Charles. Does using the solver give us a result closer to the shape and scale parameters than with linear regression? I would like to use this method to calculate failure probabilities. Thank you so much for the valuable Weibull Excel tips.

        Reply
        • Hello Diogo,
          For the example given on the website, the Solver approach yields better estimates than the regression approach. This is because the log-likelihood estimate is lower (-78.8396 vs. -78.9156). I don’t know whether this is true in general, but it probably is.
          Charles

          Reply
          • Hi Charles! I succeeded to create the spreadsheet! However, I have one more question. Is the confidence interval applied to the LL(alpha,beta) values or to the time-to-failure data itself? Because using Excel’s Regression, it generates the r, the intersection, the p-value and other results. Thank you so much!

  5. Hello Chales,

    Hope you are doing Great!

    CAn you please provide me with this exact excel where you have done the MLE analysis?

    Reply
  6. Hi Charles, is the MLE is the same as Extreme Value using Weibull? I have some measurements and I want to predict the maximum measurement that can be reached over certain period of time – is this the way to do it?

    Reply
    • Sorry, but I don’t understand your question. Extreme Value is a distribution that has some relationship to the Weibull distribution (via the Generalized Extreme Value distribution), but I don’t know if this is what you are referring to.
      Charles

      Reply
      • Thanks Charles,
        Yes I was referring to the Extreme Value Distribution and its relation to the Weibull Distribution. I have some corrosion data that I need to predict the maximum value it can attain. I have seen some work online done and I am not aware how to do that!

        Reply
        • Sorry, but I am not an expert on the Extreme Value distribution and so I don’t know the relationship between MLE and the Extreme Value distribution (probably the Maximum Extreme Value distribution).
          Charles

          Reply
  7. Hi Mr charles, don’t you have videos on how to estimate the shape and scale parameters of wind data using the maximum likelihood method in excel? or please do recommend any website for this.

    I have wind data from 2013-2018 and I am struggling to get estimate the parameters.

    Reply
    • I am sorry but I don’t have a video for this. I plan to add some videos but so far had not had the time to do so.
      This webpage is designed to tell you how to estimate the shape and scale parameters. Do you have any specific questions that I can help you with?
      Charles

      Reply
  8. Charles,
    The example we have here has one unique time for each sample. What would happen if there are more than one sample for some time points? What modification we do need to make to fit the Weibull distribution on such survival data.

    I understand that you had mention that di=1 at ti is the assumption we set early.

    Thanks,
    -Sun

    Reply
    • Sun,
      Are you referring to fitting a Weibull distributions via MLE to a data sample? If so, you can have multiple sample elements with the same values.
      Charles

      Reply
      • Just to be sure I understand what you said… No matter how many samples failed at the same time point, estimating the Weibull distribution parameters (ie, the method described on the website) won’t be affected as long as I have the multiple same failure times presented in the data.

        Is this correct?

        Reply
        • Hello Sun,
          I believe that your assertion is correct, but the I am assuming that you are simply stating that the approach described on this webpage is suitable even if there are repetitions in the data.
          Charles

          Reply
  9. Charles,
    Under the fitting Weibull parameters using MLE and Newton’s Method, there is a typo in calculating the beta(k+1) value. The ratio of h(beta) and h'(beta) should be subtracted from beta(k) instead of 1.

    I have one question for you. Is it true the sum(t/alpha)^beta is always the same as the number of sample (uncensored)? In this specific example, the calculated value is the exactly same as n=12. And the formula for cell D8 and K16 (ie, MLE) implies that the summation value is the same as the sample size (ie, D6). I do appreciate your input.

    Thanks,
    -Sun

    Reply
  10. Hi Charles, I have dataset of 1000 data-points. Can you tell me how do i go about estimating the parameters for pareto distribution by the method of Maximum Likelihood estimator using Solver Add-in?

    Reply
    • Hello Dharmil,
      The approach is the same as for the Weibull distribution, but you must first calculate the maximum likelihood estimator. This is not yet supported in Real Statistics, but you should be able to find it using google.
      Charles

      Reply
  11. Hi Charles, I was wondering in the case were we are useing the mle to solve for the parameters of the Weibull, shouldn’t we be minimising the log likelihood not maximising

    Reply
  12. This is really good work thank you. I have a suggestion: Your treatment of censored data may be limiting. It allows you to define an age, and then the number of components that have survived to that age. In an applied use-case where Weibull is used to determine the age/failure pattern of components being run operationally (not a design life-test), then components that have planned restorative or replacement maintenance generate right censored data (or suspensions), where the ages of each observation may vary.

    Reply
  13. Thanks, Do you have any plan of putting this technique step by step on your webpage like the current webpage so that we can walk along with instructions.? I will wait for this release.

    Reply
  14. Hello Charles,
    i need to do the same estimation via MLE but i have the right censored data only. By now few unit has failed out of total units in field. How to do achieve the parameter for population from censored data? i have also searched over various places but could not find anything conclusive.
    One place where i found relevant information but not able to implement as on my data the formula gives error. i hope you will help me out

    http://www.epixanalytics.com/modelassist/AtRisk/models/Weibull_right_censored.xls

    Reply
    • Jain,
      Good timing. I have already added censored data to fitting Weibull parameters. This will appear in the next release of the Real Statistics software (Rel 5.4) and should be available in a couple of days.
      Charles

      Reply

Leave a Comment