Package 'LTPDvar'

Title: LTPD and AOQL Plans for Acceptance Sampling Inspection by Variables
Description: Calculation of rectifying LTPD and AOQL plans for sampling inspection by variables which minimize mean inspection cost per lot of process average quality.
Authors: Nikola Kasprikova
Maintainer: Nikola Kasprikova <[email protected]>
License: GPL-2
Version: 1.2.1
Built: 2024-11-18 06:53:33 UTC
Source: CRAN

Help Index


LTPD and AOQL single sampling plans for inspection by variables

Description

Calculation and evaluation of rectifying LTPD and AOQL plans for sampling inspection by variables which minimize the mean inspection cost per lot of process average quality

Introduction

Assume that measurements of a single quality characteristic XX are independent, identically distributed normal random variables with parameters μ\mu and σ2\sigma^2. For the quality characteristic XX either an upper specification limit UU is given (the item is defective (non-conforming) if its measurement exceeds UU), or a lower specification limit LL is given (the item is defective if its measurement is smaller than LL). It is further assumed that the unknown parameter σ\sigma is estimated using the sample standard deviation ss.

The inspection procedure is as follows:

Draw a random sample of nn items and compute xˉ\bar{x} and ss.

Accept the lot if

Uxˉsk{{U - \bar{x}} \over s } \ge k

or

xˉLsk.{{\bar{x} - L}\over s} \ge k.

The operating characteristic (see OC) is

L(p;n,k)=kng(t;n1,u1pn)dt,L(p;n,k) = \int_{k\sqrt n}^\infty g(t;n-1,u_{1-p}\sqrt n) \,dt,

where g(t;n1,u1pn)g(t;n-1,u_{1-p}\sqrt n) is probability density function of non-central tt distribution with (n1)(n-1) degrees of freedom and noncentrality parameter λ=u1pn\lambda=u_{1-p}\sqrt n.

If case that we do not use exact formula for OC and we use the normal distribution as an approximation of the non-central tt distribution instead, we have

L(p;n,k)=Φ(u1pkA),L(p;n,k) = \Phi \left({u_{1-p}-k \over A} \right),

where

A=1n+k22(n1).A = \sqrt{{1 \over n} + {k^2 \over 2(n-1)}} .

The function Φ\Phi is a standard normal distribution function and u1pu_{1-p} is a quantile of order 1p1-p.

The task to be solved is determination of the sample size nn and the critical value kk.

LTPD plans for acceptance sampling inspection by variables

In case of acceptance sampling by attributes (each inspected item is classified as either good or defective), there exist a procedure (Dodge and Romig, 1998) for finding sampling plans which minimize the mean number of items inspected per lot of process average quality

Is=N(Nn)L(pˉ;n,c)I_s = N - (N-n)\cdot L(\bar{p};n,c)

