Reproducible results using "bootci" matlab function

3 ビュー (過去 30 日間)
Kevin
Kevin 2014 年 6 月 25 日
回答済み: Tom Lane 2014 年 7 月 15 日
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

採用された回答

Tom Lane
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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by