Estimating the parameter of a power law distribution using maximum likelihood estimation (MLE)

13 次查看(过去 30 天)
I have a set of data points. I want to fit a power law distibution to these data points using the relation:
P(E) = CE^-m
where,
E = Set of data points
P(E) is the probability density function of E
C = a constant
m = power law exponent
I need to determine "C" and "m" using MLE and overlap the power law curve over P(E) versus E plot.
Please help.

回答(2 个)

Animesh
Animesh 2023-7-3
To fit a power law distribution to your data points using Maximum Likelihood Estimation (MLE) in MATLAB, you can follow these steps:
1.Define the power law function powerLaw with parameters C and m:
powerLaw = @(C, m, E) C * E.^(-m);
2.Create a probability density function (PDF) of your data points E using the power law function:
pdf = @(C, m) powerLaw(C, m, E);
3.Define the negative log-likelihood function negLogLikelihood to be minimized:
negLogLikelihood = @(params) -sum(log(pdf(params(1), params(2))));
4.Use the fminsearch function to find the parameters C and m that minimize the negative log-likelihood:
initialGuess = [1, 1]; % Initial guess for C and m
params = fminsearch(negLogLikelihood, initialGuess);
C = params(1);
m = params(2);
5.Plot the data points E and the fitted power law curve:
scatter(E, P, 'b', 'filled');
hold on;
x = linspace(min(E), max(E), 100);
plot(x, powerLaw(C, m, x), 'r', 'LineWidth', 2);
xlabel('E');
ylabel('P(E)');
legend('Data', 'Power Law Fit');
Make sure to replace E and P with your actual data points and their corresponding probabilities.

Shantanu Dixit
Shantanu Dixit 2023-7-3
编辑:Shantanu Dixit 2023-7-3
Hi Kashif,
You can use fminsearch - MATLAB and obtain the C and m for the power law fit. See the below snippet for minimizing the negative log likelihood using fminsearch.
negLogLikelihood = @(params) -sum(log(params(1) * data.^(-params(2))));
initialGuess = [0.5,0.5]; % initial guess for c and m
options = optimset('MaxFunEvals', 1000);
params = fminsearch(negLogLikelihood, initialGuess, options);
C = params(1);
m = params(2);

类别

Help CenterFile Exchange 中查找有关 Probability Distributions and Hypothesis Tests 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by