R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("qcc-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('qcc') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "cause.and.effect" > > ### * cause.and.effect > > flush(stderr()); flush(stdout()) > > ### Name: cause.and.effect > ### Title: Cause and effect diagram > ### Aliases: cause.and.effect > ### Keywords: hplot > > ### ** Examples > > cause.and.effect(cause=list(Measurements=c("Micrometers", "Microscopes", "Inspectors"), + Materials=c("Alloys", "Lubricants", "Suppliers"), + Personnel=c("Shofts", "Supervisors", "Training", "Operators"), + Environment=c("Condensation", "Moisture"), + Methods=c("Brake", "Engager", "Angle"), + Machines=c("Speed", "Lathes", "Bits", "Sockets")), + effect="Surface Flaws") > > > > cleanEx(); ..nameEx <- "circuit" > > ### * circuit > > flush(stderr()); flush(stdout()) > > ### Name: circuit > ### Title: Circuit boards data > ### Aliases: circuit > ### Keywords: datasets > > ### ** Examples > > data(circuit) > attach(circuit) > summary(circuit) x size trial Min. : 5.00 Min. :100 Mode :logical 1st Qu.:16.00 1st Qu.:100 FALSE:20 Median :19.00 Median :100 TRUE :26 Mean :19.17 Mean :100 3rd Qu.:22.00 3rd Qu.:100 Max. :39.00 Max. :100 > boxplot(x ~ trial) > plot(x, type="b") > detach(circuit) > > > > cleanEx(); ..nameEx <- "cusum.qcc" > > ### * cusum.qcc > > flush(stderr()); flush(stdout()) > > ### Name: cusum.qcc > ### Title: Cusum chart > ### Aliases: cusum cusum.default cusum.qcc > ### Keywords: htest hplot > > ### ** Examples > > data(pistonrings) > attach(pistonrings) > diameter <- qcc.groups(diameter, sample) > q <- qcc(diameter[1:25,], type="xbar", nsigmas=3, plot=FALSE) > cusum(q) > q <- qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], nsigmas=3, plot=FALSE) > cusum(q) > cusum(q, chart.all=FALSE) > cusum(qcc(diameter, type="xbar", nsigmas=3, target=74, std.dev=0.02, plot=FALSE)) > > > > cleanEx(); ..nameEx <- "dyedcloth" > > ### * dyedcloth > > flush(stderr()); flush(stdout()) > > ### Name: dyedcloth > ### Title: Dyed cloth data > ### Aliases: dyedcloth > ### Keywords: datasets > > ### ** Examples > > data(dyedcloth) > attach(dyedcloth) > summary(dyedcloth) x size Min. : 7.00 Min. : 8.00 1st Qu.:11.25 1st Qu.:10.00 Median :15.00 Median :10.25 Mean :15.30 Mean :10.75 3rd Qu.:19.75 3rd Qu.:12.00 Max. :23.00 Max. :13.00 > plot(x/size, type="b") > detach(dyedcloth) > > > > cleanEx(); ..nameEx <- "ewma.qcc" > > ### * ewma.qcc > > flush(stderr()); flush(stdout()) > > ### Name: ewma.qcc > ### Title: EWMA chart > ### Aliases: ewma ewma.qcc > ### Keywords: htest hplot > > ### ** Examples > > data(pistonrings) > attach(pistonrings) > diameter <- qcc.groups(diameter, sample) > q <- qcc(diameter[1:25,], type="xbar", nsigmas=3, plot=FALSE) > ewma(q, lambda=0.2) > q <- qcc(diameter[1:25,], newdata=diameter[26:40,], type="xbar", plot=FALSE) > ewma(q, lambda=0.2, nsigmas=2.7) > > > > cleanEx(); ..nameEx <- "ewmaSmooth" > > ### * ewmaSmooth > > flush(stderr()); flush(stdout()) > > ### Name: ewmaSmooth > ### Title: EWMA smoothing function > ### Aliases: ewmaSmooth > ### Keywords: hplot > > ### ** Examples > > x <- 1:50 > y <- rnorm(50, sin(x/5), 0.5) > plot(x,y) > lines(ewmaSmooth(x,y,lambda=0.1), col="red") > > > > cleanEx(); ..nameEx <- "oc.curves" > > ### * oc.curves > > flush(stderr()); flush(stdout()) > > ### Name: oc.curves > ### Title: Operating Characteristic Function > ### Aliases: oc.curves oc.curves.xbar oc.curves.p oc.curves.c > ### Keywords: htest hplot > > ### ** Examples > > data(pistonrings) > attach(pistonrings) > diameter <- qcc.groups(diameter, sample) > beta <- oc.curves.xbar(qcc(diameter, type="xbar", nsigmas=3, plot=FALSE)) > print(round(beta, digits=4)) sample size shift (std.dev) n=5 n=1 n=10 n=15 n=20 0 0.9973 0.9973 0.9973 0.9973 0.9973 0.05 0.9971 0.9973 0.9970 0.9968 0.9966 0.1 0.9966 0.9972 0.9959 0.9952 0.9944 0.15 0.9957 0.9970 0.9940 0.9920 0.9900 0.2 0.9944 0.9968 0.9909 0.9869 0.9823 0.25 0.9925 0.9964 0.9864 0.9789 0.9701 0.3 0.9900 0.9960 0.9798 0.9670 0.9514 0.35 0.9866 0.9956 0.9708 0.9500 0.9243 0.4 0.9823 0.9950 0.9586 0.9266 0.8871 0.45 0.9769 0.9943 0.9426 0.8957 0.8383 0.5 0.9701 0.9936 0.9220 0.8562 0.7775 0.55 0.9616 0.9927 0.8963 0.8078 0.7055 0.6 0.9514 0.9916 0.8649 0.7505 0.6243 0.65 0.9390 0.9905 0.8275 0.6853 0.5371 0.7 0.9243 0.9892 0.7842 0.6137 0.4481 0.75 0.9071 0.9877 0.7351 0.5379 0.3616 0.8 0.8871 0.9860 0.6809 0.4608 0.2817 0.85 0.8642 0.9842 0.6225 0.3851 0.2115 0.9 0.8383 0.9821 0.5612 0.3136 0.1527 0.95 0.8094 0.9798 0.4983 0.2485 0.1059 1 0.7775 0.9772 0.4355 0.1913 0.0705 1.05 0.7428 0.9744 0.3743 0.1431 0.0450 1.1 0.7055 0.9713 0.3161 0.1038 0.0275 1.15 0.6659 0.9678 0.2622 0.0730 0.0161 1.2 0.6243 0.9641 0.2134 0.0497 0.0090 1.25 0.5812 0.9599 0.1703 0.0328 0.0048 1.3 0.5371 0.9554 0.1333 0.0209 0.0024 1.35 0.4925 0.9505 0.1022 0.0129 0.0012 1.4 0.4481 0.9452 0.0768 0.0077 0.0006 1.45 0.4043 0.9394 0.0564 0.0045 0.0002 1.5 0.3616 0.9332 0.0406 0.0025 0.0001 1.55 0.3206 0.9265 0.0286 0.0013 0.0000 1.6 0.2817 0.9192 0.0197 0.0007 0.0000 1.65 0.2453 0.9115 0.0133 0.0003 0.0000 1.7 0.2115 0.9032 0.0088 0.0002 0.0000 1.75 0.1806 0.8943 0.0056 0.0001 0.0000 1.8 0.1527 0.8849 0.0036 0.0000 0.0000 1.85 0.1278 0.8749 0.0022 0.0000 0.0000 1.9 0.1059 0.8643 0.0013 0.0000 0.0000 1.95 0.0869 0.8531 0.0008 0.0000 0.0000 2 0.0705 0.8413 0.0004 0.0000 0.0000 2.05 0.0566 0.8289 0.0002 0.0000 0.0000 2.1 0.0450 0.8159 0.0001 0.0000 0.0000 2.15 0.0353 0.8023 0.0001 0.0000 0.0000 2.2 0.0275 0.7881 0.0000 0.0000 0.0000 2.25 0.0211 0.7734 0.0000 0.0000 0.0000 2.3 0.0161 0.7580 0.0000 0.0000 0.0000 2.35 0.0121 0.7422 0.0000 0.0000 0.0000 2.4 0.0090 0.7257 0.0000 0.0000 0.0000 2.45 0.0066 0.7088 0.0000 0.0000 0.0000 2.5 0.0048 0.6915 0.0000 0.0000 0.0000 2.55 0.0034 0.6736 0.0000 0.0000 0.0000 2.6 0.0024 0.6554 0.0000 0.0000 0.0000 2.65 0.0017 0.6368 0.0000 0.0000 0.0000 2.7 0.0012 0.6179 0.0000 0.0000 0.0000 2.75 0.0008 0.5987 0.0000 0.0000 0.0000 2.8 0.0006 0.5793 0.0000 0.0000 0.0000 2.85 0.0004 0.5596 0.0000 0.0000 0.0000 2.9 0.0002 0.5398 0.0000 0.0000 0.0000 2.95 0.0002 0.5199 0.0000 0.0000 0.0000 3 0.0001 0.5000 0.0000 0.0000 0.0000 3.05 0.0001 0.4801 0.0000 0.0000 0.0000 3.1 0.0000 0.4602 0.0000 0.0000 0.0000 3.15 0.0000 0.4404 0.0000 0.0000 0.0000 3.2 0.0000 0.4207 0.0000 0.0000 0.0000 3.25 0.0000 0.4013 0.0000 0.0000 0.0000 3.3 0.0000 0.3821 0.0000 0.0000 0.0000 3.35 0.0000 0.3632 0.0000 0.0000 0.0000 3.4 0.0000 0.3446 0.0000 0.0000 0.0000 3.45 0.0000 0.3264 0.0000 0.0000 0.0000 3.5 0.0000 0.3085 0.0000 0.0000 0.0000 3.55 0.0000 0.2912 0.0000 0.0000 0.0000 3.6 0.0000 0.2743 0.0000 0.0000 0.0000 3.65 0.0000 0.2578 0.0000 0.0000 0.0000 3.7 0.0000 0.2420 0.0000 0.0000 0.0000 3.75 0.0000 0.2266 0.0000 0.0000 0.0000 3.8 0.0000 0.2119 0.0000 0.0000 0.0000 3.85 0.0000 0.1977 0.0000 0.0000 0.0000 3.9 0.0000 0.1841 0.0000 0.0000 0.0000 3.95 0.0000 0.1711 0.0000 0.0000 0.0000 4 0.0000 0.1587 0.0000 0.0000 0.0000 4.05 0.0000 0.1469 0.0000 0.0000 0.0000 4.1 0.0000 0.1357 0.0000 0.0000 0.0000 4.15 0.0000 0.1251 0.0000 0.0000 0.0000 4.2 0.0000 0.1151 0.0000 0.0000 0.0000 4.25 0.0000 0.1056 0.0000 0.0000 0.0000 4.3 0.0000 0.0968 0.0000 0.0000 0.0000 4.35 0.0000 0.0885 0.0000 0.0000 0.0000 4.4 0.0000 0.0808 0.0000 0.0000 0.0000 4.45 0.0000 0.0735 0.0000 0.0000 0.0000 4.5 0.0000 0.0668 0.0000 0.0000 0.0000 4.55 0.0000 0.0606 0.0000 0.0000 0.0000 4.6 0.0000 0.0548 0.0000 0.0000 0.0000 4.65 0.0000 0.0495 0.0000 0.0000 0.0000 4.7 0.0000 0.0446 0.0000 0.0000 0.0000 4.75 0.0000 0.0401 0.0000 0.0000 0.0000 4.8 0.0000 0.0359 0.0000 0.0000 0.0000 4.85 0.0000 0.0322 0.0000 0.0000 0.0000 4.9 0.0000 0.0287 0.0000 0.0000 0.0000 4.95 0.0000 0.0256 0.0000 0.0000 0.0000 5 0.0000 0.0228 0.0000 0.0000 0.0000 > # or to identify points on the plot use > ## Not run: oc.curves.xbar(qcc(diameter, type="xbar", nsigmas=3, plot=FALSE), identify=TRUE) > detach(pistonrings) > > data(orangejuice) > attach(orangejuice) > beta <- oc.curves(qcc(D[trial], sizes=size[trial], type="p", plot=FALSE)) Warning in oc.curves.p(object, ...) : Some computed values for the type II error have been rounded due to the discreteness of the binomial distribution. Thus, some ARL values might be meaningless. > print(round(beta, digits=4)) 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.0000 0.0894 0.2642 0.4447 0.5995 0.7206 0.8100 0.8735 0.9173 0.9468 0.9662 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.9788 0.9869 0.9920 0.9951 0.9971 0.9983 0.9990 0.9993 0.9995 0.9995 0.9993 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.9987 0.9978 0.9962 0.9937 0.9900 0.9845 0.9768 0.9662 0.9522 0.9343 0.9118 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.8844 0.8518 0.8139 0.7711 0.7236 0.6722 0.6176 0.5610 0.5035 0.4461 0.3901 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.3365 0.2862 0.2398 0.1980 0.1609 0.1287 0.1013 0.0784 0.0596 0.0446 0.0327 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.0235 0.0166 0.0115 0.0078 0.0052 0.0034 0.0021 0.0013 0.0008 0.0005 0.0003 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.0002 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.99 1 0.0000 0.0000 > # or to identify points on the plot use > ## Not run: oc.curves(qcc(D[trial], sizes=size[trial], type="p", plot=FALSE), identify=TRUE) > detach(orangejuice) > > data(circuit) > attach(circuit) > q <- qcc(x[trial], sizes=size[trial], type="c", plot=FALSE) > beta <- oc.curves(q) Warning in oc.curves.c(object, ...) : Some computed values for the type II error have been rounded due to the discreteness of the Poisson distribution. Thus, some ARL values might be meaningless. > print(round(beta, digits=4)) 0 1 2 3 4 5 6 7 8 9 10 0.0000 0.0006 0.0166 0.0839 0.2149 0.3840 0.5543 0.6993 0.8088 0.8843 0.9329 11 12 13 14 15 16 17 18 19 20 21 0.9625 0.9797 0.9893 0.9945 0.9972 0.9986 0.9991 0.9992 0.9986 0.9972 0.9945 22 23 24 25 26 27 28 29 30 31 32 0.9895 0.9813 0.9686 0.9502 0.9249 0.8918 0.8505 0.8011 0.7444 0.6818 0.6150 33 34 35 36 37 38 39 40 41 42 43 0.5461 0.4772 0.4102 0.3470 0.2888 0.2365 0.1907 0.1514 0.1184 0.0912 0.0693 44 45 46 47 48 49 50 51 52 53 54 0.0519 0.0383 0.0280 0.0201 0.0143 0.0101 0.0070 0.0048 0.0033 0.0022 0.0015 55 56 57 58 59 60 61 62 63 64 65 0.0010 0.0006 0.0004 0.0003 0.0002 0.0001 0.0001 0.0000 0.0000 0.0000 0.0000 > # or to identify points on the plot use > ## Not run: oc.curves(qcc(x[trial], sizes=size[trial], type="c", plot=FALSE), identify=TRUE) > detach(circuit) > > > > cleanEx(); ..nameEx <- "orangejuice" > > ### * orangejuice > > flush(stderr()); flush(stdout()) > > ### Name: orangejuice > ### Title: Orange juice data > ### Aliases: orangejuice > ### Keywords: datasets > > ### ** Examples > > data(orangejuice) > orangejuice$d <- orangejuice$D/orangejuice$size > attach(orangejuice) > summary(orangejuice) sample D size trial d Min. : 1.00 Min. : 2.000 Min. :50 Mode :logical Min. :0.0400 1st Qu.:14.25 1st Qu.: 5.000 1st Qu.:50 FALSE:24 1st Qu.:0.1000 Median :27.50 Median : 7.000 Median :50 TRUE :30 Median :0.1400 Mean :27.50 Mean : 8.889 Mean :50 Mean :0.1778 3rd Qu.:40.75 3rd Qu.:12.000 3rd Qu.:50 3rd Qu.:0.2400 Max. :54.00 Max. :24.000 Max. :50 Max. :0.4800 > boxplot(d ~ trial) > mark <- ifelse(trial, 1, 2) > plot(sample, d, type="b", col=mark, pch=mark) > > > > cleanEx(); ..nameEx <- "orangejuice2" > > ### * orangejuice2 > > flush(stderr()); flush(stdout()) > > ### Name: orangejuice2 > ### Title: Orange juice data - Part 2 > ### Aliases: orangejuice2 > ### Keywords: datasets > > ### ** Examples > > data(orangejuice2) > orangejuice2$d <- orangejuice2$D/orangejuice2$size > attach(orangejuice2) > summary(orangejuice2) sample D size trial d Min. :31.00 Min. : 1.000 Min. :50 Mode :logical Min. :0.0200 1st Qu.:46.75 1st Qu.: 4.000 1st Qu.:50 FALSE:40 1st Qu.:0.0800 Median :62.50 Median : 5.000 Median :50 TRUE :24 Median :0.1000 Mean :62.50 Mean : 5.484 Mean :50 Mean :0.1097 3rd Qu.:78.25 3rd Qu.: 7.000 3rd Qu.:50 3rd Qu.:0.1400 Max. :94.00 Max. :12.000 Max. :50 Max. :0.2400 > boxplot(d ~ trial) > mark <- ifelse(trial, 1, 2) > plot(sample, d, type="b", col=mark, pch=mark) > > > > cleanEx(); ..nameEx <- "pareto.chart" > > ### * pareto.chart > > flush(stderr()); flush(stdout()) > > ### Name: pareto.chart > ### Title: Pareto chart > ### Aliases: pareto.chart > ### Keywords: hplot > > ### ** Examples > > defect <- c(80, 27, 66, 94, 33) > names(defect) <- c("price code", "schedule date", "supplier code", "contact num.", "part num.") > pareto.chart(defect, ylab = "Error frequency") Pareto chart analysis for defect Frequency Cum.Freq. Percentage Cum.Percent. contact num. 94 94 31.33333 31.33333 price code 80 174 26.66667 58.00000 supplier code 66 240 22.00000 80.00000 part num. 33 273 11.00000 91.00000 schedule date 27 300 9.00000 100.00000 > pareto.chart(defect, ylab = "Error frequency", xlab = "Error causes", las=1) Pareto chart analysis for defect Frequency Cum.Freq. Percentage Cum.Percent. contact num. 94 94 31.33333 31.33333 price code 80 174 26.66667 58.00000 supplier code 66 240 22.00000 80.00000 part num. 33 273 11.00000 91.00000 schedule date 27 300 9.00000 100.00000 > pareto.chart(defect, ylab = "Error frequency", col=rainbow(length(defect))) Pareto chart analysis for defect Frequency Cum.Freq. Percentage Cum.Percent. contact num. 94 94 31.33333 31.33333 price code 80 174 26.66667 58.00000 supplier code 66 240 22.00000 80.00000 part num. 33 273 11.00000 91.00000 schedule date 27 300 9.00000 100.00000 > > > > cleanEx(); ..nameEx <- "pcmanufact" > > ### * pcmanufact > > flush(stderr()); flush(stdout()) > > ### Name: pcmanufact > ### Title: Personal computer manufacturer data > ### Aliases: pcmanufact > ### Keywords: datasets > > ### ** Examples > > data(pcmanufact) > attach(pcmanufact) > summary(pcmanufact) x size Min. : 5.00 Min. :5 1st Qu.: 7.00 1st Qu.:5 Median :10.00 Median :5 Mean : 9.65 Mean :5 3rd Qu.:11.25 3rd Qu.:5 Max. :16.00 Max. :5 > plot(x/size, type="b") > detach(pcmanufact) > > > > cleanEx(); ..nameEx <- "pistonrings" > > ### * pistonrings > > flush(stderr()); flush(stdout()) > > ### Name: pistonrings > ### Title: Piston rings data > ### Aliases: pistonrings > ### Keywords: datasets > > ### ** Examples > > data(pistonrings) > attach(pistonrings) > summary(pistonrings) diameter sample trial Min. :73.97 Min. : 1.00 Mode :logical 1st Qu.:74.00 1st Qu.:10.75 FALSE:75 Median :74.00 Median :20.50 TRUE :125 Mean :74.00 Mean :20.50 3rd Qu.:74.01 3rd Qu.:30.25 Max. :74.04 Max. :40.00 > boxplot(diameter ~ sample) > plot(sample, diameter, cex=0.7) > lines(tapply(diameter,sample,mean)) > detach(pistonrings) > > > > cleanEx(); ..nameEx <- "process.capability" > > ### * process.capability > > flush(stderr()); flush(stdout()) > > ### Name: process.capability > ### Title: Process capability analysis > ### Aliases: process.capability > ### Keywords: htest hplot > > ### ** Examples > > data(pistonrings) > attach(pistonrings) > diameter <- qcc.groups(diameter, sample) > q <- qcc(diameter[1:25,], type="xbar", nsigmas=3, plot=FALSE) > process.capability(q, spec.limits=c(73.95,74.05)) Process Capability Analysis Call: process.capability(object = q, spec.limits = c(73.95, 74.05)) Number of obs = 125 Target = 74 Center = 74.00118 LSL = 73.95 StdDev = 0.009887547 USL = 74.05 Capability indices: Value 2.5% 97.5% Cp 1.686 1.476 1.895 Cp_l 1.725 1.539 1.912 Cp_u 1.646 1.467 1.825 Cp_k 1.646 1.433 1.859 Cpm 1.674 1.465 1.882 ExpUSL 0% Obs>USL 0% > process.capability(q, spec.limits=c(73.95,74.05), target=74.02) Process Capability Analysis Call: process.capability(object = q, spec.limits = c(73.95, 74.05), target = 74.02) Number of obs = 125 Target = 74.02 Center = 74.00118 LSL = 73.95 StdDev = 0.009887547 USL = 74.05 Capability indices: Value 2.5% 97.5% Cp 1.6856 1.4759 1.8950 Cp_l 1.7253 1.5385 1.9120 Cp_u 1.6460 1.4672 1.8248 Cp_k 1.6460 1.4330 1.8590 Cpm 0.7838 0.6543 0.9132 ExpUSL 0% Obs>USL 0% > 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.00118 LSL = 73.99 StdDev = 0.009887547 USL = 74.01 Capability indices: Value 2.5% 97.5% Cp 0.3371 0.2952 0.3790 Cp_l 0.3768 0.3139 0.4396 Cp_u 0.2975 0.2394 0.3555 Cp_k 0.2975 0.2283 0.3667 Cpm 0.3348 0.2930 0.3765 ExpUSL 19% 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.045 Center = 74.00118 LSL = 73.99 StdDev = 0.009887547 USL = 74.1 Capability indices: Value 2.5% 97.5% Cp 1.8542 1.6235 2.0845 Cp_l 0.3768 0.3139 0.4396 Cp_u 3.3316 2.9802 3.6830 Cp_k 0.3768 0.3018 0.4517 Cpm 0.4081 0.3375 0.4785 ExpUSL 0% Obs>USL 0% > > > > cleanEx(); ..nameEx <- "process.capability.sixpack" > > ### * process.capability.sixpack > > flush(stderr()); flush(stdout()) > > ### Name: process.capability.sixpack > ### Title: Process capability sixpack plots > ### Aliases: process.capability.sixpack > ### Keywords: htest hplot > > ### ** Examples > > x <- matrix(rnorm(100), ncol=5) > q <- qcc(x, type="xbar", plot=FALSE) > process.capability.sixpack(q, spec.limits = c(-2,2), target=0) > > data(pistonrings) > attach(pistonrings) > diameter <- qcc.groups(diameter, sample) > q <- qcc(diameter[1:25,], type="xbar", nsigmas=3, plot=FALSE) > process.capability.sixpack(q, spec.limits=c(73.95,74.05)) > > > > cleanEx(); ..nameEx <- "qcc" > > ### * qcc > > flush(stderr()); flush(stdout()) > > ### Name: qcc > ### Title: Quality Control Charts > ### Aliases: qcc print.qcc summary.qcc plot.qcc > ### Keywords: htest hplot > > ### ** Examples > > data(pistonrings) > attach(pistonrings) > diameter <- qcc.groups(diameter, sample) > > qcc(diameter[1:25,], type="xbar") Call: qcc(data = diameter[1:25, ], type = "xbar") xbar chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.00 74.00 74.00 74.01 Group sample size: 5 Number of groups: 25 Center of group statistics: 74.00118 Standard deviation: 0.009887547 Control limits: LCL UCL 73.98791 74.01444 > qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,]) Call: qcc(data = diameter[1:25, ], type = "xbar", newdata = diameter[26:40, ]) xbar chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.00 74.00 74.00 74.01 Group sample size: 5 Number of groups: 25 Center of group statistics: 74.00118 Standard deviation: 0.009887547 Summary of group statistics in diameter[26:40, ]: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.01 74.01 74.01 74.02 Group sample size: 5 Number of groups: 15 Control limits: LCL UCL 73.98791 74.01444 > q <- qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], plot=FALSE) > plot(q, chart.all=FALSE) > qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], nsigmas=2) Call: qcc(data = diameter[1:25, ], type = "xbar", newdata = diameter[26:40, ], nsigmas = 2) xbar chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.00 74.00 74.00 74.01 Group sample size: 5 Number of groups: 25 Center of group statistics: 74.00118 Standard deviation: 0.009887547 Summary of group statistics in diameter[26:40, ]: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.01 74.01 74.01 74.02 Group sample size: 5 Number of groups: 15 Control limits: LCL UCL 73.99233 74.01002 > qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], confidence.level=0.99) Call: qcc(data = diameter[1:25, ], type = "xbar", newdata = diameter[26:40, ], confidence.level = 0.99) xbar chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.00 74.00 74.00 74.01 Group sample size: 5 Number of groups: 25 Center of group statistics: 74.00118 Standard deviation: 0.009887547 Summary of group statistics in diameter[26:40, ]: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.01 74.01 74.01 74.02 Group sample size: 5 Number of groups: 15 Control limits: LCL UCL 73.98979 74.01257 > > qcc(diameter[1:25,], type="R") Call: qcc(data = diameter[1:25, ], type = "R") R chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.00800 0.01800 0.02100 0.02276 0.02600 0.03900 Group sample size: 5 Number of groups: 25 Center of group statistics: 0.02276 Standard deviation: 0.009887547 Control limits: LCL UCL 0 0.04839106 > qcc(diameter[1:25,], type="R", newdata=diameter[26:40,]) Call: qcc(data = diameter[1:25, ], type = "R", newdata = diameter[26:40, ]) R chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.00800 0.01800 0.02100 0.02276 0.02600 0.03900 Group sample size: 5 Number of groups: 25 Center of group statistics: 0.02276 Standard deviation: 0.009887547 Summary of group statistics in diameter[26:40, ]: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.01400 0.01900 0.02500 0.02453 0.02750 0.04400 Group sample size: 5 Number of groups: 15 Control limits: LCL UCL 0 0.04839106 > > qcc(diameter[1:25,], type="S") Call: qcc(data = diameter[1:25, ], type = "S") S chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.002864 0.007314 0.008468 0.009240 0.011930 0.016180 Group sample size: 5 Number of groups: 25 Center of group statistics: 0.009240037 Standard deviation: 0.009887547 Control limits: LCL UCL 0 0.01936135 > qcc(diameter[1:25,], type="S", newdata=diameter[26:40,]) Call: qcc(data = diameter[1:25, ], type = "S", newdata = diameter[26:40, ]) S chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.002864 0.007314 0.008468 0.009240 0.011930 0.016180 Group sample size: 5 Number of groups: 25 Center of group statistics: 0.009240037 Standard deviation: 0.009887547 Summary of group statistics in diameter[26:40, ]: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.005310 0.007368 0.010330 0.009762 0.011230 0.016550 Group sample size: 5 Number of groups: 15 Control limits: LCL UCL 0 0.01936135 > > # variable control limits > > out <- c(9, 10, 30, 35, 45, 64, 65, 74, 75, 85, 99, 100) > diameter <- qcc.groups(pistonrings$diameter[-out], sample[-out]) > > qcc(diameter[1:25,], type="xbar") Call: qcc(data = diameter[1:25, ], type = "xbar") xbar chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.00 74.00 74.00 74.01 Summary of group sample sizes: sizes 3 4 5 counts 4 4 17 Number of groups: 25 Center of group statistics: 74.00075 Standard deviation: 0.01013948 Control limits: LCL UCL 73.98715 74.01436 73.98319 74.01831 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98554 74.01596 73.98554 74.01596 73.98715 74.01436 73.98554 74.01596 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98319 74.01831 73.98715 74.01436 73.98319 74.01831 73.98715 74.01436 73.98554 74.01596 73.98715 74.01436 73.98715 74.01436 73.98319 74.01831 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 > qcc(diameter[1:25,], type="R") Call: qcc(data = diameter[1:25, ], type = "R") R chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.00800 0.01600 0.02100 0.02168 0.02600 0.03900 Summary of group sample sizes: sizes 3 4 5 counts 4 4 17 Number of groups: 25 Center of group statistics: 0.02230088 Standard deviation: 0.01013948 Control limits: LCL UCL 0 0.04858501 0 0.04932370 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04906335 0 0.04906335 0 0.04858501 0 0.04906335 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04932370 0 0.04858501 0 0.04932370 0 0.04858501 0 0.04906335 0 0.04858501 0 0.04858501 0 0.04932370 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 > qcc(diameter[1:25,], type="S") Call: qcc(data = diameter[1:25, ], type = "S") S chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.002864 0.006807 0.008701 0.009235 0.011930 0.016180 Summary of group sample sizes: sizes 3 4 5 counts 4 4 17 Number of groups: 25 Center of group statistics: 0.00938731 Standard deviation: 0.01013948 Control limits: LCL UCL 0 0.01976651 0 0.02347869 0 0.01976651 0 0.01976651 0 0.01976651 0 0.02121432 0 0.02121432 0 0.01976651 0 0.02121432 0 0.01976651 0 0.01976651 0 0.01976651 0 0.02347869 0 0.01976651 0 0.02347869 0 0.01976651 0 0.02121432 0 0.01976651 0 0.01976651 0 0.02347869 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 > qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,]) Call: qcc(data = diameter[1:25, ], type = "xbar", newdata = diameter[26:40, ]) xbar chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.00 74.00 74.00 74.01 Summary of group sample sizes: sizes 3 4 5 counts 4 4 17 Number of groups: 25 Center of group statistics: 74.00075 Standard deviation: 0.01013948 Summary of group statistics in diameter[26:40, ]: Min. 1st Qu. Median Mean 3rd Qu. Max. 73.99 74.00 74.01 74.01 74.01 74.02 Group sample size: 5 Number of groups: 15 Control limits: LCL UCL 73.98715 74.01436 73.98319 74.01831 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98554 74.01596 73.98554 74.01596 73.98715 74.01436 73.98554 74.01596 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98319 74.01831 73.98715 74.01436 73.98319 74.01831 73.98715 74.01436 73.98554 74.01596 73.98715 74.01436 73.98715 74.01436 73.98319 74.01831 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 73.98715 74.01436 > qcc(diameter[1:25,], type="R", newdata=diameter[26:40,]) Call: qcc(data = diameter[1:25, ], type = "R", newdata = diameter[26:40, ]) R chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.00800 0.01600 0.02100 0.02168 0.02600 0.03900 Summary of group sample sizes: sizes 3 4 5 counts 4 4 17 Number of groups: 25 Center of group statistics: 0.02230088 Standard deviation: 0.01013948 Summary of group statistics in diameter[26:40, ]: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.01400 0.01900 0.02500 0.02453 0.02750 0.04400 Group sample size: 5 Number of groups: 15 Control limits: LCL UCL 0 0.04858501 0 0.04932370 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04906335 0 0.04906335 0 0.04858501 0 0.04906335 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04932370 0 0.04858501 0 0.04932370 0 0.04858501 0 0.04906335 0 0.04858501 0 0.04858501 0 0.04932370 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 0 0.04858501 > qcc(diameter[1:25,], type="S", newdata=diameter[26:40,]) Call: qcc(data = diameter[1:25, ], type = "S", newdata = diameter[26:40, ]) S chart for diameter[1:25, ] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.002864 0.006807 0.008701 0.009235 0.011930 0.016180 Summary of group sample sizes: sizes 3 4 5 counts 4 4 17 Number of groups: 25 Center of group statistics: 0.00938731 Standard deviation: 0.01013948 Summary of group statistics in diameter[26:40, ]: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.005310 0.007368 0.010330 0.009762 0.011230 0.016550 Group sample size: 5 Number of groups: 15 Control limits: LCL UCL 0 0.01976651 0 0.02347869 0 0.01976651 0 0.01976651 0 0.01976651 0 0.02121432 0 0.02121432 0 0.01976651 0 0.02121432 0 0.01976651 0 0.01976651 0 0.01976651 0 0.02347869 0 0.01976651 0 0.02347869 0 0.01976651 0 0.02121432 0 0.01976651 0 0.01976651 0 0.02347869 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 0 0.01976651 > > detach(pistonrings) > > ## > ## Attribute data > ## > > data(orangejuice) > attach(orangejuice) > qcc(D[trial], sizes=size[trial], type="p") Call: qcc(data = D[trial], type = "p", sizes = size[trial]) p chart for D[trial] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.0800 0.1600 0.2100 0.2313 0.2950 0.4800 Group sample size: 50 Number of groups: 30 Center of group statistics: 0.2313333 Standard deviation: 0.421685 Control limits: LCL UCL 0.05242755 0.4102391 > > # remove out-of-control points (see help(orangejuice) for the reasons) > inc <- setdiff(which(trial), c(15,23)) > q1 <- qcc(D[inc], sizes=size[inc], type="p") > qcc(D[inc], sizes=size[inc], type="p", newdata=D[!trial], newsizes=size[!trial]) Call: qcc(data = D[inc], type = "p", sizes = size[inc], newdata = D[!trial], newsizes = size[!trial]) p chart for D[inc] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.080 0.155 0.200 0.215 0.265 0.400 Group sample size: 50 Number of groups: 28 Center of group statistics: 0.215 Standard deviation: 0.4108223 Summary of group statistics in D[!trial]: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.0400 0.0800 0.1100 0.1108 0.1200 0.2400 Group sample size: 50 Number of groups: 24 Control limits: LCL UCL 0.04070284 0.3892972 > detach(orangejuice) > > data(orangejuice2) > attach(orangejuice2) > names(D) <- sample > qcc(D[trial], sizes=size[trial], type="p") Call: qcc(data = D[trial], type = "p", sizes = size[trial]) p chart for D[trial] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.0400 0.0800 0.1100 0.1108 0.1200 0.2400 Group sample size: 50 Number of groups: 24 Center of group statistics: 0.1108333 Standard deviation: 0.3139256 Control limits: LCL UCL 0 0.2440207 > q2 <- qcc(D[trial], sizes=size[trial], type="p", newdata=D[!trial], newsizes=size[!trial]) > detach(orangejuice2) > > # put on the same graph the two orange juice samples > oldpar <- par(no.readonly = TRUE) > par(mfrow=c(1,2), mar=c(5,5,3,0)) > plot(q1, title="First samples", ylim=c(0,0.5), add.stats=FALSE, restore.par=FALSE) > par("mar"=c(5,0,3,3), yaxt="n") > plot(q2, title="Second sample", add.stats=FALSE, ylim=c(0,0.5)) > par(oldpar) > > data(circuit) > attach(circuit) > qcc(x[trial], sizes=size[trial], type="c") Call: qcc(data = x[trial], type = "c", sizes = size[trial]) c chart for x[trial] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 5.00 16.00 19.00 19.85 24.00 39.00 Group sample size: 100 Number of groups: 26 Center of group statistics: 19.84615 Standard deviation: 4.454902 Control limits: LCL UCL 6.481447 33.21086 > # remove out-of-control points (see help(circuit) for the reasons) > inc <- setdiff(which(trial), c(6,20)) > qcc(x[inc], sizes=size[inc], type="c", labels=inc) Call: qcc(data = x[inc], type = "c", sizes = size[inc], labels = inc) c chart for x[inc] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 10.00 16.00 19.00 19.67 24.00 31.00 Group sample size: 100 Number of groups: 24 Center of group statistics: 19.66667 Standard deviation: 4.434712 Control limits: LCL UCL 6.362532 32.9708 > qcc(x[inc], sizes=size[inc], type="c", labels=inc, + newdata=x[!trial], newsizes=size[!trial], newlabels=which(!trial)) Call: qcc(data = x[inc], type = "c", sizes = size[inc], labels = inc, newdata = x[!trial], newsizes = size[!trial], newlabels = which(!trial)) c chart for x[inc] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 10.00 16.00 19.00 19.67 24.00 31.00 Group sample size: 100 Number of groups: 24 Center of group statistics: 19.66667 Standard deviation: 4.434712 Summary of group statistics in x[!trial]: Min. 1st Qu. Median Mean 3rd Qu. Max. 9.00 15.75 18.50 18.30 21.00 28.00 Group sample size: 100 Number of groups: 20 Control limits: LCL UCL 6.362532 32.9708 > qcc(x[inc], sizes=size[inc], type="u", labels=inc, + newdata=x[!trial], newsizes=size[!trial], newlabels=which(!trial)) Call: qcc(data = x[inc], type = "u", sizes = size[inc], labels = inc, newdata = x[!trial], newsizes = size[!trial], newlabels = which(!trial)) u chart for x[inc] Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.1000 0.1600 0.1900 0.1967 0.2400 0.3100 Group sample size: 100 Number of groups: 24 Center of group statistics: 0.1966667 Standard deviation: 4.434712 Summary of group statistics in x[!trial]: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.0900 0.1575 0.1850 0.1830 0.2100 0.2800 Group sample size: 100 Number of groups: 20 Control limits: LCL UCL 0.06362532 0.329708 > detach(circuit) > > data(pcmanufact) > attach(pcmanufact) > qcc(x, sizes=size, type="u") Call: qcc(data = x, type = "u", sizes = size) u chart for x Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 1.00 1.40 2.00 1.93 2.25 3.20 Group sample size: 5 Number of groups: 20 Center of group statistics: 1.93 Standard deviation: 3.106445 Control limits: LCL UCL 0.06613305 3.793867 > detach(pcmanufact) > > data(dyedcloth) > attach(dyedcloth) > qcc(x, sizes=size, type="u") Call: qcc(data = x, type = "u", sizes = size) u chart for x Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.7368 1.1750 1.5120 1.3970 1.5720 1.8400 Summary of group sample sizes: sizes 8 9.5 10 10.5 12 12.5 13 counts 1 1.0 3 1.0 2 1.0 1 Number of groups: 10 Center of group statistics: 1.423256 Standard deviation: 3.986022 Control limits: LCL UCL 0.2914739 2.555038 0.1578852 2.688626 0.4306174 2.415894 0.2914739 2.555038 0.2620721 2.584440 0.2914739 2.555038 0.3900850 2.456427 0.3187498 2.527762 0.3900850 2.456427 0.4109593 2.435552 > # standardized control chart > q <- qcc(x, sizes=size, type="u", plot=FALSE) > z <- (q$statistics - q$center)/sqrt(q$center/q$size) > plot(z, type="o", ylim=range(z,3,-3), pch=16) > abline(h=0, lty=2) > abline(h=c(-3,3), lty=2) > detach(dyedcloth) > > # viscosity data (Montgomery, pag. 242) > x <- c(33.75, 33.05, 34, 33.81, 33.46, 34.02, 33.68, 33.27, 33.49, 33.20, + 33.62, 33.00, 33.54, 33.12, 33.84) > qcc(x, type="xbar.one") Call: qcc(data = x, type = "xbar.one") xbar.one chart for x Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 33.00 33.24 33.54 33.52 33.78 34.02 Group sample size: 1 Number of groups: 15 Center of group statistics: 33.52333 Standard deviation: 0.4261651 Control limits: LCL UCL 32.24484 34.80183 > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "qcc.groups" > > ### * qcc.groups > > flush(stderr()); flush(stdout()) > > ### Name: qcc.groups > ### Title: Grouping data based on a sample indicator > ### Aliases: qcc.groups > > > ### ** Examples > > data(pistonrings) > attach(pistonrings) > # 40 sample of 5 obs each > qcc.groups(diameter, sample) [,1] [,2] [,3] [,4] [,5] 1 74.030 74.002 74.019 73.992 74.008 2 73.995 73.992 74.001 74.011 74.004 3 73.988 74.024 74.021 74.005 74.002 4 74.002 73.996 73.993 74.015 74.009 5 73.992 74.007 74.015 73.989 74.014 6 74.009 73.994 73.997 73.985 73.993 7 73.995 74.006 73.994 74.000 74.005 8 73.985 74.003 73.993 74.015 73.988 9 74.008 73.995 74.009 74.005 74.004 10 73.998 74.000 73.990 74.007 73.995 11 73.994 73.998 73.994 73.995 73.990 12 74.004 74.000 74.007 74.000 73.996 13 73.983 74.002 73.998 73.997 74.012 14 74.006 73.967 73.994 74.000 73.984 15 74.012 74.014 73.998 73.999 74.007 16 74.000 73.984 74.005 73.998 73.996 17 73.994 74.012 73.986 74.005 74.007 18 74.006 74.010 74.018 74.003 74.000 19 73.984 74.002 74.003 74.005 73.997 20 74.000 74.010 74.013 74.020 74.003 21 73.988 74.001 74.009 74.005 73.996 22 74.004 73.999 73.990 74.006 74.009 23 74.010 73.989 73.990 74.009 74.014 24 74.015 74.008 73.993 74.000 74.010 25 73.982 73.984 73.995 74.017 74.013 26 74.012 74.015 74.030 73.986 74.000 27 73.995 74.010 73.990 74.015 74.001 28 73.987 73.999 73.985 74.000 73.990 29 74.008 74.010 74.003 73.991 74.006 30 74.003 74.000 74.001 73.986 73.997 31 73.994 74.003 74.015 74.020 74.004 32 74.008 74.002 74.018 73.995 74.005 33 74.001 74.004 73.990 73.996 73.998 34 74.015 74.000 74.016 74.025 74.000 35 74.030 74.005 74.000 74.016 74.012 36 74.001 73.990 73.995 74.010 74.024 37 74.015 74.020 74.024 74.005 74.019 38 74.035 74.010 74.012 74.015 74.026 39 74.017 74.013 74.036 74.025 74.026 40 74.010 74.005 74.029 74.000 74.020 > # some obs are removed, the result is still a 40x5 matrix but with NAs added > qcc.groups(diameter[-c(1,2,50,52, 199)], sample[-c(1,2,50,52, 199)]) [,1] [,2] [,3] [,4] [,5] 1 74.019 73.992 74.008 NA NA 2 73.995 73.992 74.001 74.011 74.004 3 73.988 74.024 74.021 74.005 74.002 4 74.002 73.996 73.993 74.015 74.009 5 73.992 74.007 74.015 73.989 74.014 6 74.009 73.994 73.997 73.985 73.993 7 73.995 74.006 73.994 74.000 74.005 8 73.985 74.003 73.993 74.015 73.988 9 74.008 73.995 74.009 74.005 74.004 10 73.998 74.000 73.990 74.007 NA 11 73.994 73.994 73.995 73.990 NA 12 74.004 74.000 74.007 74.000 73.996 13 73.983 74.002 73.998 73.997 74.012 14 74.006 73.967 73.994 74.000 73.984 15 74.012 74.014 73.998 73.999 74.007 16 74.000 73.984 74.005 73.998 73.996 17 73.994 74.012 73.986 74.005 74.007 18 74.006 74.010 74.018 74.003 74.000 19 73.984 74.002 74.003 74.005 73.997 20 74.000 74.010 74.013 74.020 74.003 21 73.988 74.001 74.009 74.005 73.996 22 74.004 73.999 73.990 74.006 74.009 23 74.010 73.989 73.990 74.009 74.014 24 74.015 74.008 73.993 74.000 74.010 25 73.982 73.984 73.995 74.017 74.013 26 74.012 74.015 74.030 73.986 74.000 27 73.995 74.010 73.990 74.015 74.001 28 73.987 73.999 73.985 74.000 73.990 29 74.008 74.010 74.003 73.991 74.006 30 74.003 74.000 74.001 73.986 73.997 31 73.994 74.003 74.015 74.020 74.004 32 74.008 74.002 74.018 73.995 74.005 33 74.001 74.004 73.990 73.996 73.998 34 74.015 74.000 74.016 74.025 74.000 35 74.030 74.005 74.000 74.016 74.012 36 74.001 73.990 73.995 74.010 74.024 37 74.015 74.020 74.024 74.005 74.019 38 74.035 74.010 74.012 74.015 74.026 39 74.017 74.013 74.036 74.025 74.026 40 74.010 74.005 74.029 74.020 NA > > > > cleanEx(); ..nameEx <- "qcc.options" > > ### * qcc.options > > flush(stderr()); flush(stdout()) > > ### Name: qcc.options > ### Title: Set or return options for the `qcc' package. > ### Aliases: qcc.options .qcc.options > ### Keywords: htest hplot > > ### ** Examples > > qcc.options() $exp.R.unscaled [1] NA 1.128 1.693 2.059 2.326 2.534 2.704 2.847 2.970 3.078 3.173 3.258 [13] 3.336 3.407 3.472 3.532 3.588 3.640 3.689 3.735 3.778 3.819 3.858 3.895 [25] 3.931 $se.R.unscaled [1] NA 0.8525033 0.8883697 0.8798108 0.8640855 0.8480442 0.8332108 [8] 0.8198378 0.8078413 0.7970584 0.7873230 0.7784873 0.7704257 0.7630330 [15] 0.7562217 0.7499188 0.7440627 0.7386021 0.7334929 0.7286980 0.7241851 [22] 0.7199267 0.7158987 0.7120802 0.7084528 0.7050004 0.7017086 0.6985648 [29] 0.6955576 0.6926770 0.6899137 0.6872596 0.6847074 0.6822502 0.6798821 [36] 0.6775973 0.6753910 0.6732584 0.6711952 0.6691976 0.6672619 0.6653848 [43] 0.6635632 0.6617943 0.6600754 0.6584041 0.6567780 0.6551950 0.6536532 [50] 0.6521506 $beyond.limits $beyond.limits$pch [1] 19 $beyond.limits$col [1] "red" $violating.runs $violating.runs$pch [1] 19 $violating.runs$col [1] "orange" $run.length [1] 5 $bg.margin [1] "lightgrey" $bg.figure [1] "white" $cex [1] 0.8 > qcc.options("cex") [1] 0.8 > qcc.options("cex"=2) > qcc.options(bg.margin="yellow") > > > > cleanEx(); ..nameEx <- "qcc.overdispersion.test" > > ### * qcc.overdispersion.test > > flush(stderr()); flush(stdout()) > > ### Name: qcc.overdispersion.test > ### Title: Overdispersion test for binomial and poisson data > ### Aliases: qcc.overdispersion.test > > > ### ** Examples > > # data from Wetherill and Brown (1991) pp. 212--213, 216--218: > x <- c(12,11,18,11,10,16,9,11,14,15,11,9,10,13,12, + 8,12,13,10,12,13,16,12,18,16,10,16,10,12,14) > size <- rep(50, length(x)) > qcc.overdispersion.test(x,size) Overdispersion test Obs.Var/Theor.Var Statistic p-value binomial data 0.7644566 22.16924 0.81311 > > x <- c(11,8,13,11,13,17,25,23,11,16,9,15,10,16,12, + 8,9,15,4,12,12,12,15,17,14,17,12,12,7,16) > qcc.overdispersion.test(x) Overdispersion test Obs.Var/Theor.Var Statistic p-value poisson data 1.472203 42.69388 0.048579 > > > > cleanEx(); ..nameEx <- "stats.xbar.one" > > ### * stats.xbar.one > > flush(stderr()); flush(stdout()) > > ### Name: stats.xbar.one > ### Title: Functions to plot Shewhart xbar chart for one-at-time data > ### Aliases: stats.xbar.one sd.xbar.one limits.xbar.one > ### Keywords: htest hplot > > ### ** Examples > > # Water content of antifreeze data (Wetherill and Brown, 1991, p. 120) > x <- c(2.23, 2.53, 2.62, 2.63, 2.58, 2.44, 2.49, 2.34, 2.95, 2.54, 2.60, 2.45, + 2.17, 2.58, 2.57, 2.44, 2.38, 2.23, 2.23, 2.54, 2.66, 2.84, 2.81, 2.39, + 2.56, 2.70, 3.00, 2.81, 2.77, 2.89, 2.54, 2.98, 2.35, 2.53) > sigma <- NA > k <- 2:24 > for (j in k) + sigma[j] <- sd.xbar.one(x, k=j) > # plot estimates of sigma for different values of k > plot(k, sigma[k], type="b") > # "as the size inceases further, we would expect sigma-hat to settle down > # at a value close to the overall sigma-hat" (p. 121) > abline(h=sd(x), col=2, lty=2) > > # the Shewhart control chart for one-at-time data > qcc(x, type="xbar.one", data.name="Water content (in ppm) of batches of antifreeze") Call: qcc(data = x, type = "xbar.one", data.name = "Water content (in ppm) of batches of antifreeze") xbar.one chart for Water content (in ppm) of batches of antifreeze Summary of group statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 2.17 2.44 2.55 2.57 2.69 3.00 Group sample size: 1 Number of groups: 34 Center of group statistics: 2.569706 Standard deviation: 0.1794541 Control limits: LCL UCL 2.031344 3.108068 > > > > ### *