test if gamma distribution is appropriate for my data
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello! I have some data that i want to fit to a gamma distribution and get the goodness of fit. I used the following commands:
gamfit(left_normalized_dds) %result: 2.1297 0.4696
shape = 2.1297 ;
scale = 0.4696;
xp = linspace(min(left_normalized_dds),max(left_normalized_dds));
%yp = csnormp(xp,mu,v); %obtain gamma pdf
yp = gampdf(xp,shape,scale);
% Get the information needed for a histogram.
[nu,x] = hist(left_normalized_dds);
% Get the widths of the bins.
h = x(2)-x(1);
% Plot as density histogram
bar(x,nu/(length(left_normalized_dds)*h),1)
hold on
plot(xp,yp)
hold off
Is there a way to be sure that the gamma distribution really describes these data? (that's what I mean by goodness of fit). Thanks on advance.
0 Kommentare
Antworten (1)
Rodrigo Osuna Orozco
am 28 Apr. 2021
You can compute the negative log-likelihood of the parameters of your gamma distribution give your data using "gamlike" (https://www.mathworks.com/help/stats/gamlike.html), but this metric in itself won't tell you if a Gamma distribution describes your data. You can get a maximum likelihood fit to your data for a given family of distributions (i.e. find the maximum likelihood estimate of the parameters of a distribution). You can use the one-sample Kolmogorov-Smirnov test "kstest" (https://www.mathworks.com/help/stats/kstest.html) to test wether your data comes from a given distribution; the examples found in the documentation for "kstest" illustrate this very well.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!