MATLAB: How to perform Maximum Likelihood Estimation for power law and custom distributions

distributionestimatelawlikelihoodmaximummlepowerStatistics and Machine Learning Toolbox

How can I perform Maximum Likelihood Estimation for power law and custom distributions?
I am doing a study of power laws, and have a brainwaves data set which has a downward slope and ends with an exponential cut off. I know my data is noisy and would deviate from the power law, however, I want use MATLAB in the best way possible to explain the deviations
How can I find the maximum likelihood estimates (MLE) for the power law distribution?
Also, how can I perform MLE on the data set using the following functional form of the custom distribution?
y = a*x^(b) * e^(lambda*x)

Best Answer

The expression, y = a*x^(b) * e^(lambda*x), is the gamma distribution. Please refer to the following documentation for the gamma distribution:
You can use the "gamfit" or "fitdist" function to fit the above distribution via maximum likelihood, rather than fitting "a", "b", and "lambda" separately, as they cannot be selected independently. It is not considered as a valid probability density unless "a" is a specific function of "b" and "lambda". Please refer to the following link for more information on using the "gamfit" and "fitdist" functions respectively:
For the power law distribution, you can use the "mle" function, but you need to write a function that computes the "pdf" or "logpdf" of the power law distribution. Please refer to the attached example, "powerLawExample.m", that demonstrates how to use the "mle" function by writing a function that computes the "logpdf" of the power law distribution.