OC2c {AcceptanceSampling} | R Documentation |
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