Confidence intervals in Plots (Normal distribution)

조회 수: 4 (최근 30일)
David Canales
David Canales 2017년 6월 7일
편집: David Canales 2017년 6월 8일
I would like to know how to plot the 68% confidence interval of a Gaussian in such a way the resulting image looks similar to this one:
I am trying to do that with R, but I want to resort to Matlab again for my research and I want to see its abilities for statistics. I would compute the histogram as follows. The input comes from the CODAchain1.txt attached.
ic_table_file1 = 'CODAchain1.txt';
%%Read tables
codachain = load(ic_table_file1);
%%Length params
snum=1000;
media=mean(codachain(1:snum,2));
sdev=std(codachain(1:snum,2));
vector1=codachain(1:snum,2);
vector1=sort(vector1);
%Histogram
figure(2);
hold on;
min_bin=min(vector1);
max_bin=max(vector1);
inc_bin=(max_bin-min_bin)/40;
binranges = min_bin:inc_bin:max_bin;
[bincounts,ind] = histc(vector1(:),binranges);
sumatot=sum(bincounts(:));
bar(binranges,bincounts/sumatot,'m');
mu=media;
sigma=sdev;
analytic = min_bin:inc_bin:max_bin;
Y = normpdf(analytic,mu,sigma);
sumatotY=sum(Y(:));
plot(analytic,Y/sumatotY);
xlim([min_bin max_bin])
I don't know how would I be able to make the confidence interval that appears in the first image.
Thank you very much.

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by