MATLAB Answers

Confidence interval with normfit/fitdist/paramci differ from manual calculation depending on the number of elements. Why??

17 ビュー (過去 30 日間)
Will Fonseca
Will Fonseca 2017 年 5 月 17 日
I am testing some confidence interval calculation, however, I have noticed differences using the Matlab functions normfit/fitdist/paramci from the manual calculation. Please have a look to the code below, and test the data with more elements. As the data size increases the differences are smaller. Does someone have a clue/solution/explanation?
Thanks
Will
%%Cleaning service
clear all; close all;
%%Data and processing
conf = norminv([0.025 0.975],0,1); % for 95%
data = normrnd(0.158,0.0265,10,1); % Change the third argument to 100, 1000, 1000, ...
[mu,sigma,muci,sigmaci] = normfit(data,.05); % for 95%
pd = fitdist(data,'Normal'); ci = paramci(pd,'Alpha',.05); % for 95%
xplus = mu + conf(2)*sigma*(1/sqrt(length(data)));
xminus = mu - conf(2)*sigma*(1/sqrt(length(data)));
Difference = [ci(1,1)-xminus ci(2,1)-xplus]

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by