Reproducible results using "bootci" matlab function
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello. I am trying to use matlab's "bootci" statistics toolbox function and I am having difficulty getting reproducible results. Basically each and every time I calculate the confidence interval I want it to be exactly the same. This is because I later calculate confidence intervals for other metrics and I want to make sure the same samples were used when the confidence interval was calculated for each one. I also have the parallel processing toolbox, but it is not necessary because the confidence interval estimation doesn't take very long.
Below is some example code using matlab's example with some of my modifications. Thanks for anyone's your help.
%% Use same example in Matlab bootci function with minor modifications
y = normrnd(1,1,30,1); % Simulated process data
LSL = -3; USL = 3; % Process specifications
capable = @(x)(USL-LSL)./(6* std(x)); % Process capability
%% Set up random number
s=RandStream('mlfg6331_64');
options=statset('UseSubstreams', true, 'Streams', s);
%% Compute the confidence interval and check to see if they are the same
ci1 = bootci(2000,{capable,y}, 'options', options)
ci2 = bootci(2000,{capable,y}, 'options', options)
isequal(ci1, ci2)%I want them to be exactly the same
댓글 수: 0
채택된 답변
Tom Lane
2014년 7월 15일
If you insert
reset(s)
before the second call to bootci , you should find that the two calls yield the same answer.
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!