under the condition which protects the consumer against the acceptance of a bad lot – the probability of accepting a submitted lot of tolerance quality ptp_t (consumer's risk) shall be 0.10,

L(pt;n,c)=0.10L(p_t;n,c) = 0.10

(LTPD single sampling plans), where the given parameters are NN, pˉ\bar{p}, ptp_t. NN is the number of items in the lot, pˉ\bar{p} is the process average fraction defective, ptp_t is the lot tolerance fraction defective (Pt=100ptP_t=100p_t is the lot tolerance per cent defective – denoted LTPD), nn is the number of items in the sample (n<N)(n<N), cc is the acceptance number (the lot is rejected when the number of defective items in the sample is greater than cc), L(p)L(p) is the operating characteristic (the probability of accepting a submitted lot with fraction defective pp).

LTPD plans for inspection by variables and attributes have been introduced in (Klufa, 1994). Under the same protection of consumer, LTPD plan for inspection by variables and attributes is in many situations more economical with respect to inspection cost than the corresponding Dodge-Romig LTPD attribute sampling plan.

For LTPD plans for inspection by variables and attributes (all items from the sample are inspected by variables, but the remainder of rejected lots is inspected only by attributes), new parameter cmc_m is introduced, as the cost of inspection of one item by variables divided by the cost of inspection of one item by attributes (usually is cm>1c_m > 1). Then the mean inspection cost per lot of process average quality is ImscaI_{ms}*c_a, where cac_a is the cost of inspection of one item by attributes and

Ims=ncm+(Nn)[1L(pˉ;n,k)].I_{ms} = n\cdot c_m + (N-n)\cdot [1 - L(\bar{p};n,k)].

(see Ims). So we search for the acceptance plan (n,k)(n,k) minimizing the mean inspection cost per lot of process average quality (or equivalently minimizing ImsI_{ms}) under the condition L(pt;n,k)=0.10L(p_t;n,k) = 0.10.

Then ImsI_{ms} may be expressed as a function of one variable nn

Ims(n)=ncm+(Nn)α(n),I_{ms}(n)=n\cdot c_m+(N-n)\cdot \alpha(n),

where α(n)\alpha(n) is the producer's risk (the probability of rejecting a lot of process average quality).

Function planLTPD searches for the sample size nn minimizing Ims(n)I_{ms}(n) and gives plan with resulting nn and corresponding kk as output. In planLTPD if method="napprox", approximate OC is used and the solution is obtained using procedure described in (Klufa, 1994). If method="exact" (default), the optimization procedure searches for nn in interval with centre at nn resulting from planLTPD(..., method = "napprox").

AOQL plans for acceptance sampling inspection by variables

Under the assumption that each inspected item is classified as either good or defective (acceptance sampling by attributes) Dodge and Romig (1998) introduced sampling plans (n,c)(n, c) which minimize the mean number of items inspected per lot of process average quality, assuming that the remainder of rejected lots is inspected

Is=N(Nn) ⁣ ⁣L(pˉ;n,c)I_s = N - (N-n)\!\cdot\!L(\bar p;n,c)

under the condition

max0<p<1AOQ(p)=pL,\max_{0<p<1} AOQ(p) = p_L,

where pLp_L is the average outgoing quality limit (the given parameter) and AOQ is the average outgoing quality, i. e. the mean fraction defective after inspection (assuming that each defective item found is replaced by good one) when the fraction defective before inspection was pp. Sampling plans for inspection by variables, which in comparison with sampling plans for inspection by attributes in many situations bring considerable savings in inspection cost, were then introduced in (Klufa, 1997). Function planAOQL searches for plan minimizing Ims(n)I_{ms}(n) under the condition that AOQ does not exceed the given value pLp_L. In planAOQL if method="napprox", approximate OC is used and the solution is obtained using procedure described in (Klufa, 1997). If method="exact" (default), the optimization procedure searches for nn in interval with centre at nn resulting from planAOQL(..., method = "napprox").

Rectifying LTPD and AOQL plans minimizing ImsI_{ms} based on EWMA statistics

Another option is to use a procedure based on EWMA statistic. The procedure is as follows: draw a random sample of nn items from the lot and compute the sample mean xˉ\bar{x} and the statistic TT at time tt as Tt=λxˉ+(1λ)Tt1T_t=\lambda \bar{x}+(1-\lambda)T_{t-1}, where λ\lambda is a smoothing constant (usually between 0 and 1). Accept the lot if

UTtσk\frac{U-T_t}{\sigma} \ge k

or

TtLσk.\frac{T_t-L}{\sigma} \ge k.

The operating characteristic is (see e.g. (Aslam et al., 2015)) L(p,n,k)=Φ((u1pk)A),L(p,n,k)=\Phi((u_{1-p}-k)A), where A=n(2λ)λ,A=\sqrt{\frac{n(2-\lambda)}{\lambda}}, where the function Φ\Phi is a standard normal distribution function and u1pu_{1-p} is a quantile of order 1p1-p (the unique root of the equation Φ(u)=1p)\Phi(u)=1-p). Similarly for the unknown σ\sigma case, when the sample standard deviation is used in place of σ\sigma - the operating characteristic is then (see e.g. Aslam et al., 2015)

L(p)=Φ(u1pc4k)1λn(2λ)+k2(1c42),L(p)=\Phi(u_{1-p}c_4-k)\sqrt{\frac{1}{\frac{\lambda}{ n(2-\lambda)}+k^2(1-{c_4}^2) }},

