R2 between histogram and (weibull) distribution
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dora de Jong
le 14 Nov 2021
Commenté : Star Strider
le 14 Nov 2021
Looking for the following:
R2 between histogram of parameter 'Weibull.Wh_Wp' and weibull distribution of parameter 'Weibull.Wh_Wp'.
[parmHat, parmCI]=wblfit(Weibull.Wh_Wp);
X=linspace(min(Weibull.Wh_Wp),max(Weibull.Wh_Wp));
plot(X,wblpdf(X,parmHat(1),parmHat(2)),'Color','k', 'LineWidth',1.3)
hold on
histogram(Weibull.Wh_Wp,'BinWidth',10,'FaceColor',[0.4660 0.6740 0.1880], 'EdgeColor', [0.45 0.45 0.45],'Normalization','pdf')
Below the figure of the parameter 'Weibull.Wh_Wp' with its histogram and fitted weibull distribution.
0 commentaires
Réponse acceptée
Star Strider
le 14 Nov 2021
Try something like this —
wblfcn = @(p,x) wblpdf(x,p(1),p(2));
Weibull.Wh_Wp = wblrnd(150, 3, 1, 100);
X=linspace(min(Weibull.Wh_Wp),max(Weibull.Wh_Wp));
[parmHat,parmCI] = wblfit(Weibull.Wh_Wp);
plot(X,wblpdf(X,parmHat(1),parmHat(2)),'Color','k', 'LineWidth',1.3)
hold on
h1 = histogram(Weibull.Wh_Wp,'BinWidth',10,'FaceColor',[0.4660 0.6740 0.1880], 'EdgeColor', [0.45 0.45 0.45],'Normalization','pdf');
ctrs = h1.BinEdges(1:end-1) + diff(h1.BinEdges(1:2))/2;
y = h1.Values;
wblmdl = fitnlm(ctrs, h1.Values, wblfcn, parmHat)
I’m not certain that an value on a distribution fit using maximum likelihood is statistically correct, however this will provide it if desired. See the documentation for fitnlm for details on it.
.
4 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!