How to determine error between two distributions

5 visualizzazioni (ultimi 30 giorni)
okoth ochola
okoth ochola il 13 Giu 2023
Commentato: Paul il 13 Giu 2023
Hello, I have the following code for comparing real and estimated distributions. The histogram represents the real while the curve is the estimated. How can I get the error (either the RMSE or R-squared) between the two curves. Any slight lead would be appreciated. As a far as am concerned its not possible to simply compare A and values obtained from wblpdf(sort(A),Overal_parameters(1),Overal_parameters(2)) since they're very different data types with different units. I suspect somehow we have to get probability distribution of the real data and compare it with the distribution obtain from wblpdf().
rng default
A=rnd(6000,1)
[Overal_parameters]= wblfit(A);
figure()
histogram(A,'Normalization','probability')
hold on
plot(sort(A),wblpdf(sort(A),Overal_parameters(1),Overal_parameters(2)))
legend('Observed Samples','Estimated Distribution')
xlabel('Mean wind speed (m/s)')
ylabel('Annual probabilty density')
hold off
  1 Commento
Paul
Paul il 13 Giu 2023
The graphical comparison should use pdf normalization of the histogram.
Original code, but use use an actual Weibull distribution for the data
rng default
%A=rnd(6000,1);
A = wblrnd(4,3,6000,1);
[Overal_parameters]= wblfit(A)
Overal_parameters = 1×2
3.9904 3.0302
figure()
histogram(A,'Normalization','probability')
hold on
plot(sort(A),wblpdf(sort(A),Overal_parameters(1),Overal_parameters(2)))
legend('Observed Samples','Estimated Distribution')
xlabel('Mean wind speed (m/s)')
ylabel('Annual probabilty density')
hold off
Use pdf normalization to compare to the estimated pdf
figure()
histogram(A,'Normalization','pdf')
hold on
plot(sort(A),wblpdf(sort(A),Overal_parameters(1),Overal_parameters(2)))
legend('Observed Samples','Estimated Distribution')
xlabel('Mean wind speed (m/s)')
ylabel('Annual probabilty density')
hold off
I'm not sure what the goal is from here, but at least now the graphs comparable.

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by