This is my first report in learning how to construct Xbar and R charts using variable subgroup data with RStudio application.
In this report, I will make XBar and R Control Chart. Import the data using the code below. I got this data from Montgomery, D.C., (2009) “Introduction to statistical quality control” Table 6E13 Layer Thickness Data for Exercise 6.26, Page 278.
library(readxl)
## Warning: package 'readxl' was built under R version 4.0.5
Thickness <- read_excel('Layer_Thickness Data.xlsx')
Thickness
## # A tibble: 120 x 2
## Subgroup Thickness
## <dbl> <dbl>
## 1 1 459
## 2 1 449
## 3 1 435
## 4 1 450
## 5 2 443
## 6 2 440
## 7 2 442
## 8 2 442
## 9 3 457
## 10 3 444
## # ... with 110 more rows
aggregate(Thickness~Subgroup, data = Thickness, mean)
## Subgroup Thickness
## 1 1 448.25
## 2 2 441.75
## 3 3 448.50
## 4 4 455.75
## 5 5 449.75
## 6 6 453.25
## 7 7 447.25
## 8 8 450.50
## 9 9 448.25
## 10 10 450.25
## 11 11 447.00
## 12 12 451.50
## 13 13 448.00
## 14 14 448.50
## 15 15 452.00
## 16 16 445.75
## 17 17 454.50
## 18 18 429.75
## 19 19 451.25
## 20 20 452.00
## 21 21 451.75
## 22 22 447.25
## 23 23 444.00
## 24 24 440.75
## 25 25 454.75
## 26 26 452.25
## 27 27 449.50
## 28 28 448.75
## 29 29 444.25
## 30 30 449.00
library(qcc)
## Package 'qcc' version 2.7
## Type 'citation("qcc")' for citing this R package in publications.
samples.thickness <- qcc.groups(data = Thickness$Thickness, sample = Thickness$Subgroup)
samples.thickness
## [,1] [,2] [,3] [,4]
## 1 459 449 435 450
## 2 443 440 442 442
## 3 457 444 449 444
## 4 469 463 453 438
## 5 443 457 445 454
## 6 444 456 456 457
## 7 445 449 450 445
## 8 446 455 449 452
## 9 444 452 457 440
## 10 432 463 463 443
## 11 445 452 453 438
## 12 456 457 436 457
## 13 459 445 441 447
## 14 441 465 438 450
## 15 460 453 457 438
## 16 453 444 451 435
## 17 451 460 450 457
## 18 422 431 437 429
## 19 444 446 448 467
## 20 450 450 454 454
## 21 454 449 443 461
## 22 449 441 444 455
## 23 442 442 442 450
## 24 443 452 438 430
## 25 446 459 457 457
## 26 454 448 445 462
## 27 458 449 453 438
## 28 450 449 445 451
## 29 443 440 443 451
## 30 457 450 452 437
xbar.thickness <- qcc(data = samples.thickness[1:20,1:4], type = "xbar")
3. After that, Pay attention to the output of the resulting chart. we can use summary mode and other modes to observe data that is out of control.
summary(xbar.thickness)
##
## Call:
## qcc(data = samples.thickness[1:20, 1:4], type = "xbar")
##
## xbar chart for samples.thickness[1:20, 1:4]
##
## Summary of group statistics:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 429.7500 447.8125 449.1250 448.6875 451.6250 455.7500
##
## Group sample size: 4
## Number of groups: 20
## Center of group statistics: 448.6875
## Standard deviation: 8.08645
##
## Control limits:
## LCL UCL
## 436.5578 460.8172
xbar.thickness$nsigmas
## [1] 3
xbar.thickness$violations
## $beyond.limits
## [1] 18
##
## $violating.runs
## numeric(0)
samples.thickness[1:20,1:4][-18,1:4]
## [,1] [,2] [,3] [,4]
## 1 459 449 435 450
## 2 443 440 442 442
## 3 457 444 449 444
## 4 469 463 453 438
## 5 443 457 445 454
## 6 444 456 456 457
## 7 445 449 450 445
## 8 446 455 449 452
## 9 444 452 457 440
## 10 432 463 463 443
## 11 445 452 453 438
## 12 456 457 436 457
## 13 459 445 441 447
## 14 441 465 438 450
## 15 460 453 457 438
## 16 453 444 451 435
## 17 451 460 450 457
## 19 444 446 448 467
## 20 450 450 454 454
xbar.thickness <- qcc(data = samples.thickness[1:20,1:4][-18,1:4], type = "xbar")
5. After We remove the outlier, we can make control chart using the new data. once we are sure that there is no return of out of control data, then we will proceed to phase 2 using the 21st data until the last data.
xbar.thickness <- qcc(data = samples.thickness[1:20,1:4][-18,1:4], type = "xbar", newdata = samples.thickness[21:30,1:4])
summary(xbar.thickness)
##
## Call:
## qcc(data = samples.thickness[1:20, 1:4][-18, 1:4], type = "xbar", newdata = samples.thickness[21:30, 1:4])
##
## xbar chart for samples.thickness[1:20, 1:4][-18, 1:4]
##
## Summary of group statistics:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 441.7500 448.1250 449.7500 449.6842 451.7500 455.7500
##
## Group sample size: 4
## Number of groups: 19
## Center of group statistics: 449.6842
## Standard deviation: 8.128627
##
## Summary of group statistics in samples.thickness[21:30, 1:4]:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 440.7500 445.0000 448.8750 448.2250 451.1875 454.7500
##
## Group sample size: 4
## Number of groups: 10
##
## Control limits:
## LCL UCL
## 437.4913 461.8772
xbar.thickness$nsigmas
## [1] 3
xbar.thickness$violations
## $beyond.limits
## integer(0)
##
## $violating.runs
## numeric(0)
r.thickness <- qcc(data = samples.thickness [1:20,1:4], type = "R")
summary(r.thickness)
##
## Call:
## qcc(data = samples.thickness[1:20, 1:4], type = "R")
##
## R chart for samples.thickness[1:20, 1:4]
##
## Summary of group statistics:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.00 12.25 16.00 16.65 22.25 31.00
##
## Group sample size: 4
## Number of groups: 20
## Center of group statistics: 16.65
## Standard deviation: 8.08645
##
## Control limits:
## LCL UCL
## 0 37.99364
r.thickness <- qcc(data = samples.thickness [1:20,1:4], type = "R",newdata = samples.thickness[21:30,1:4])
summary(r.thickness)
##
## Call:
## qcc(data = samples.thickness[1:20, 1:4], type = "R", newdata = samples.thickness[21:30, 1:4])
##
## R chart for samples.thickness[1:20, 1:4]
##
## Summary of group statistics:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.00 12.25 16.00 16.65 22.25 31.00
##
## Group sample size: 4
## Number of groups: 20
## Center of group statistics: 16.65
## Standard deviation: 8.08645
##
## Summary of group statistics in samples.thickness[21:30, 1:4]:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 6.0 11.5 15.5 14.9 19.5 22.0
##
## Group sample size: 4
## Number of groups: 10
##
## Control limits:
## LCL UCL
## 0 37.99364
That’ all. because in this world nothing is perfect, if there is an error in this report, I apologize and please let me know by email.
Thank You