fitdist is givin me mu of 6.43686 with this code. Am i doing something wrong. I'm trying to get mu and sigma values to compare this data with log normal distribution
Add=16
Add = 16
%%info given in question 4
River_flood_level=[516 678 802 683 491 582 625 531 451 726 652 556 470 570 774 670 432 604 881 707 735 614 698 403 548 504 758 1000 419];
River_flood_level=River_flood_level+Add;
%%solution of question 4
fitdist(River_flood_level.','Lognormal')
ans =
LognormalDistribution Lognormal distribution mu = 6.43686 [6.35256, 6.52116] sigma = 0.22162 [0.175873, 0.29973]

댓글 수: 1

Why do you think the result is incorrect? What are you expecting mu to be?
The fitted distribution looks pretty reasonable given the limited amount of data provided.
Add=16;
%%info given in question 4
River_flood_level=[516 678 802 683 491 582 625 531 451 726 652 556 470 570 774 670 432 604 881 707 735 614 698 403 548 504 758 1000 419];
River_flood_level=River_flood_level+Add;
%%solution of question 4
p = fitdist(River_flood_level.','Lognormal');
figure
histogram(River_flood_level,'Normalization','pdf')
hold on
plot(400:1200,pdf(p,400:1200))

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

 채택된 답변

Star Strider
Star Strider 2024년 1월 5일

0 개 추천

The μ and σ values are in log units. Calculatee their exponentials —
Add=16
Add = 16
%%info given in question 4
River_flood_level=[516 678 802 683 491 582 625 531 451 726 652 556 470 570 774 670 432 604 881 707 735 614 698 403 548 504 758 1000 419];
River_flood_level=River_flood_level+Add;
%%solution of question 4
df = fitdist(River_flood_level.','Lognormal')
df =
LognormalDistribution Lognormal distribution mu = 6.43686 [6.35256, 6.52116] sigma = 0.22162 [0.175873, 0.29973]
Mean = exp(df.mu)
Mean = 624.4451
Sigma = exp(df.sigma)
Sigma = 1.2481
figure
hf = histfit(River_flood_level.', 10, 'Lognormal');
hold on
Line = findobj(hf,'Type','line');
ymu = interp1(Line.XData, Line.YData, exp(df.mu));
plot(exp(df.mu)*[1 1], [0 ymu], ':r', 'LineWidth',3)
hold off
Ax = gca;
Ax.XTickLabelRotation = 60;
.

댓글 수: 6

Emmeirrt
Emmeirrt 2024년 1월 6일
Make sense, thank you!
Star Strider
Star Strider 2024년 1월 6일
As always, my pleasure!
I have not worked with lognormal distrbutions in a while (although all physiological parameters are lognormally distributed) so I had to rediscover that.
Paul
Paul 2024년 1월 6일
Mean is not the mean of the distribution and Sigma is not the sqrt of the variance of the distribution, so I'm still not sure what the OP is, or was, looking for. Perhaps @Emmeirrt can clarify.
Corrected —
Add=16
Add = 16
%%info given in question 4
River_flood_level=[516 678 802 683 491 582 625 531 451 726 652 556 470 570 774 670 432 604 881 707 735 614 698 403 548 504 758 1000 419];
River_flood_level=River_flood_level+Add;
%%solution of question 4
df = fitdist(River_flood_level.','Lognormal')
df =
LognormalDistribution Lognormal distribution mu = 6.43686 [6.35256, 6.52116] sigma = 0.22162 [0.175873, 0.29973]
m = exp(df.mu + df.sigma^2/2)
m = 639.9699
nu = exp(2*df.mu+df.sigma^2)*(exp(df.sigma^2)-1);
figure
hf = histfit(River_flood_level.', 10, 'Lognormal');
hold on
Line = findobj(hf,'Type','line');
ymu = interp1(Line.XData, Line.YData, m);
plot([1;1]*m, [0;1]*ymu, '--r', 'LineWidth',2)
hold off
Ax = gca;
Ax.XTickLabelRotation = 60;
.
Emmeirrt
Emmeirrt 2024년 1월 29일
Thank you! ı just needed the info that they are in lognormal. I fixed the rest myself. Sorry for not answering early
Star Strider
Star Strider 2024년 1월 29일
As always, my pleasure!
No worries!
Thank you for the follow-up (and for Accepting my Answer).

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

추가 답변 (0개)

제품

릴리스

R2023b

질문:

2024년 1월 5일

댓글:

2024년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by