Quality

A software tool for statistical quality control design

Rallou A. Chatzimichail, PhD 
rallou@hcsl.com
Aristides T. Hatjimihail, MD, PhD
 ath@hcsl.com

Hellenic Complex Systems Laboratory, Kostis Palamas 21, 66131 Drama, Greece.

Clear["`*"];
Off[General::stop];
minfn=(10^(-100));
ag=100;
pg=100;
wp=200;
pce[em_,m_,s_,taae_]:=N[(2^(-1))(Erfc[((m-em (1-taae))/((Sqrt[2]) s))]+Erfc[((-m+em(1+ taae))/((Sqrt[2]) s))]),{100,100}]
ped[em_,m_,s_,d_,dm_,sd_,c_]:=N[1-(2^(-c)) (((-Erf[((dm-d s)/((Sqrt[2]) sd))]+Erf[((dm+d s)/((Sqrt[2]) sd))]))^c),{100,100}]
sped[m_,s_,d_,c_]:=N[1-(2^(-c)) ((( -Erf[((-d +m)/((Sqrt[2]) s))]+ Erf[((d +m)/((Sqrt[2])s))]))^c)]
qd[m_,s_,p_,c_]:=d/.Quiet[FindRoot[N[1-(2^(-c)) ((( -Erf[((-d +m)/((Sqrt[2]) s))]+ Erf[((d +m)/((Sqrt[2]) s))]))^c),{ag,pg} ]==p,{d,1,20,0,30},AccuracyGoal->ag,PrecisionGoal->pg, WorkingPrecision->wp]]
qcd[m_,s_,p_,c_]:=Min[ds/.Quiet[FindRoot[N[1-(2^(-c)) ((( -Erf[((-ds +m)/(Sqrt[2]))]+ Erf[((ds +m)/((Sqrt[2]) ))]))^c),{ag,pg} ]==p,{ds,1,20,0,30},AccuracyGoal->ag,PrecisionGoal->pg, WorkingPrecision->wp]],dr/.Quiet[FindRoot[N[1-(2^(-c)) ((( -Erf[((-dr )/((Sqrt[2]) s))]+ Erf[((dr )/((Sqrt[2]) s))]))^c),{ag,pg} ]==p,{dr,1,20,0,30},AccuracyGoal->ag,PrecisionGoal->pg, WorkingPrecision->wp]]]

