How to compute log likelihood (which function to use) in Matlab the when the data is not normally distributed

Illustration
savieklkdnf - 2022-06-29T10:13:30+00:00
Question: How to compute log likelihood (which function to use) in Matlab the when the data is not normally distributed

Hi! I was wondering how to compute (which function to use) in Matlab the log likelihood but when the data is not normally distributed. Thanks!

Expert Answer

Profile picture of John Williams John Williams answered . 2025-11-20

If you have the most recent release of the Statistics Toolbox:
>> x = poissrnd(4,20,1);
>> pd = fitdist(x,'poisson');
>> pd.NLogL
ans =
39.0221
If you do not:
>> mu = poissfit(x);
>> -sum(log(poisspdf(x,mu)))
ans =
39.0221
 
 

To find maximum likelihood estimates (MLEs), you can use a negative loglikelihood function as an objective function of the optimization problem and solve it by using the MATLAB® function fminsearch or functions in Optimization Toolbox™ and Global Optimization Toolbox. These functions allow you to choose a search algorithm and exercise low-level control over algorithm execution. By contrast, the mle function and the distribution fitting functions that end with fit, such as normfit and gamfit, use preset algorithms with options limited to those set by the statset function.

 

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!