Code covered by the BSD License

# ToleranceFactor

### Viktor Witkovsky (view profile)

16 May 2009 (Updated )

ToleranceFactor computes the exact tolerance factor for the two-sided tolerance interval

ComputeTables(N,M,coverage,confidence,options)
```function Table = ComputeTables(N,M,coverage,confidence,options)
% Auxiliary function for computing tabels of tolerance factors
% by using the function ToleranceFactorGK.m
% Syntax:
% Table = ComputeTables(n,m,coverage,confidence,options)

% Ver.: 08-Apr-2013 14:37:14
% Viktor Witkovsky,  witkovsky@savba.sk

if nargin < 5
options = [];
end

if nargin < 4
confidence = [];
end

if nargin < 3
coverage = [];
end

if nargin < 2
M = [];
end

if nargin < 1
N = [];
end

if  isfield(options,'Onesided')
options.Onesided = options.Onesided;
else
options.Onesided = false;
end

if  isfield(options,'Simultaneous')
options.Simultaneous = options.Simultaneous;
else
options.Simultaneous = true;
end

if  isfield(options,'Significantdigits')
significantdigits = options.Significantdigits;
else
significantdigits = 4;
end

if  isfield(options,'Displayrunningindex')
displayrunningindex = options.Displayrunningindex;
else
displayrunningindex = true;
end

if isempty(confidence)
confidence = [.9 .95 .99 .999];
end
if isempty(coverage)
coverage = [.9  .95 .99];
end
if isempty(M)
M = 2:10;
end
if isempty(N)
N = [2:20,22:2:30,35:5:50,60:10:100,150:50:300,400,500,1000,...
2000,5000,10000,20000,Inf]';
end

nG = length(confidence);
nP = length(coverage);
nN = length(N);
nM = length(M);

Table = zeros(nG,nP,nN,nM);

for g =1:nG
for p = 1:nP
for n = 1:nN
for m = 1:nM
if displayrunningindex
disp([g,p,n,m])
end
Table(g,p,n,m) = ...
ToleranceFactorGK(N(n),coverage(p),confidence(g),...
M(m),[],[],options);
end
end
end
end

Table = RoundTable(Table,significantdigits);

function Table = RoundTable(Tab,significantdigits)
%RoundTable results rounded data> the precission is given by digits.
%Table = RoundTable(Tab,significantdigits)

factor = 10^significantdigits;
Table = ceil(factor*Tab)/factor;```