where c4=(2/(n1))Γ(n/2)Γ((n1)/2)c_4=\sqrt{(2/(n-1))}\frac{\Gamma(n/2)}{\Gamma((n-1)/2)}.

Author(s)

Nikola Kasprikova

Maintainer: Nikola Kasprikova <[email protected]>

References

Aslam, M., Azam, M., and Jun, C.: A new lot inspection procedure based on exponentially weighted moving average. International Journal of Systems Science 46, 1392 - 1400, 2015.

Dodge, H. F. - Romig, H. G.: Sampling Inspection Tables: Single and Double Sampling. John Wiley, 1998.

Klufa, J.: Acceptance Sampling by Variables when the Remainder of Rejected Lots is Inspected. Statistical Papers, Vol.35, 337 - 349, 1994.

Klufa, J.: Exact calculation of the Dodge-Romig LTPD single sampling plans for inspection by variables. Statistical Papers, Vol. 51(2), 297-305, 2010.

Klufa J,: Dodge-Romig AOQL single sampling plans for inspection by variables. Statistical Papers 38: 111 - 119, 1997.

See Also

planLTPD, planAOQL, OC, AOQ, Ims

Examples

# calculation of LTPD plan
zz=planLTPD(N=1000,pt=0.1,pbar=0.001);zz
plot(zz);
# create another plan
zz2=new("ACSPlan", n=16, k=2.71)
plot(zz2,xl=0.001, xu=0.15, xlabm="fraction non-conforming",
ylabm="probability of acceptance",typem="l",typeOC="exact")
plot(new("ACSPlan", n=20, k=2.58555),typeOC="ewmaSK",lam=0.95)
# calculation of AOQL plan
planAOQL(N=1000,pbar=0.005,pL=0.01, method="napprox", cm=1.5)

Class ACSPlan

Description

Class for single-sample plan of sampling inspection by variables. The plan is specified by sample size nn and critical value kk.

Objects from the Class

Objects can be created by calls of the form new("ACSPlan", ...). Objects represent sampling plan.

Slots

n:

Object of class "numeric", sample size, i. e. number of items to be inspected

k:

Object of class "numeric", critical value

Methods

k

signature(object = "ACSPlan"): accessor function for extraction of critical value of the sampling plan

n

signature(object = "ACSPlan"): accessor function for extraction of sample size of the sampling plan

plot

signature(x = "ACSPlan"): function for getting operating characteristics plot of the sampling plan

See Also

planLTPD, planAOQL

Examples

showClass("ACSPlan")

Average outgoing quality

Description

Average outgoing quality is the mean fraction defective after inspection when the fraction defective before inspection was pp, lot size is NN and plan (n,k)(n,k) is used for sampling inspection. The average outgoing quality (assuming that all defective items found are replaced by good ones) is approximately

AOQ(p)=(1nN) ⁣p ⁣L(p;n,c).AOQ(p)=\left(1-\frac{n}N\right)\!\cdot p\cdot\!L(p;n,c).

Usage

AOQ(p,n,k,N, type=c("exact", "napprox","ewmaSK","ewma2"),lam=1)

Arguments

p

fraction defective before inspection

n

sample size

k

critical value

N

lot size (number of items in the lot)

type

type of operating characteristic, see OC, default value "exact"

lam

smoothing parameter for the EWMA statistic, default 1

Value

single value

See Also

LTPDvar-package

Examples

AOQ(0.002,41,2.057083,1000)

Break-even value of cm parameter

Description

Break-even value of cmc_m parameter (which is ratio of cost of inspection of one item by variables to cost of inspection of the item by attributes), i. e. the value of cmc_m for which mean inspection cost per lot of process average quality for inspection by variables and attributes is equal to mean inspection cost per lot of process average quality for inspection by attributes, using plan (n,c)(n, c).

Usage

cmBE(N, pbar,px,n,c,type=c("LTPD","AOQL"),
type2 = c("exact", "napprox","ewmaSK","ewma2"),lam=1)

Arguments

N

lot size (number of items in the lot)

pbar

process average fraction defective

px

lot tolerance fraction defective ptpt (if type="LTPD", which is default) or average outgoing quality limit pLp_L (if type="AOQL")

