MATLAB: Log likelihood

likelihood

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!
Nuchto

Best Answer

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