AAn example may help to illustrate the construction of control limits for counts data. We are inspecting 25 successive wafers, each containing 100 chips. Here the wafer is the inspection unit. The observed number of defects turn into chart. http://www.itl.nist.gov/div898/handbook/pmc/section3/pmc331.htm.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.

library(qcc)
## Package 'qcc' version 2.7
## Type 'citation("qcc")' for citing this R package in publications.
df = read.csv("D:/Program Files/ffff/WAfer_defects.csv")
qcc(df$Number, type="xbar.one", data.name="Number of Wafer Defects")

## List of 11
##  $ call      : language qcc(data = df$Number, type = "xbar.one", data.name = "Number of Wafer Defects")
##  $ type      : chr "xbar.one"
##  $ data.name : chr "Number of Wafer Defects"
##  $ data      : int [1:25, 1] 16 14 28 16 12 20 10 12 10 17 ...
##   ..- attr(*, "dimnames")=List of 2
##  $ statistics: Named int [1:25] 16 14 28 16 12 20 10 12 10 17 ...
##   ..- attr(*, "names")= chr [1:25] "1" "2" "3" "4" ...
##  $ sizes     : int [1:25] 1 1 1 1 1 1 1 1 1 1 ...
##  $ center    : num 16
##  $ std.dev   : num 5.28
##  $ nsigmas   : num 3
##  $ limits    : num [1, 1:2] 0.153 31.847
##   ..- attr(*, "dimnames")=List of 2
##  $ violations:List of 2
##  - attr(*, "class")= chr "qcc"
library(qcc)
## Package 'qcc' version 2.7
## Type 'citation("qcc")' for citing this R package in publications.
data(pistonrings)
attach(pistonrings)
head(pistonrings)
##   diameter sample trial
## 1   74.030      1  TRUE
## 2   74.002      1  TRUE
## 3   74.019      1  TRUE
## 4   73.992      1  TRUE
## 5   74.008      1  TRUE
## 6   73.995      2  TRUE
##   diameter sample trial
## 1   74.030      1  TRUE
## 2   74.002      1  TRUE
## 3   74.019      1  TRUE
## 4   73.992      1  TRUE
## 5   74.008      1  TRUE
## 6   73.995      2  TRUE

diameter <- qcc.groups(diameter, sample)
q <- qcc(diameter[1:25,], type="xbar", nsigmas=3, plot=TRUE)

process.capability(q, spec.limits=c(73.99,74.01))

## 
## Process Capability Analysis
## 
## Call:
## process.capability(object = q, spec.limits = c(73.99, 74.01))
## 
## Number of obs = 125          Target = 74
##        Center = 74              LSL = 73.99
##        StdDev = 0.009785        USL = 74.01
## 
## Capability indices:
## 
##        Value    2.5%   97.5%
## Cp    0.3407  0.2983  0.3830
## Cp_l  0.3807  0.3176  0.4439
## Cp_u  0.3006  0.2424  0.3588
## Cp_k  0.3006  0.2312  0.3700
## Cpm   0.3382  0.2960  0.3804
## 
## Exp<LSL 13%   Obs<LSL 12%
## Exp>USL 18%   Obs>USL 16%
## 
## Process Capability Analysis
## 
## Call:
## process.capability(object = q, spec.limits = c(73.99, 74.01))
## 
## Number of obs = 125          Target = 74
##        Center = 74              LSL = 73.99
##        StdDev = 0.009785        USL = 74.01
## 
## Capability indices:
## 
##        Value    2.5%   97.5%
## Cp    0.3407  0.2983  0.3830
## Cp_l  0.3807  0.3176  0.4439
## Cp_u  0.3006  0.2424  0.3588
## Cp_k  0.3006  0.2312  0.3700
## Cpm   0.3382  0.2960  0.3804
## 
## Exp<LSL 13%   Obs<LSL 12%
## Exp>USL 18%   Obs>USL 16%

process.capability(q, spec.limits = c(73.99, 74.1))

## 
## Process Capability Analysis
## 
## Call:
## process.capability(object = q, spec.limits = c(73.99, 74.1))
## 
## Number of obs = 125          Target = 74.05
##        Center = 74              LSL = 73.99
##        StdDev = 0.009785        USL = 74.1
## 
## Capability indices:
## 
##        Value    2.5%   97.5%
## Cp    1.8736  1.6406  2.1063
## Cp_l  0.3807  0.3176  0.4439
## Cp_u  3.3665  3.0115  3.7215
## Cp_k  0.3807  0.3055  0.4559
## Cpm   0.4083  0.3377  0.4788
## 
## Exp<LSL 13%   Obs<LSL 12%
## Exp>USL 0%    Obs>USL 0%
## 
## Process Capability Analysis
## 
## Call:
## process.capability(object = q, spec.limits = c(73.99, 74.1))
## 
## Number of obs = 125          Target = 74.05
##        Center = 74              LSL = 73.99
##        StdDev = 0.009785        USL = 74.1
## 
## Capability indices:
## 
##        Value    2.5%   97.5%
## Cp    1.8736  1.6406  2.1063
## Cp_l  0.3807  0.3176  0.4439
## Cp_u  3.3665  3.0115  3.7215
## Cp_k  0.3807  0.3055  0.4559
## Cpm   0.4083  0.3377  0.4788
## 
## Exp<LSL 13%   Obs<LSL 12%
## Exp>USL 0%    Obs>USL 0%

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).