Title: | Creation and Evaluation of Acceptance Sampling Plans |
---|---|
Description: | Provides functionality for creating and evaluating acceptance sampling plans. Sampling plans can be single, double or multiple. |
Authors: | Andreas Kiermeier [aut, cre], Peter Bloomfield [ctb] |
Maintainer: | Andreas Kiermeier <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.10.9000 |
Built: | 2025-03-13 03:45:21 UTC |
Source: | https://github.com/andreaskiermeier/acceptancesampling |
Assess whether the sampling plan can meet the specified Producer Risk Point (PRP) and/or Consumer Risk Point (CRP).
object |
An object of class |
PRP |
The Producer Risk Point in the form of a two element
numeric vector of the form |
CRP |
The Consumer Risk Point in the form of a two element
numeric vector of the form |
print |
Logical indicating whether to print a summary of the
assessment or not. Defaults to |
Assess whether the sampling plan can meet the provided producer and/or consumer risk point(s).
assess(object, PRP, CRP, print)
Andreas Kiermeier
Find the sampling plan with smallest sample size (single sample only) such that specified Producer Risk Point (PRP) and Consumer Risk Point (CRP) are both met.
PRP |
The Producer Risk Point in the form of a two element
numeric vector of the form |
CRP |
The Consumer Risk Point in the form of a two element
numeric vector of the form |
type |
The distribution which the sampling plan is based
on. Possible values are |
N |
The size of the population from which samples are drawn. Only
applicable for |
s.type |
The type of the standard deviation. A value of
|
find.plan(PRP, CRP, type="binomial")
find.plan(PRP, CRP, type="hypergeom", N)
find.plan(PRP, CRP, type="normal", s.type="unknown")
Andreas Kiermeier
The preferred way of creating new objects from the family
of "OC2c"
classes.
OC2c(n,c,r=if (length(c)<=2) rep(1+c[length(c)], length(c)) else NULL, type=c("binomial","hypergeom", "poisson"), ...)
OC2c(n,c,r=if (length(c)<=2) rep(1+c[length(c)], length(c)) else NULL, type=c("binomial","hypergeom", "poisson"), ...)
n |
A vector of length k giving the sample size at each of the k stages of sampling, e.g. for double sampling k=2. |
c |
A vector of length k giving the cumulative acceptance numbers at each of the k stages of sampling. |
r |
A vector of length k giving the cumulative rejection numbers at each of the k stages of sampling. |
type |
The possible types relate to the distribution on
which the plans are based on, namely, |
... |
Additional parameters passed to the class generating function for each type. See Details for options. |
Typical usages are:
OC2c(n, c) OC2c(n, c, r, pd) OC2c(n, c, r, type="hypergeom", N, pd) OC2c(n, c, r, type="poisson", pd)
The first and second forms use a default type
of
"binomial". The first form can calculate r
only when
n
and c
are of length 1 or 2.
The second form provides a the proportion of defectives, pd
, for
which the OC function should be calculated (default is pd=seq(0,
1, 0.01)
.
The third form states that the OC function based on a Hypergeometric
distribution is desired. In this case the population size N
also needs to be specified. In this case, pd
indicates the
proportion of population defectives, such that pd*N
gives the
actual number of defectives in the population. If N
or
pd
are not specified they take defaults of N=100
and
pd=seq(0, 1, 0.01)
. A warning is issued if N and D=N*pd are
not integers by checking the value, not the object type.
An object from the family of OC2c-class
, namely of class
OCbinomial
, OChypergeom
, or OCpoisson
.
## A standard binomial sampling plan x <- OC2c(10,1) x ## print out a brief summary plot(x) ## plot the OC curve plot(x, xlim=c(0,0.5)) ## plot the useful part of the OC curve ## A double sampling plan x <- OC2c(c(125,125), c(1,4), c(4,5), pd=seq(0,0.1,0.001)) x plot(x) ## Plot the plan ## Assess whether the plan can meet desired risk points assess(x, PRP=c(0.01, 0.95), CRP=c(0.05, 0.04)) ## A plan based on the Hypergeometric distribution x <- OC2c(10,1, type="hypergeom", N=5000, pd=seq(0,0.5, 0.025)) plot(x) ## The summary x <- OC2c(10,1, type="hypergeom", N=5000, pd=seq(0,0.5, 0.1)) summary(x, full=TRUE) ## Plotting against a function which generates P(defective) xm <- seq(-3, 3, 0.05) ## The mean of the underlying characteristic x <- OC2c(10, 1, pd=1-pnorm(0, mean=xm, sd=1)) plot(xm, x) ## Plot P(accept) against mean
## A standard binomial sampling plan x <- OC2c(10,1) x ## print out a brief summary plot(x) ## plot the OC curve plot(x, xlim=c(0,0.5)) ## plot the useful part of the OC curve ## A double sampling plan x <- OC2c(c(125,125), c(1,4), c(4,5), pd=seq(0,0.1,0.001)) x plot(x) ## Plot the plan ## Assess whether the plan can meet desired risk points assess(x, PRP=c(0.01, 0.95), CRP=c(0.05, 0.04)) ## A plan based on the Hypergeometric distribution x <- OC2c(10,1, type="hypergeom", N=5000, pd=seq(0,0.5, 0.025)) plot(x) ## The summary x <- OC2c(10,1, type="hypergeom", N=5000, pd=seq(0,0.5, 0.1)) summary(x, full=TRUE) ## Plotting against a function which generates P(defective) xm <- seq(-3, 3, 0.05) ## The mean of the underlying characteristic x <- OC2c(10, 1, pd=1-pnorm(0, mean=xm, sd=1)) plot(xm, x) ## Plot P(accept) against mean
The family "OC2c"
("Operating Characteristic"
function) of classes provides methods for creating, plotting, printing
and assessing single, double, and multiple acceptance sampling plans
based on the Binomial ("OCbinomial"
), Hypergeometric
("OChypergeom"
), and Poisson ("OCpoisson"
) distributions.
The "OC2c"
class is a virtual
Class: No objects may be created from it.
However, objects from the derived classes can be created by calls of
the form new("OCbinomial", ...)
, for example, or preferably
using the creator function OC2c
.
n
:Object of class "numeric"
. A vector of
length k giving the sample size at each of the k stages of
sampling, e.g. for double sampling k=2.
c
:Object of class "numeric"
. A vector of
length k giving the cumulative acceptance numbers at each
of the k stages of sampling.
r
:Object of class "numeric"
. A vector of
length k giving the cumulative rejection numbers at each
of the k stages of sampling.
type
:Object of class "character"
. The possible
types relate to the distribution on which the plans are based on,
namely, binomial
, hypergeom
, and poisson
pd
:Object of class "numeric"
. A numeric vector
indicating the quality for which a probability of acceptance is
calculated under the specified sampling plan. Meaning differs for
the different types
.
For "OCbinomial"
this relates to the proportion of
defectives created by the process.
For "OChypergeom"
this relates to the proportion of
population defectives created by the process.
For "OCpoisson"
this relates to the rate of defects (per
item) created by the process.
N
:Object of class "numeric"
. Only for class
"OChypergeom"
, a number giving the population (lot) size from
which the sample is drawn.
paccept
:Object of class "numeric"
. A numeric
vector with the probability of acceptance which correspond to the
quality as given by pd
.
signature(x="OCbinomial", y="missing")
,signature(x="numeric", y="OCbinomial")
,signature(x="OChypergeom", y="missing")
,signature(x="numeric", y="OChypergeom")
,signature(x="OCpoisson", y="missing")
orsignature(x="numeric", y="OCpoisson")
: Plot the OC curve.
signature("OC2c")
or signature("OChypergeom")
:
Show the details of the sampling plan.
signature("OC2c")
or
signature("OChypergeom")
: Summarise the sampling
plan. Optional argument full
(defaults to FALSE
)
will show the details at all quality values (pd
) supplied
when the object was created.
signature(objqect="OC2c")
: Assess whether the
sampling plan can meet the specified Producer Risk Point
(PRP) and/or Consumer Risk Point (CRP). For details see
assess,OC2c-method
Andreas Kiermeier
Hald, A. (1981), Statistical theory of sampling inspection by attributes, Academic Press.
The preferred way of creating new objects from the family
of "OCvar"
classes.
OCvar(n, k, type=c("normal"), ...)
OCvar(n, k, type=c("normal"), ...)
n |
A vector of length 1 giving the sample size. |
k |
A vector of length 1 giving the absolute distance, in units of the standard deviation, between the specification limit (based on the distribution of the items) and the acceptance limit (based on the distribution of the sample mean). See Schilling (1982) page 226 for details. |
type |
The possible types relate to the distribution on
which the plans are based on, namely, |
... |
Additional parameters passed to the class generating function for each type. See Details for options. |
Typical usages are:
OCvar(n, k, s) OCvar(n, k, pd, s) OCvar(n, k, pd, s, s.type)
The two forms use a default type
of "normal". Note that for the
normal distribution the value of the standard deviation must be
given. It is assumed to be the population standard deviation; this can
be changed by letting s.type="unknown"
.
The second form provides a the proportion of defectives, pd
,
for which the OC function should be calculated (default is
pd=seq(0, 1, 0.01)
.
An object from the family of OCvar-class
, namely of class
OCnormal
.
Schilling, E. G. (1982), Acceptance Sampling in Quality Control, Dekker
Guenther, W. C (1977), Sampling Inspection in Statistical Quality Control, Charles Griffin and Co Ltd
## A normal sampling plan - st. dev. known x <- OCvar(14, 1.205) x ## print out a brief summary plot(x) ## plot the OC curve plot(x, xlim=c(0,0.4)) ## plot the useful part of the OC curve ## Assess whether the plan can meet desired risk points assess(x, PRP=c(0.05, 0.95), CRP=c(0.2, 0.1)) summary(x, full=TRUE)
## A normal sampling plan - st. dev. known x <- OCvar(14, 1.205) x ## print out a brief summary plot(x) ## plot the OC curve plot(x, xlim=c(0,0.4)) ## plot the useful part of the OC curve ## Assess whether the plan can meet desired risk points assess(x, PRP=c(0.05, 0.95), CRP=c(0.2, 0.1)) summary(x, full=TRUE)
The family "OCvar"
("Operating Characteristic"
function) of classes provides methods for creating, plotting, printing
and assessing single acceptance sampling plans for variables,
based on the Normal ("OCnormal"
) distribution.
The "OCvar"
class is a virtual
Class: No objects may be created from it.
However, objects from the derived classes can be created by calls of
the form new("OCnormal", ...)
, for example, or preferably
using the creator function OCvar
.
n
:Object of class "numeric"
. A vector of
length 1 giving the sample size.
k
:Object of class "numeric"
. A vector of
length 1 giving the absolute distance, in units of the standard
deviation, between the specification limit (based on the
distribution of the items) and the acceptance limit (based on the
distribution of the sample mean). See Schilling (1982) page 226
for details.
type
:Object of class "character"
. The possible
types relate to the distribution on which the plans are based on.
Currently the only supported distribution is normal
.
pd
:Object of class "numeric"
. A numeric vector
indicating the quality for which a probability of acceptance is
calculated under the specified sampling plan. Meaning differs for
the different types
.
For "OCnormal"
this relates to the proportion of
defectives created by the process.
s
:Object of class "numeric"
. A vector of
length 1 giving the population/sample standard deviation.
s.type
:Object of class "character"
. Only for class
"OCnormal"
, indicates whether the plan is based on the
population (s.type="known"
) or sample standard deviation
(s.type="known"
).
paccept
:Object of class "numeric"
. A numeric
vector with the probability of acceptance which correspond to the
quality as given by pd
.
signature(x="OCnormal", y="missing")
,signature(x="numeric", y="OCnormal")
: Plot the OC curve.
signature("OCvar")
:
Show the details of the sampling plan.
signature("OCcar")
: Summarise the sampling
plan. Optional argument full
(defaults to FALSE
)
will show the details at all quality values (pd
) supplied
when the object was created.
signature(object="OCvar")
: Assess whether the
sampling plan can meet the specified Producer Risk Point
(PRP) and/or Consumer Risk Point (CRP). For details see
assess,OCvar-method
Andreas Kiermeier
Guenther, W. C. (1977) Sampling Inspection in statistical quality control, Charles Griffin and Company Limited
Hald, A. (1981), Statistical theory of sampling inspection by attributes, Academic Press.
Schilling, E. G. (1982), Acceptance Sampling in Quality Control, Dekker