n

sample size of benchmark plan for sampling inspection by attributes

c

acceptance number of benchmark plan for sampling inspection by attributes

type

type of acceptance sampling plan; "LTPD" stands for Lot Tolerance Percent Defective (see planLTPD), "AOQL" stands for Average Outgoing Quality Limit (see planAOQL)

type2

type of OC to be used

lam

smoothing parameter in case that the EWMA statistic is to be used, defaults to 1

Value

single number

References

Kasprikova, N. and Klufa, J.: AOQL Sampling Plans for Inspection by Variables and Attributes Versus the Plans for Inspection by Attributes. Quality Technology & Quantitative Management, 12/6. 2015.

See Also

planLTPD, planAOQL

Examples

cmBE(N=1000,pbar=0.001,px=0.01,n=80,c=0,type="LTPD",type2="exact");

Inspection cost function

Description

mean inspection cost per lot of process average quality, assuming that the sample is inspected by variables and the remainder of rejected lots is inspected by attributes, divided by parameter cm (cost of inspecting one item by variables divided by cost of inspecting the item by attributes)

Usage

Ims(n, k, N,  pbar, cm = 1,type = c("exact", "napprox","ewmaSK","ewma2"),lam=1)

Arguments

n

sample size

k

critical value of the samping plan

N

lot size (number of items in the lot)

pbar

process average fraction defective

cm

cost of inspection of one item by variables divided by cost of inspection of the item by attributes, default value 1

type

type of OC (operating characteristic) used, either "exact" (default) using non-central t-distribution, or "napprox" for approximate OC; if EWMA statistic is to be used, "ewmaSK" stands for the sigma known case, "ewma2" stands for the sigma unknown case

lam

smoothing parameter in case that EWMA statistic is used

Value

single value

See Also

LTPDvar-package

Examples

Ims(20, 2.58555,1000, 0.001 ,1.5,type="ewmaSK",lam=1 )

Function for extracting critical value

Description

accessor function for extracting critical value from sampling plan

Usage

k(object)

Arguments

object

sampling plan

Value

single value

See Also

codeACSPlan-class,

Examples

# first create an acceptance sampling plan
planek=new("ACSPlan",n=100,k=3)
k(planek)

Methods for Function k

Description

Methods for function k

Methods

signature(object = "ACSPlan")

method for extracting critical value kk from object of ACSPlan-class (acceptance sampling plan)


Function for sample size extraction

Description

function for sample size extraction from acceptance sampling plan

Usage

n(object)

Arguments

object

sampling plan

Value

single value

See Also

ACSPlan-class,

Examples

# first create an acceptance sampling plan
planek=new("ACSPlan",n=100,k=3)
n(planek)

Methods for Function n

Description

Methods for function n

Methods

signature(object = "ACSPlan")

method for extracting sample size nn from object of class ACSPlan-class (acceptance sampling plan)


Operating characteristic

Description

Calculation of probability of acceptance of a lot with fraction defective pp when using plan (n,k)(n, k) for sampling inspection

Usage

OC(p, n, k, type = c("exact", "napprox","ewmaSK","ewma2"),lam=1)

Arguments

p

fraction defective

n

sample size

k

critical value

type

function used for operating characteristic; "t" stands for exact function using non-central t-distribution (see (Johnson and Welch, 1940)), "napprox" stands for approximation using normal distribution, (see (Jennett and Welch, 1939)); if EWMA statistic is to be used, "ewmaSK" stands for the sigma known case, "ewma2" stands for the sigma unknown case

lam

smoothing parameter in case that EWMA statistic is used

Value

probability of acceptance of a lot (single number)

References

Jennett, W. J. - Welch, B. L.: The Control of Proportion Defective as Judged by a Single Quality Characteristic Varying on a Continuous Scale, Supplement to the Journal of the Royal Statistical Society, Vol. 6, No. 1, pp. 80-88, 1939.

Johnson, N. L. - Welch, B. L.: Applications of the Non-Central t-Distribution, Biometrika, Vol. 31, No. 3/4, pp. 362-389, 1940.

Examples

OC(p=0.1,n=85,k=2.44)

