OC2c: Operating Characteristics of an Acceptance Sampling Plan

Description Usage Arguments Details Value See Also Examples

Description

The preferred way of creating new objects from the family of "OC2c" classes.

Usage

1
2
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, binomial, hypergeom, and poisson.

...

Additional parameters passed to the class generating function for each type. See Details for options.

Details

Typical usages are:

1
2
3
4
5
    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

OC2c-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## 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

Example output

Acceptance Sampling Plan (binomial)

               Sample 1
Sample size(s)       10
Acc. Number(s)        1
Rej. Number(s)        2
Acceptance Sampling Plan (binomial)

               Sample 1 Sample 2
Sample size(s)      125      125
Acc. Number(s)        1        4
Rej. Number(s)        4        5
Acceptance Sampling Plan (binomial)

               Sample 1 Sample 2
Sample size(s)      125      125
Acc. Number(s)        1        4
Rej. Number(s)        4        5

Plan CANNOT meet desired risk point(s):

           Quality   RP P(accept) Plan P(accept)
PRP           0.01           0.95     0.89995598
CRP           0.05           0.04     0.01507571
Acceptance Sampling Plan (hypergeom with N=5000)

               Sample 1
Sample size(s)       10
Acc. Number(s)        1
Rej. Number(s)        2

Detailed acceptance probabilities:

 Pop. Defectives Pop. Prop. defective  P(accept)
               0                  0.0 1.00000000
             500                  0.1 0.73613783
            1000                  0.2 0.37556779
            1500                  0.3 0.14904357
            2000                  0.4 0.04620019
            2500                  0.5 0.01068073

AcceptanceSampling documentation built on May 1, 2019, 10:24 p.m.