This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/likelihood/code/mlegammafit.m
2015-10-31 20:45:32 +01:00

13 lines
261 B
Matlab

% generate gamma distributed random numbers:
n = 50;
shape = 2.0;
scale = 1.0;
x = gamrnd(shape, scale, n, 1);
% maximum likelihood estimate:
p = mle(x, 'distribution', 'gamma');
% report results:
fprintf('shape=%.2f\n', p(1));
fprintf('scale=%.2f\n', p(2));