Simple Dorfman Screening-Finite
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: IEDORF1 */
/* TITLE: Simple Dorfman Screening-Finite */
/* PRODUCT: QC */
/* SYSTEM: ALL */
/* KEYS: Inspection Sampling, */
/* PROCS: TABULATE */
/* DATA: */
/* */
/* MISC: */
/* */
/* NOTES: This program tabulates measures of effectiveness */
/* for simple Dorfman screening of a finite lot under */
/* an imperfect inspection model. */
/* */
/* Notation: */
/* */
/* nlot = size of lot */
/* d = number of nonconforming items in lot */
/* */
/* n0 = sample size */
/* */
/* p = Pr[ correctly classifying defective */
/* item ] */
/* pprime = Pr[ incorrectly classifying a non- */
/* defective item ] */
/* */
/* p0 = Pr[ correct classification of positive */
/* on group test ] */
/* p0prime = Pr[ incorrect classification of positive */
/* on group test ] */
/* */
/* pcnc = Pr[ correct classification of defective */
/* (nonconforming) item ] */
/* pcc = Pr[ correctly classifying conforming */
/* item ] */
/* save = expected percent reduction in number of */
/* tests */
/* */
/* REF: Johnson, N. L., Kotz, S., and Rodriguez, R. N. */
/* (1987), Statistical Effects of Imperfect Inspection */
/* Sampling: III. Screening (Group Testing), Journal */
/* of Quality Technology 20, 98-124. */
/* */
/* Johnson, N. L., Kotz, S., and Wu, X. (1991). */
/* Inspection Errors for Attributes in Quality */
/* Control. London: Chapman & Hall. See Chapter 6. */
/* */
/****************************************************************/
data table;
keep nlot d n0 p pprime p0 p0prime pcc pcnc save;
label nlot = 'N (lot)'
d = 'D'
n0 = 'n0'
p = 'p'
pprime = 'p'''
p0 = 'p0'
p0prime = 'p0'''
pcc = 'PC(C)'
pcnc = 'PC(NC)'
save = 'Exp Pct Reduction' ;
format pcc 6.4 pcnc 6.4 save 4.1 ;
/*---set main parameters---*/
nlot = 200;
d = 10;
p = 0.95 ;
pprime = 0.05 ;
p0 = 0.98 ;
p0prime = 0.05 ;
/*---loop over sample values---*/
do n0 = 6, 8, 10, 12;
/*---find PC(NC)---*/
pcnc = p0 * p;
/*---find Pr[ no defectives | one member nondefective ] ---*/
bign_ = nlot - 1;
d_ = d ;
litn_ = n0 - 1;
y_ = 0 ;
link hypergmt;
pzstar = hypprob;
/*---find PC(C)---*/
pcc = pzstar * ( 1 - p0prime * pprime ) +
( 1 - pzstar ) * ( 1 - p0 * pprime );
/*---find Pr[ no defective items in sample ]---*/
bign_ = nlot ;
d_ = d;
litn_ = n0;
y_ = 0;
link hypergmt;
pzero = hypprob;
/*---find expected percent savings---*/
psub1 = ( p0 - p0prime ) * pzero ;
save = ( ( 1 - ( 1.0 / n0 ) ) - p0 ) + psub1 ;
save = save * 100 ;
/*---output observation---*/
output;
end; /* finish loop over values of n0 */
return; /* finish main program */
/*---Compute Hypergeometric Probability---*/
hypergmt:
hypprob = 0 ;
minarg = max( 0, litn_ + d_ - bign_ );
maxarg = min( litn_, d_ );
if y_ = minarg then
hypprob = probhypr( bign_, d_, litn_, y_ );
else
if ( minarg < y_ ) & ( y_ <= maxarg ) then
hypprob = probhypr( bign_, d_, litn_, y_ ) -
probhypr( bign_, d_, litn_, y_ - 1 );
/*---finish hypergeometric computation---*/
return;
run;
proc sort data=table;
by nlot d p pprime p0 p0prime;
proc print label noobs;
by nlot d p pprime p0 p0prime;
var n0 pcc pcnc save;
run;