---
title: "Using optimization to maximize a likelihood calculation to obtain MLEs"
canonical: "https://modelassist.epixanalytics.com/space/EA/26575326/Using%20optimization%20to%20maximize%20a%20likelihood%20calculation%20to%20obtain%20MLEs"
format: markdown
---
We have discussed [elsewhere](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575325/) the use of optimization to minimize a goodness-of-fit statistic to determine the parameters that best fit a distribution to a data set. The most powerful use of optimization would, however, be to maximize a likelihood function because of the [desirable properties](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575336/) a likelihood function has for parameter estimation. We offer four examples here that demonstrate the power of MLE optimization methods where we have [complete or censored data](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575307/).

  


  


***Examples***

  


We provide four examples of using MLE optimization to fit a [Weibull](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575257/)(0,b,a) distribution to the [four censored data possibilities](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575307/), and with the same data set (censored to fit the circumstances) for comparison. For illustrative and comparison purposes the data were generated from a Weibull(0,6,1.5) distribution. The log likelihood function is maximized in place of the likelihood function because it produces fewer problems: Excel, like any mathematics package, has a limited number of digits at its disposal to define values, and a joint probability calculation quickly produces exceedingly small numbers. Excel <span style="color: #ff0000">[array functions](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26576887/)</span> are used to calculate the likelihood functions because it reduces the calculation location to one cell, and you can then use that formula to obtain the joint and marginal distributions of the two parameters [by creating a table](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575323/).

  


<details>
<summary>MLE fitting to complete data</summary>

For complete data, the log-likelihood function is the sum of the log probability density f(x;a,b) for each observation:

> Macro (mathinline)



![image](media://3d170c2a-f683-44ac-9eed-267913aa1a3c)

In the model [Weibull Complete](#WeibullComplete) is equivalent to:

  


                {=SUM(LOG(WEIBULL(Data,Alpha,Beta,0)))}

  


which is an [array function](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26576887). "Data' is the array of observations.

> Macro (anchor)



The links to the Weibull Complete software specific models are provided here:
</details>

  


<details>
<summary>MLE fitting to left-censored data</summary>

For left-censored  data, we need to look at the probability that *nT* random samples from the population distribution would lie *below* the minimum threshold *T* of an interval, together with the probability of observing the exact values of the *n* samples that are recorded. Thus:

  


![image](media://b1aa9fd5-b824-429d-a4f9-301f75dcb13c)

> Macro (mathinline)



  


In the model [Weibull Left Censored](#WeibullLeftCensored) this is equivalent to:

  


{SUM(LOG(WEIBULL(Data,Alpha,Beta,0)))+LOG(WEIBULL(T,Alpha,Beta,1))*nT}

  


which is an [array function](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26576887).

> Macro (anchor)



The links to the Weibull Left Censored software specific models are provided here:
</details>

  


<details>
<summary>MLE fitting to interval-censored data</summary>

For interval-censored  data, we need to look at the probability that a random sample from the population distribution would lie *between* the minimum and maximum values of an interval, which is just the difference between the two [cumulative distribution functions](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26574886). Thus:

  


![image](media://2abc599f-dac4-4f2d-a76a-6fb39d09e775)

> Macro (mathinline)



  


where there are c number of intervals, ni is the number of observations in interval i, and lowi and highi are the lower and upper bounds of interval i. In the Excel model [Weibull Interval Censored](#WeibullIntervalCensored) this is equivalent to:

  


{=SUM(Frequency*LOG((WEIBULL(High,Alpha,Beta,1)-WEIBULL(Low,Alpha,Beta,1))))}

  


which is an [array function](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26576887). "Frequency' is the array of ni, "Low' is the array of lowi, and "High' is the array of highi.

> Macro (anchor)



The links to the Weibull Interval Censored software specific models are provided here:
</details>

  


<details>
<summary>MLE fitting to right-censored data</summary>

For right-censored  data, we need to look at the probability that *nT* random samples from the population distribution would lie *above* the maximum threshold *T* of an interval, together with the probability of observing the exact values of the n samples that are recorded. Thus:

  


![image](media://d01b2e1a-97b5-449a-8c73-f4e226e349e8)

> Macro (mathinline)



  


In the Excel model [Weibull Right Censored](#WeibullRightCensored) this is equivalent to:

  


{=SUM(LOG(WEIBULL(Data,Alpha,Beta,0)))+LOG(1-WEIBULL(T,Alpha,Beta,1))*nT}

  


which is an [array function](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26576887).

> Macro (anchor)



The links to the Weibull Right Censored software specific models are provided here:
</details>

  


  


---