Calculation of AOQL plan for sampling inspection by variables

Description

Calculation of AOQL plan (sample size nn and critical value kk) for sampling inspection by variables. Plans minimize mean inspection cost per lot of process average quality and at the same time satisfy limit on average outgoing quality (see AOQ).

Usage

planAOQL(N, pbar, pL, method = c("exact", "napprox","ewmaSK","ewma2"), cm = 1,
	intdif = 20,lam=1)

Arguments

N

lot size (number of items in the lot)

pbar

process average fraction defective

pL

average outgoing quality limit

method

type of OC (operating characteristic) used, either "exact" (default) using non-central t-distribution, or "napprox" for approximate OC; if EWMA statistic is to be used, "ewmaSK" stands for the sigma known case, "ewma2" stands for the sigma unknown case

cm

parameter used in cost function of plans (see Ims) and defined as cost of inspection of one item by variables divided by cost of inspection of the item by attributes, default value 1

intdif

parameter used in finding nn when method other than "napprox", controlling the width of interval to be searched in for sampling plan optimal w.r.t. cost, difference from interval centre (nn resulting from planLTPD(..., method = "napprox") to lower or upper bound, default value 20

lam

smoothing parameter in case that EWMA statistic is used

Value

ACSPlan-class object

References

Klufa J (1997) Dodge-Romig AOQL single sampling plans for inspection by variables. Statistical Papers 38: 111 - 119

See Also

LTPDvar-package, OC, AOQ, ACSPlan-class, Ims

Examples

# find AOQL plan
planAOQL(N=1000,pbar=0.005,pL=0.01, method="napprox", cm=1.5);
planAOQL(N=8000, pbar=0.003, pL=0.01, cm=1.5,method="ewmaSK", lam=0.9,intdif=40);
planAOQL(N=8000, pbar=0.003, pL=0.01, cm=1.5,method="ewma2", lam=0.9);

Calculation of LTPD plan for sampling inspection by variables

Description

Calculation of LTPD plan (sample size nn and critical value kk) for sampling inspection by variables

Usage

planLTPD(N, pt, pbar, b = 0.1, cm = 1,method = c("exact", "napprox","ewma2","ewmaSK" ),
intdif = 20,lam=1)

Arguments

N

lot size (number of items in the lot)

pt

lot tolerance fraction defective

pbar

process average fraction defective

b

probability of accepting a lot of tolerance quality pt (consumer risk), default value 0.1

cm

parameter used in cost function of plans (see Ims) and defined as cost of inspection of one item by variables divided by cost of inspection of the item by attributes, default value 1

method

type of OC (operating characteristic) used, either "exact" (default) using non-central t-distribution, or "napprox" for approximate OC; if EWMA statistic is to be used, "ewmaSK" stands for the sigma known case, "ewma2" stands for the sigma unknown case

intdif

parameter used in finding nn when method other than "napprox", controlling the width of interval to be searched in for sampling plan optimal w.r.t. cost, difference from interval centre (nn resulting from planLTPD(..., method = "napprox") to lower or upper bound, default value 20

lam

smoothing parameter in case that EWMA statistic is used

Value

An instance of ACSPlan-class, with sample size in slot n and critical value in slot k.

References

Klufa, J.: Exact calculation of the Dodge-Romig LTPD single sampling plans for inspection by variables. Statistical Papers, Springer, Vol. 51(2), pages 297-305, 2010.

See Also

LTPDvar-package, OC, ACSPlan-class, Ims

Examples

# find LTPD plan
planLTPD(N=1000,pt=0.1,pbar=0.001);
planLTPD(1000, 0.01,0.001,cm=1.5,b=0.1,method="ewmaSK",lam=0.9,intdif=60);
planLTPD(1000, 0.01,0.001,cm=1.5,b=0.1,method="ewma2",lam=0.9);

Methods for Function plot in Package graphics

Description

Methods for function plot in package graphics

Methods

signature(x = "ACSPlan")

method for plotting OC (operating characteristic, i. e. curve showing probability of acceptance of a lot with fraction defective pp) for acceptance sampling plan (object of class ACSPlan-class)

signature(x = "ANY")