필터 지우기
필터 지우기

How to determine error between two distributions

조회 수: 7 (최근 30일)
okoth ochola
okoth ochola 2023년 6월 13일
댓글: Paul 2023년 6월 13일
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
Paul
Paul 2023년 6월 13일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by