qc[em_,m_,s_,taae_,a_,minpsed_,minpred_, c_]:=Module[{ra,dr,sa,ds, sd,d,dd,bias},ra=sd/.FindRoot[N[(2^(-1))(Erfc[((m-em (1-taae))/((Sqrt[2]) sd))]+Erfc[((-m+em (1+taae))/((Sqrt[2]) sd))]),{100,100}]==a,{sd,s,20s,0,30 s},AccuracyGoal->100,PrecisionGoal->100];dr=N[(((Sqrt[2])ra InverseErf[(((1-minpred))^(1/c))])/s) ,{100,100}];
sa=bias/.If[m<em,FindRoot[N[(2^(-1)) (1+Erf[((bias-m+em (1-taae))/((Sqrt[2]) s))]+Erfc[((bias-m+em (1+taae))/((Sqrt[2]) s))]),{100,100}]==a,{bias,1s,20s,0,30 s},AccuracyGoal->100,PrecisionGoal->100],FindRoot[N[(2^(-1))(1+Erfc[((bias+m-em (1-taae))/((Sqrt[2]) s))]+Erf[((bias+m-em (1+taae))/((Sqrt[2]) s))]),{100,100}]==a,{bias,1s,20 s,0,30 s},AccuracyGoal->100,PrecisionGoal->100]];
ds=dd/.FindRoot[N[(2^(-c)) (((Erf[((dd s-sa)/((Sqrt[2]) s))]+Erf[((dd s+sa)/((Sqrt[2]) s))]))^c),{100,100}]==1-minpsed,{dd,1,20,0,30},AccuracyGoal->100,PrecisionGoal->100];
Min[dr,ds]]
dl[p_,c_]:=dl[p,c]=qd[0,1,p,c]
pedfr[t_,m_,s_,n_,k_,p_]:=Block[{d},d=dl[p,n];Switch[t,1,If[k<n,sped[0,s,d,k]+sped[0,1,d,n-k]-sped[0,s,d,k]psed[0,1,d,n-k],sped[0,s,d,n]],2,If[k<n,sped[m,1,d,k]+sped[0,1,d,n-k]-sped[m,1,d,k]sped[0,1,d,n-k],sped[m,1,d,n]]]]
pedfrl[t_,m_,s_,n_,k_,l_]:=Switch[t,1,If[k<n,sped[0,s,l,k]+sped[0,1,l,n-k]-sped[0,s,l,k]sped[0,1,l,n-k],sped[0,s,l,n]],2,If[k<n,sped[m,1,l,k]+sped[0,1,l,n-k]-sped[m,1,l,k]sped[0,1,l,n-k],sped[m,1,l,n]]]
qped[m_,s_,p_,c_]:=Block[{qdl,pre,pse},qdl=dl[p,c];pre=sped[0,s,qdl,c];pse=sped[m,1,qdl,c];"NOR: "<>ToString[DecimalForm[1-p,{5,4}]]<>" RE: "<>ToString[DecimalForm[pre,{5,4}]]<>" SE: "<>ToString[DecimalForm[pse,{5,4}]]]
nqped[m_,s_,p_,c_]:=Block[{qdl,pre,pse},qdl=qd[0,1,p,c];pre=sped[0,s,qdl,c];pse=sped[m,1,qdl,c];{p,pre,pse}]
pro[t_,pr_,r_]:=Switch[t,1,Switch[pr,True,SetOptions[Plot,PlotRange->{{1,r+1},Full}, AxesOrigin->{1,0}];SetOptions[ListLinePlot,PlotRange->{{1,r+1},Full}, AxesOrigin->{1,0}],False,SetOptions[Plot,PlotRange->{{1,r+1},Automatic}];SetOptions[ListLinePlot,PlotRange->{{1,r+1},Automatic}]],2,Switch[pr,True,SetOptions[Plot,PlotRange->{{0,r},Full}, AxesOrigin->{0,0}];SetOptions[ListLinePlot,PlotRange->{{0,r},Full}, AxesOrigin->{0,0}],False,SetOptions[Plot,PlotRange->{{0,r},Automatic}];SetOptions[ListLinePlot,PlotRange->{{0,r},Automatic}]]];
pss[t_,n1_,k1_,p1_,n2_,k2_,p2_,r_]:=
Switch[t,1,Pane[Plot[{pedfr[t,0,s,n1,k1,p1],pedfr[t,0,s,n2,k2,p2]},{s,1,1+r},PlotLegends->Placed[{fstsl[t,n1,k1,dl[p1,n1]],fstsl[t,n2,k2,dl[p2,n2]]},Bottom],PlotLabel->"probability for rejection", AxesLabel->{"s","(Subscript[p, r])"}],{600}],2,Pane[Plot[{pedfr[t,m,1,n1,k1,p1],pedfr[t,m,1,n2,k2,p2]},{m,0,r},PlotLegends->Placed[{fstsl[t,n1,k1,dl[p1,n1]],fstsl[t,n2,k2,dl[p2,n2]]},Bottom],PlotLabel->"probability for rejection", AxesLabel->{"m","(Subscript[p, r])"}],{600}]]
dpss[t_,n1_,k1_,p1_,n2_,k2_,p2_,r_]:=
Switch[t,1,Pane[Plot[{pedfr[t,0,s,n2,k2,p2]-pedfr[t,0,s,n1,k1,p1]},{s,1,1+r},PlotLabel->"difference of probabilities for rejection", AxesLabel->{"s","(Subscript[p, r2])-(Subscript[p, r1])"}],{600}],2,Pane[Plot[{pedfr[t,m,1,n1,k1,p1]-pedfr[t,m,1,n2,k2,p2]},{m,0,r},PlotLabel->"difference of probabilities for rejection", AxesLabel->{"m","(Subscript[p, r2])-(Subscript[p, r1])"}],{600}]]
rdpss[t_,n1_,k1_,p1_,n2_,k2_,p2_,r_]:=
Switch[t,1,Pane[Plot[{(pedfr[t,0,s,n2,k2,p2]-pedfr[t,0,s,n1,k1,p1])/pedfr[t,0,s,n1,k1,p1]},{s,1,r+1},PlotLabel->"relative difference of probabilities for rejection", AxesLabel->{"s","(Subscript[p, r2])-(Subscript[p, r1])/(Subscript[p, r1])"}],{600}],2,Pane[Plot[{(pedfr[t,m,1,n2,k2,p2]-pedfr[t,m,1,n1,k1,p1])/pedfr[t,m,1,n1,k1,p1]},{m,0,r},PlotLabel->"relative difference of probabilities for rejection", AxesLabel->{"m","(Subscript[p, r2])-(Subscript[p, r1])/(Subscript[p, r1])"}],{600}]]
rpss[t_,n1_,k1_,p1_,n2_,k2_,p2_,r_]:=
Switch[t,1,Pane[Plot[{pedfr[t,0,s,n2,k2,p2]/pedfr[t,0,s,n1,k1,p1]},{s,1,r+1},PlotLabel->"ratio of probabilities for rejection", AxesLabel->{"s","(Subscript[p, r2])/(Subscript[p, r1])"}],{600}],2,Pane[Plot[{pedfr[t,m,1,n2,k2,p2]/pedfr[t,m,1,n1,k1,p1]},{m,0,r},PlotLabel->"ratio of probabilities for rejection", AxesLabel->{"m","(Subscript[p, r2])/(Subscript[p, r1])"}],{600}]]
fsts[p_,n_,k_,t_]:=Text@Switch[t,0,StringJoin["P(",ToString[n],",",ToString[k],",0,1;", ToString[NumberForm[dl[p,n],{3,2}]],")"],1,StringJoin["P(",ToString[n],",",ToString[k],",0,\!\(\*StyleBox[\"s\",FontSlant->\"Italic\"]\);", ToString[NumberForm[dl[p,n],{3,2}]],")"],2,StringJoin["P(",ToString[n],",",ToString[k],",\!\(\*StyleBox[\"m\",FontSlant->\"Italic\"]\),1;", ToString[NumberForm[dl[p,n],{3,2}]],")"]]
pssl[t_,n1_,k1_,l1_,n2_,k2_,l2_,r_]:=Switch[t,1,Pane[Plot[{pedfrl[t,0,s,n1,k1,l1],pedfrl[t,0,s,n2,k2,l2]},{s,1,1+r},PlotLabel->"probability for rejection", AxesLabel->{"s","(Subscript[p, r])"},PlotLegends->Placed[{fstsl[t,n1,k1,l1],fstsl[t,n2,k2,l2]},Bottom]],{600}],2,Pane[Plot[{pedfrl[t,m,1,n1,k1,l1],pedfrl[t,m,1,n2,k2,l2]},{m,0,r},PlotLabel->"probability for rejection", AxesLabel->{"m","(Subscript[p, r])"},PlotLegends->Placed[{fstsl[t,n1,k1,l1],fstsl[t,n2,k2,l2]},Bottom]],{600}]]
dpssl[t_,n1_,k1_,l1_,n2_,k2_,l2_,r_]:=
Switch[t,1,Pane[Plot[{pedfrl[t,0,s,n2,k2,l2]-pedfrl[t,0,s,n1,k1,l1]},{s,1,1+r},PlotLabel->"difference of probabilities for rejection", AxesLabel->{"s","(Subscript[p, r2])-(Subscript[p, r1])"}],{600}],2,Pane[Plot[{pedfrl[t,m,1,n2,k2,l2]-pedfrl[t,m,1,n1,k1,l1]},{m,0,r},PlotLabel->"difference of probabilities for rejection", AxesLabel->{"m","(Subscript[p, r2])-(Subscript[p, r1])"}],{600}]]
rdpssl[t_,n1_,k1_,l1_,n2_,k2_,l2_,r_]:=
Switch[t,1,Pane[Plot[{(pedfrl[t,0,s,n2,k2,l2]-pedfrl[t,0,s,n1,k1,l1])/pedfrl[t,0,s,n1,k1,l1]},{s,1,r+1},PlotLabel->"relative difference of probabilities for rejection", AxesLabel->{"s","(Subscript[p, r2])-(Subscript[p, r1])/(Subscript[p, r1])"}],{600}],2,Pane[Plot[{(pedfrl[t,m,1,n2,k2,l2]-pedfrl[t,m,1,n1,k1,l1])/pedfrl[t,m,1,n1,k1,l1]},{m,0,r},PlotLabel->"relative difference of probabilities for rejection", AxesLabel->{"m","(Subscript[p, r2])-(Subscript[p, r1])/(Subscript[p, r1])"}],{600}]]
rpssl[t_,n1_,k1_,l1_,n2_,k2_,l2_,r_]:=
Switch[t,1,Pane[Plot[{pedfrl[t,0,s,n2,k2,l2]/pedfrl[t,0,s,n1,k1,l1]},{s,1,r+1},PlotLabel->"ratio of probabilities for rejection", AxesLabel->{"s","(Subscript[p, r2])/(Subscript[p, r1])"}],{600}],2,Pane[Plot[{pedfrl[t,m,1,n2,k2,l2]/pedfrl[t,m,1,n1,k1,l1]},{m,0,r},PlotLabel->"ratio of probabilities for rejection", AxesLabel->{"m","(Subscript[p, r2])/(Subscript[p, r1])"}],{600}]]
fstsl[t_,n_,k_,l_]:=Text@StringJoin["P(",ToString[n],",",ToString[k],Switch[t,0,",0.00,1.00;0.00,1.00,",1,",0.00,s;0.00,1.00,",2,",m,1.00;0.00,1.00,"], ToString[NumberForm[l,{3,2}]],")"]
strs[n_,m_,s_,p_]:=Text@StringJoin["S(",Switch[n,1,"(Subscript[x, 1])",2,"(Subscript[x, 1]),(Subscript[x, 2])",3,"(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3])",4,"(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4])",5,"(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4]),(Subscript[x, 5])",6,"(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4]),(Subscript[x, 5]),(Subscript[x, 6])"],";",ToString[NumberForm[m,{3,2}]],",",ToString[NumberForm[s,{3,2}]],",",ToString[NumberForm[dl[p,n],{3,2}]],")"]
strsl[n_,m_,s_,l_]:=Text@StringJoin["S(",Switch[n,1,"(Subscript[x, 1])",2,"(Subscript[x, 1]),(Subscript[x, 2])",3,"(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3])",4,"(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4])",5,"(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4]),(Subscript[x, 5])",6,"(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]),(Subscript[x, 4]),(Subscript[x, 5]),(Subscript[x, 6])"],";",ToString[NumberForm[m,{3,2}]],",",ToString[NumberForm[s,{3,2}]],",",ToString[NumberForm[l,{3,2}]],")"]
gpfrss[n1_,k1_,p1_,n2_,k2_,p2_]:=Text[Grid[Transpose[{{"QC rule","decision limit","probability for false rejection"},{strs[n1,0.00,1.00,p1],ToString[NumberForm[dl[p1,n1],{3,2}]],ToString[NumberForm[p1,{7,6}]]},{strs[n2,0.00,1.00,p2],ToString[NumberForm[dl[p2,n2],{3,2}]],ToString[NumberForm[p2,{7,6}]]}}],Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->{All,Automatic}],BaseStyle->{Medium}]
gpfrssl[n1_,k1_,l1_,n2_,k2_,l2_]:=Text[Grid[Transpose[{{"QC rule","decision limit","probability for false rejection"},{strsl[n1,0.00,1.00,l1],ToString[NumberForm[l1,{3,2}]],ToString[NumberForm[sped[0.00,1.00,l1,n1],{7,6}]]},{strsl[n2,0.00,1.00,l2],ToString[NumberForm[l2,{3,2}]],ToString[NumberForm[sped[0.00,1.00,l2,n2],{7,6}]]}}],Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->{All,Automatic}],BaseStyle->{Medium}]
gpfrs[n_,m_,s_,l_,p_]:=Text[Grid[Transpose[{{"QC rule","decision limit","probability for false rejection"},{strsl[n,m,s,l],ToString[NumberForm[l,{3,2}]],ToString[NumberForm[p,{7,6}]]}}],Frame->All, FrameStyle->Blend[{Blue,Cyan},0.35],Spacings->{1,1},ItemSize->{All,Automatic}],BaseStyle->{Medium}]

