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!