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

CreateISOTables.m
```% Recalculate the TABLES of statistical tolerance limit factors
% given by the Annex C and D of ISO 16269-6.
%
% ISO 16269-6. Statistical interpretation of data  Part 6: Determination
% of statistical tolerance interval.

% Ver.: 08-Apr-2013 14:37:14
% Viktor Witkovsky,  witkovsky@savba.sk
%% Set the parameters of the Tables
% confidence
confidence = [.90  .95 .99 .999];
% coverage
coverage = [.90  .95 .99];
% sample sizes n
n = [2:20,22:2:30,35:5:50,60:10:100,150:50:300,400,500,1000,...
2000,5000,10000,20000,Inf]';
%% The one-sided (non-simultaneous) Tolerance Factors
options.Onesided = true;
options.Simultaneous = false;
options.Significantdigits = 4;
options.Displayrunningindex = true;
m = 1; % set the number of samples into m
Annex_C_RawTables = ComputeTables(n,m,coverage,confidence,options);
%save Annex_C_MatlabRawTables Annex_C_RawTables;
%% Create the Excel file - Put the Tables put into the Annex_C_Template.xls
filename = 'Annex_C_Template';
sheetname = 'Table_C';
FileName = [filename,'.xls'];
Table = Annex_C_RawTables;
TableC1 = squeeze(Table(1,:,:));xlswrite(FileName,TableC1',[sheetname,'1'],'B5:D49');
TableC2 = squeeze(Table(2,:,:));xlswrite(FileName,TableC2',[sheetname,'2'],'B5:D49');
TableC3 = squeeze(Table(3,:,:));xlswrite(FileName,TableC3',[sheetname,'3'],'B5:D49');
TableC4 = squeeze(Table(4,:,:));xlswrite(FileName,TableC4',[sheetname,'4'],'B5:D49');
%save Annex_C_MatlabTables TableC1 TableC2 TableC3 TableC4;
%% The two-sided (non-simultaneous) Tolerance Factors
options.Onesided = false;
options.Simultaneous = false;
options.Significantdigits = 4;
options.Displayrunningindex = true;
m = 1:10; % set the number of samples into m
Annex_D_RawTables = ComputeTables(n,m,coverage,confidence,options);
%save Annex_D_MatlabRawTables Annex_D_RawTables;
%% Create the Excel file - Put the Tables into the Annex_D_Template.xls
filename = 'Annex_D_Template';
sheetname = 'Table_D';
FileName = [filename,'.xls'];
Table = Annex_D_RawTables;
TableD1 = squeeze(Table(1,1,:,:));xlswrite(FileName,TableD1,[sheetname,'1'],'B5:K49');
TableD2 = squeeze(Table(1,2,:,:));xlswrite(FileName,TableD2,[sheetname,'2'],'B5:K49');
TableD3 = squeeze(Table(1,3,:,:));xlswrite(FileName,TableD3,[sheetname,'3'],'B5:K49');
TableD4 = squeeze(Table(2,1,:,:));xlswrite(FileName,TableD4,[sheetname,'4'],'B5:K49');
TableD5 = squeeze(Table(2,2,:,:));xlswrite(FileName,TableD5,[sheetname,'5'],'B5:K49');
TableD6 = squeeze(Table(2,3,:,:));xlswrite(FileName,TableD6,[sheetname,'6'],'B5:K49');
TableD7 = squeeze(Table(3,1,:,:));xlswrite(FileName,TableD7,[sheetname,'7'],'B5:K49');
TableD8 = squeeze(Table(3,2,:,:));xlswrite(FileName,TableD8,[sheetname,'8'],'B5:K49');
TableD9 = squeeze(Table(3,3,:,:));xlswrite(FileName,TableD9,[sheetname,'9'],'B5:K49');
TableD10 = squeeze(Table(4,1,:,:));xlswrite(FileName,TableD10,[sheetname,'10'],'B5:K49');
TableD11 = squeeze(Table(4,2,:,:));xlswrite(FileName,TableD11,[sheetname,'11'],'B5:K49');
TableD12 = squeeze(Table(4,3,:,:));xlswrite(FileName,TableD12,[sheetname,'12'],'B5:K49');
%save Annex_D_MatlabTables TableD1 TableD2 TableD3 TableD4 TableD5 TableD6 TableD7 TableD8 TableD9 TableD10 TableD11 TableD12;```