MATLAB: How to calculate the standard error (SE) and the covariance for the parameter estimates from the Maximum Likelihood Estimates (MLE) of a fit

Optimization Toolbox

I have a dataset and I fit a distribution to it using DFITOOL
When the fit is generated, some statistics related to the parameter estimates are displayed. How are these values calculated?

Best Answer

The error and variance for the parameters come from a maximum likelihood estimate. The variance is approximately equal to the inverse of Fisher's information matrix, evaluated at the estimates.
The standard error is the square root of this variance.
You can obtain the same results using dist*fit and *dist*like functions in MATLAB (where *dist refers to the type of distribution you are fitting, i.e. norm,exp...).
For example, given a normal distribution you can compute this variance using
normfit and normlike as following:
 
% original dataset
x = normrnd(10,2,100,1);
% parameter estimates
[muhat, sigmahat] = normfit(x)
% variance
[nlogL,AVAR] = normlike([muhat, sigmahat],x)
% diagonal elements of square root of the AVAR matrix give the standard errors
std_error = diag(sqrt(AVAR))