필터 지우기
필터 지우기

confidence interval on bar plot

조회 수: 85 (최근 30일)
HL
HL 2021년 10월 12일
댓글: HL 2021년 10월 12일
I already have the mean calculated and the bar graph is acttually my 4 mean values. All I want to do is to show that I have 95% confidence interval for these values and indicate on the plot which of the groups are significantly different from one another.
For all other confidence interval tutorial I have looked at, they teach me from how to calculate the mean and obtain a confidence interval. However, I do not need to know these. I just wnat to know how to get that confidence interval bar on my bar plot.

채택된 답변

Antti
Antti 2021년 10월 12일
Hi! I believe you could use the errorbar function. Here's an example:
% Create groups and data
X = categorical({'Small','Medium','Large','Extra Large'});
X = reordercats(X,{'Small','Medium','Large','Extra Large'});
Y = [10 21 33 52];
% Make a bar plot
bar(X,Y)
% Plot on top of bar plot
hold on
% errorbar(x,y,ci,marker) where ci is the height of the line. This can be
% computed from your confidence intervals.
errorbar([1 2 3 4],[10 21 33 52],[4 6 7 8],'o')
If this works for you, please formally accept this answer.
  댓글 수: 1
HL
HL 2021년 10월 12일
Thank you so much!!! It worked perfectly as I wanted.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Errorbars에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by