Confidence intervals in Plots (Normal distribution)

2 次查看(过去 30 天)
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