# An Introduction to Acceptance Sampling and SPC with R

*2019-08-07*

# Preface

This e-book was written for Stat 462 (Quality Control)(see Description) taught in the Statistics Department at Brigham Young University. It is free to read online here, and is licensed inder the Creative Commons Attribution-NonComercial-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-nc-sa/4.0/) One of the objectives of Stat 462 is to prepare students to pass the ASQ Certified Quality Process Analyst Exam. The book *The Certified Quality Process Analyst Handbook* by (Christensen, Betz, and Stein 2013) will prepare students for the Exam that is given by the American Society for Quality through Prometrix. That handbook shows the mechanics of using the published tables to create sampling plans and demonstrates how to use tables and hand calculations to create the limits for Shewhart style control charts and process capability indices. It shows how these and other statistical methods are elements of system for improving and controlling quality that is used in industry today. However, in the modern, world sampling plans and the statistical calculations used in statistical quality control are done with the help of computers.

To get more hands on experience in creating acceptance sampling plans and control charts necessarily involves the use of software. In industry, commercial software such as Minitab\(^{TM}\), SAS and StatGraphics\(^{TM}\) are often used. In this book we will focus on several R packages that can duplicate the functions of these commercial packages. R is open source software and runs on Windows, Mac and Linux operating systems. In addition to demonstrating how to use R for acceptance sampling and control charts, the workbook will focus on how the use of these specific tools can lead to quality improvements both within a company and within their supplier companies.

The prerequisites for this e-book are an introductory statistics course (Stat 121 or Stat 201 at BYU), two semesters of probability (Stat 240 and 340 at BYU at a level similar to that presented in (Carlton and Devore 2017)), and a course on the introduction to R programming (Stat 123 at BYU).

For those students wanting a review of basic statistics and probability, the book *Introduction to Probability and Statistics Using R* by (Kerns 2011) is available free online at (https://archive.org/details/IPSUR). A review of Chapters 3 (Data Description), 4 (Probability), 5 (Discrete Distributions), 6 (Continuous Distributions), 8 (Sampling Distributions), 9 (Estimation), 10 (Hypothesis Testing), and 11 (Simple Linear Regression) will provide adequate preparation for this workbook. Additionally (Kerns 2011)’s book illustrates the use of R for probability and statistical calculations.

For students with no experience with R, an article giving a basic introduction to R can be found at https://www.red-gate.com/simple-talk/dotnet/software-tools/r-basics/. Chapter 2 of *Introduction to Probability and Statistics using R* by (Kerns 2011) is also an introduction to R.

R can be downloaded from the Comprehensive R Archive Network (CRAN) Click Here. The RStudio Integrated Development Environment (IDE) provides a command interface and GUI. A basic tutorial on RStudio is available at http://web.cs.ucla.edu/~gulzar/rstudio/basic-tutorial.html. RStudio can be downloaded from https://www.rstudio.com/products/rstudio/download/. Instructions for installing R and RStudio on Windows, Mac and Linux operating systems can be found at http://socserv.mcmaster.ca/jfox/Courses/R/ICPSR/R-install-instructions.html.

ASQ has given permission to access their ANSI/ASQ Z1.4 and Z1.9 sampling tables through the R Package \(\verb!AQLSchemes!\) that is illiustrated in Chapters 2 and 3. However, they have asked that the use of this package be restricted to students in Stat 462 at BYU. For those that don’t have access to this package, examples are included in this ebook that replicate the functions of \(\verb!AQLSchemes!\) using sqc online calculator. This commercial online calculator grants free access for educational purposes.

**About the author** John Lawson is a Professor in the Statistics Department at Brigham Young University where he has been since 1986. He is an ASQ-CQE and he has a Masters Degree in Statistics from Rutgers University and a PhD in Applied Statistics from the Polytechnic Institute of N.Y. He worked as a statistician for Johnson & Johnson Corporation from 1971 to 1976, and he worked at FMC Corporation Chemical Division from 1976 to 1986 where he was the Manager of Statistical Services. He is the author of *Design and Analysis of Experiments with R*, CRC Press, and the co-author (with John Erjavec) of *Basic Experimental Strategies and Data Analysis for Science and Engineering*, CRC Press. If you notice errors or have suggestions for improvement to this e-book please contact John Lawson (lawson@stat.byu.edu).

### References

Carlton, M. A., and J. L. Devore. 2017. *Probability with Applications in Engineering, Science, and Technology*. 2nd ed. Switzerland: Springer.

Christensen, C., K.M. Betz, and M.S. Stein. 2013. *The Certified Quality Process Analyst Handbook*. 2nd ed. Milwaukee, Wisconsin: ASQ Quality Press.

Kerns, G. J. 2011. *Introduction to Probability and Statistics Using R*. G. J. Kerns.