TabView[{
"statistical quality control"->
TabView[{
"design"->
Manipulate[
Quiet[
taae=ptaae/100;
fn=pce[em,m,s,taae];
SetOptions[Plot,PlotRange->Automatic, AxesOrigin->Automatic];
If[minfn⩽fn⩽a,
Which[
type==0,
rc=sd/.FindRoot[N[(2^(-1))(Erfc[(m-em (1-taae))/(√2 sd)]+Erfc[(-m+em(1+taae))/(√2 sd)]),{100,100}]==a,{sd,s,20s,0,30 s}];
sc=bias/.If[m<em,FindRoot[N[(2^(-1))(1+Erf[(bias-m+em (1-taae))/(√2 s)]+Erfc[(bias-m+em (1+taae))/(√2 s)]),{100,100}]==a,{bias,1s,20 s,0,30 s},AccuracyGoal->100,PrecisionGoal->100],FindRoot[N[(2^(-1))(1+Erfc[(bias+m-em (1-taae))/(√2 s)]+Erf[(bias+m-em (1+taae))/(√2 s)]),{100,100}]==a,{bias,1s,20 s,0,30 s},AccuracyGoal->100,PrecisionGoal->100]];
d=qc[em,m,s,taae,a,minpsed,minpred,c];
pfr=ped[em,m,s,d,0.0,s,c];
pred=ped[em,m,s,d,0.0,rc,c];
psed =ped[em,m,s,d,sc,s,c];
Pane[
Text@Grid[{{Style["measurement process parameters",Bold, Larger]},{"fraction nonconforming ",NumberForm[fn,{7,6}]},{"critical random error ",NumberForm[rc s,{6,2}]},
{"critical systematic error ",NumberForm[sc s,{6,2}]},{Style["\nquality control parameters",Bold, Larger]},{Style["statistical single-value QC rule ",Bold,Blue],Style[strsl[c,m,s,d],Bold,Blue]},{Style["lower decision limit ",Bold,Red],Style[NumberForm[m-d s,{6,2}],Bold,Red]},{Style["upper decision limit ",Bold,Red],Style[NumberForm[m+d s,{6,3}],Bold,Red]},{"probability for critical random error detection ",NumberForm[pred,{6,3}]},{"probability for critical systematic error detection",NumberForm[psed,{6,3}]},
{"probability for false rejection ",N[pfr,{7,6}]}},Alignment->{Left}],ImageSize->{450,450/GoldenRatio}],
type==1,
Column[{Plot[PDF[NormalDistribution[m,s],x],{x,m-6 s,m+6 s},AxesLabel->{"m","p"},PlotLabel->"probability density function (pdf)",PlotStyle->{ColorData["HTML","SlateBlue"], RGBColor[1,.47,0]} ,Filling->Bottom,ImageSize->{450,450/GoldenRatio}],gpfrs[c,m,s,d,pfr]},Center],
type==2,
Column[{Plot[CDF[NormalDistribution[m,s],x],{x,m-6 s,m+6 s},AxesLabel->{"m","p"},PlotLabel->"cumulative density function (cdf)",PlotStyle->{ColorData["HTML","SlateBlue"], RGBColor[1,.47,0]} ,Filling->Bottom,ImageSize->{450,450/GoldenRatio}],gpfrs[c,m,s,d,pfr]},Center],
type==3,
rc=sd/.FindRoot[N[(2^(-1))(Erfc[(m-em (1-taae))/(√2 sd)]+Erfc[(-m+em(1+taae))/(√2 sd)]),{100,100}]==a,{sd,s,20s,0,30 s}];
d=qc[em,m,s,taae,a,minpsed,minpred,c];
Column[{Plot[ped[em,m,s,d,0,x,c],{x,s,rc+3s},AxesLabel->{"s","(Subscript[p, r])"},AxesOrigin->{s,0},PlotLabel->"probability for rejection",PlotStyle->{ColorData["HTML","Brown"]} ,FillingStyle->LightBrown,Filling->Bottom,ImageSize->{450,450/GoldenRatio}],gpfrs[c,m,s,d,pfr]},Center],
type==4,
sc=bias/.If[m<em,FindRoot[N[(2^(-1))(1+Erf[(bias-m+em (1-taae))/(√2 s)]+Erfc[(bias-m+em (1+taae))/(√2 s)]),{100,100}]==a,{bias,1s,20 s,0,30 s},AccuracyGoal->100,PrecisionGoal->100],FindRoot[N[(2^(-1))(1+Erfc[(bias+m-em (1-taae))/(√2 s)]+Erf[(bias+m-em (1+taae))/(√2 s)]),{100,100}]==a,{bias,1s,20 s,0,30 s},AccuracyGoal->100,PrecisionGoal->100]];
d=qc[em,m,s,taae,a,minpsed,minpred,c];
Column[{Plot[ped[em,m,s,d,x-m,s,c],{x,m-sc-3s,m+sc+3s},AxesLabel->{"m","(Subscript[p, r])"},AxesOrigin->{m,0},PlotLabel->"probability for rejection",PlotStyle->{ColorData["HTML","Brown"]} ,Filling->Bottom,FillingStyle->LightBrown,ImageSize->{450,450/GoldenRatio}],gpfrs[c,m,s,d,pfr]},Center]],
If[fn>a,
Pane[Text@Grid[{{"fraction nonconforming = "<>ToString[fn]},{Style["the fraction nonconforming is not acceptable",Bold,Red, Larger]}},Alignment->{Left,Left}],ImageSize->{450,450/GoldenRatio}],If [fn>=0, Pane[Text@Grid[{{"fraction nonconforming < (10^(-100))"},{Style["the fraction nonconforming is too small",Bold,Red, Larger]}},Alignment->{Left,Left}],ImageSize->{450,450/GoldenRatio}], Pane[Text@Grid[{{"fraction nonconforming = 1."},{Style["the fraction nonconforming is not acceptable.",Bold,Red, Larger]}},Alignment->{Left,Left}],ImageSize->{450,450/GoldenRatio}]]]]],
{{type,0,"output"},{0->"qc parameters",1->" pdf",2->" cdf",3->"(Subscript[p, r]) vs s", 4->"(Subscript[p, r]) vs m"}},
Delimiter,
Style["parameters of the control measurements (in measurement units) ",Bold],
"assigned mean",
{{em,100.00,"(Subscript[m, 0])"},0.01,1000.00,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
"observed mean",
{{m,99.00,"m"},0.01,1000.00,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
"standard deviation",
{{s,1.50,"s"},0.01,1000.00,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["quality specifications",Bold],
"total allowable analytical error (%)",
{{ptaae,10.00,"t"},0.01,200.00,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
"maximum fraction nonconforming",
{{a,0.10,"(Subscript[f, max])"},0.01,0.99,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
"minimum probability for critical random  error detection",
{{minpred,0.90,""},0.01,0.99,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
"minimum probability for critical systematic error detection",
{{minpsed,0.90,""},0.01,0.99,.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["number of control measurements",Bold],
{{c,4,"c"},1,6,1,ImageSize->Tiny,Appearance->"Labeled"},
ControlPlacement->Left,SaveDefinitions->True,SynchronousUpdating->False,TrackedSymbols->True,
AutorunSequencing->{1}],
"compare"->
TabView[{
"defining pfr"->
Manipulate[If[k1>n1,k1=n1];If[k2>n2,k2=n2];pro[t,pr,r];
Column[{Switch[f,vf,pss[t,n1,k1,p1,n2,k2,p2,r],df,dpss[t,n1,k1,p1,n2,k2,p2,r],rdf, rdpss[t,n1,k1,p1,n2,k2,p2,r],rf,rpss[t,n1,k1,p1,n2,k2,p2,r]],Text@gpfrss[n1,k1,p1,n2,k2,p2]},Center],
{{f,vf,"type"},{vf->"probabilities",df->"difference",rdf->"relative difference", rf->"ratio"},ControlPlacement->Left},
{{t,2,"vs standardized"},{1->"s",2->"m"},ControlPlacement->Left},
{{r,6,"plot range"},1,10,0.1,ImageSize->Tiny,Appearance->"Labeled",ControlPlacement->Left},
"",
Delimiter,
Style["first statistical single-value QC rule",Bold],
Style["size of QC sample",Plain],
{{n1,2,"n"},1,6,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["number of out of control measurements per QC sample",Plain],
{{k1,n1,"k"},1,Dynamic[n1],1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["probability for for false rejection",Plain],
{{p1,0.01,"(Subscript[p, fr])"},0.000001,0.1,0.000001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["second statistical statistical single-value QC rule",Bold],
Style["size of QC sample",Plain],
{{n2,2,"n"},1,6,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["number of out of control measurements per QC sample",Plain],
{{k2,n2,"k"},1,Dynamic[n2],1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["probability for for false rejection",Plain],
{{p2,0.02,"(Subscript[p, fr])"},0.000001,0.1,0.000001,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,TrackedSymbols->True,ControlPlacement->Left],
"defining decision limit"->
Manipulate[If[k1>n1,k1=n1];If[k2>n2,k2=n2];pro[True,pr,r];
Column[{Switch[f,vf,pssl[t,n1,k1,l1,n2,k2,l2,r],df,dpssl[t,n1,k1,l1,n2,k2,l2,r],rdf, rdpssl[t,n1,k1,l1,n2,k2,l2,r],rf,rpssl[t,n1,k1,l1,n2,k2,l2,r]],Text@gpfrssl[n1,k1,l1,n2,k2,l2]},Center],
{{f,vf,"type"},{vf->"probabilities",df->"difference",rdf->"relative difference", rf->"ratio"}},
{{t,2,"vs standardized"},{1->"s",2->"m"},ControlPlacement->Left},
{{r,6,"plot range"},1,10,0.1,ImageSize->Tiny,Appearance->"Labeled",ControlPlacement->Left},
"",
Delimiter,
Style["first statistical single-value QC rule",Bold],
Style["size of QC sample",Plain],
{{n1,2,"n"},1,6,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["number of out of control measurements per QC sample",Plain],
{{k1,n1,"k"},1,Dynamic[n1],1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["decision limit",Plain],
{{l1,2.50,"l"},1.00,4.00,0.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["second statistical single-value QC rule",Bold],
Style["size of QC sample",Plain],
{{n2,2,"n"},1,6,1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["number of out of control measurements per QC sample",Plain],
{{k2,n2,"k"},1,Dynamic[n2],1,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
Style["decision limit",Plain],
{{l2,3.00,"l"},1.00,4.00,0.01,ImageSize->Tiny,Appearance->"Labeled"},
Delimiter,
SaveDefinitions->True,TrackedSymbols->True,ControlPlacement->Left]},
ImageSize->All]},
 ImageSize->Automatic
]}]

Abbreviations
QC: quality control
(Subscript[p, r]): probability for rejection
(Subscript[p, fr]): probability for false rejection

Notation
S(x;m,s,l): statistical single-value  QC rule with decision limit m±l s, applied on a tuple x of control measurements.
𝒩(m,(s^2)): normal distribution with mean m and standard deviation s.
P(n,k,m,s;0.00,1.00,l): probability for rejection of the statistical single-value QC rule  S(x;0.00,1.00,l) applied on a tuple x of n control measurements, k of them distributed as 𝒩(m,(s^2)) and n-k as 𝒩(0.00,1.00)

Disclaimer of Warranties
The notebook is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or Hellenic Complex Systems Laboratory or any of its members be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the notebook or the use or other dealings in the notebook.

About
Quality
Version Number 1.0.2.3
Hellenic Complex Systems Laboratory 2024
The notebook is distributed under  an Attribution - NonCommercial - ShareAlike 4.0 International Creative Commons License