Reproducible results using "bootci" matlab function

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Tom Lane
Tom Lane il 15 Lug 2014
If you insert
reset(s)
before the second call to bootci , you should find that the two calls yield the same answer.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by