# How to calculate maximum likelihood

Written by nivedita raghunath
• Share
• Tweet
• Share
• Email

The maximum likelihood, or ML, method was first proposed by the English statistician R. A. Fischer. This method finds the estimate of a parameter that maximises the likelihood of observing the data given a model for the data. Calculate the maximum likelihood estimate of a parameter p by taking the derivative of the likelihood function with respect to p and finding the point where p is equal to zero.

Skill level:
Moderate

## Instructions

1. 1

Obtain the likelihood function or the probability density function (pdf) of the parameter that you'd like to estimate. The pdf is a function that describes the relative likelihood for a random variable to occur at a given point. Examples of pdfs are the normal, inverse Gaussian, gamma, Poisson and Bernoulli distributions. For instance, for a normal distribution, you might want to find the mean and variance estimates.

2. 2

Calculate the natural log of the likelihood function. Natural logarithms are easy to calculate and are standard with most programming languages like C, PHP and Matlab (log function). You can even use the log() function in Excel or use the calculator.

3. 3

Calculate the derivative of the log likelihood function with respect to the parameter that you're trying to estimate (p). Some programs like Matlab have built in functions such as diff() and polyder() to calculate the derivative. In other programs such as C and Excel, you can calculate the derivative of y with respect to x as follows: dy/dx=(y1-y0)/(x1-x0). Where y1,x1 are the current values of the output and input variables y and x, and y0, x0 are the (decremental) previous values of y and x.

4. 4

Set the derivative equal to zero and solve for the parameter you're trying to estimate (p).

#### Tips and warnings

• To determine how close the estimate is to the true value of p, you must determine the confidence interval of the estimate. The confidence interval allows you to specify the range for the estimate with a certain confidence level. For example, at a 95% confidence level, you can be 95% sure that the estimate falls within the range specified by the confidence interval.
• The parameter p is only an estimate of the true value of p.

### Don't Miss

• All types
• Articles
• Slideshows
• Videos
##### Sort:
• Most relevant
• Most popular
• Most recent