Type: | Package |
Title: | Creation and Evaluation of Acceptance Sampling Plans |
Version: | 1.0-10 |
Date: | 2023-12-05 |
Description: | Provides functionality for creating and evaluating acceptance sampling plans. Sampling plans can be single, double or multiple. |
Depends: | methods, R(≥ 2.4.0), stats |
Imports: | graphics, utils |
License: | GPL (≥ 3) |
LazyLoad: | yes |
URL: | https://github.com/andreaskiermeier/AcceptanceSampling |
BugReports: | https://github.com/andreaskiermeier/AcceptanceSampling/issues |
NeedsCompilation: | no |
Packaged: | 2023-12-06 04:55:13 UTC; andre |
Author: | Andreas Kiermeier [aut, cre], Peter Bloomfield [ctb] |
Maintainer: | Andreas Kiermeier <Andreas.Kiermeier@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-12-06 05:50:05 UTC |
Operating Characteristics of an Acceptance Sampling Plan
Description
The preferred way of creating new objects from the family
of "OC2c"
classes.
Usage
OC2c(n,c,r=if (length(c)<=2) rep(1+c[length(c)], length(c)) else NULL,
type=c("binomial","hypergeom", "poisson"), ...)
Arguments
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. |
Details
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.
Value
An object from the family of OC2c-class
, namely of class
OCbinomial
, OChypergeom
, or OCpoisson
.
See Also
Examples
## 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
Class Family "OC2c".
Description
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.
Objects from the Class
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
.
Slots
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
, andpoisson
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 differenttypes
.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 bypd
.
Methods
- plot
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")
or
signature(x="numeric", y="OCpoisson")
: Plot the OC curve.
- show
signature("OC2c")
orsignature("OChypergeom")
: Show the details of the sampling plan.- summary
signature("OC2c")
orsignature("OChypergeom")
: Summarise the sampling plan. Optional argumentfull
(defaults toFALSE
) will show the details at all quality values (pd
) supplied when the object was created.- assess
signature(objqect="OC2c")
: Assess whether the sampling plan can meet the specified Producer Risk Point (PRP) and/or Consumer Risk Point (CRP). For details seeassess,OC2c-method
Author(s)
Andreas Kiermeier
References
Hald, A. (1981), Statistical theory of sampling inspection by attributes, Academic Press.
See Also
Operating Characteristics of an Acceptance Sampling Plan
Description
The preferred way of creating new objects from the family
of "OCvar"
classes.
Usage
OCvar(n, k, type=c("normal"), ...)
Arguments
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. |
Details
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)
.
Value
An object from the family of OCvar-class
, namely of class
OCnormal
.
References
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
See Also
Examples
## 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)
Class Family "OCvar".
Description
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.
Objects from the Class
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
.
Slots
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 isnormal
.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 differenttypes
.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 bypd
.
Methods
- plot
signature(x="OCnormal", y="missing")
,
signature(x="numeric", y="OCnormal")
: Plot the OC curve.
- show
signature("OCvar")
: Show the details of the sampling plan.- summary
signature("OCcar")
: Summarise the sampling plan. Optional argumentfull
(defaults toFALSE
) will show the details at all quality values (pd
) supplied when the object was created.- assess
signature(object="OCvar")
: Assess whether the sampling plan can meet the specified Producer Risk Point (PRP) and/or Consumer Risk Point (CRP). For details seeassess,OCvar-method
Author(s)
Andreas Kiermeier
References
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
See Also
Assessment methods for the class family "OC2c" and "OCvar".
Description
Assess whether the sampling plan can meet the specified Producer Risk Point (PRP) and/or Consumer Risk Point (CRP).
Arguments
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 |
Methods
- object="OC2c"
Assess whether the sampling plan can meet the provided producer and/or consumer risk point(s).
Usage
assess(object, PRP, CRP, print)
Author(s)
Andreas Kiermeier
See Also
Utility function for finding sampling plans.
Description
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.
Arguments
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
|
Usage
find.plan(PRP, CRP, type="binomial")
find.plan(PRP, CRP, type="hypergeom", N)
find.plan(PRP, CRP, type="normal", s.type="unknown")
Author(s)
Andreas Kiermeier