From fb7e694abad6f41b462ab73f4612f9ca3c2f6bc8 Mon Sep 17 00:00:00 2001 From: Kucharssim Date: Thu, 12 Mar 2026 17:30:21 +0100 Subject: [PATCH 1/6] Z bench -> Z (ST)/Z (LT) --- DESCRIPTION | 2 +- R/processCapabilityStudies.R | 20 +++++++++---------- inst/Upgrades.qml | 10 ++++++++++ inst/help/processCapabilityStudies.md | 4 ++-- inst/qml/processCapabilityStudies.qml | 4 ++-- .../testthat/test-processCapabilityStudies.R | 2 +- 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 131c72bc..d37c8480 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: jaspQualityControl Type: Package Title: Quality Control Module for JASP -Version: 0.96.0 +Version: 0.96.1 Date: 2022-10-25 Author: JASP Team Website: https://github.com/jasp-stats/jaspQualityControl diff --git a/R/processCapabilityStudies.R b/R/processCapabilityStudies.R index d667be92..2ae54f3f 100644 --- a/R/processCapabilityStudies.R +++ b/R/processCapabilityStudies.R @@ -1115,8 +1115,8 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { sourceVector <- c(sourceVector, paste0(ciLevelPercent, "% CI Cpk")) } - if (options[["processCapabilityTableZbench"]]) { - table$addColumnInfo(name="zbench", title=gettext("Z bench (ST)"), type="number") + if (options[["processCapabilityTableZ"]]) { + table$addColumnInfo(name="zSt", title=gettext("Z (ST)"), type="number") } table$showSpecifiedColumnsOnly <- TRUE @@ -1158,7 +1158,7 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { } else { cpk <- cpu } - zbench <- 3*cpk + zSt <- 3*cpk if (options[["processCapabilityTableCi"]]) { @@ -1178,11 +1178,11 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { ciUbCpk <- cpk + (normCIrange * intervalCpk) } } - tableDfCurrentStage <- data.frame(cp = round(cp, .numDecimals), + tableDfCurrentStage <- data.frame(cp = round(cp, .numDecimals), cpl = round(cpl, .numDecimals), cpu = round(cpu, .numDecimals), cpk = round(cpk, .numDecimals), - zbench = round(zbench, .numDecimals)) + zSt = round(zSt, .numDecimals)) if (options[["processCapabilityTableCi"]]) { if (!(options[["lowerSpecificationLimitBoundary"]] || options[["upperSpecificationLimitBoundary"]])) { tableDfCurrentStage[["cplci"]] <- round(ciLbCp, .numDecimals) @@ -1311,8 +1311,8 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { tableColNames <- c(tableColNames, "ppklci", "ppkuci") sourceVector1 <- c(sourceVector1, paste0(ciLevelPercent, "% CI Ppk")) } - if (options[["processCapabilityTableZbench"]]) { - table$addColumnInfo(name="zbench", title=gettext("Z bench (LT)"), type="number") + if (options[["processCapabilityTableZ"]]) { + table$addColumnInfo(name="zLt", title=gettext("Z (LT)"), type="number") } if (options[["target"]]) { table$addColumnInfo(name = "cpm", type = "integer", title = gettext("Cpm")) @@ -1366,7 +1366,7 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { } else { ppk <- ppu } - zbench <- 3*ppk + zLt <- 3*ppk cp <- (usl - lsl) / (tolMultiplier * sdw) if (options[["lowerSpecificationLimit"]] && options[["upperSpecificationLimit"]] && options[["target"]]) { @@ -1408,11 +1408,11 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { } } - tableDfCurrentStage <- data.frame(pp = round(pp, .numDecimals), + tableDfCurrentStage <- data.frame(pp = round(pp, .numDecimals), ppl = round(ppl, .numDecimals), ppu = round(ppu, .numDecimals), ppk = round(ppk, .numDecimals), - zbench = round(zbench, .numDecimals)) + zLt = round(zLt, .numDecimals)) if (options[["target"]]) tableDfCurrentStage[["cpm"]] <- round(cpm, .numDecimals) if (options[["processCapabilityTableCi"]]) { diff --git a/inst/Upgrades.qml b/inst/Upgrades.qml index bdb26dcf..37d94601 100644 --- a/inst/Upgrades.qml +++ b/inst/Upgrades.qml @@ -1422,4 +1422,14 @@ Upgrades ChangeRename {from: "reportTime"; to: "reportTimeText"} ChangeRename {from: "reportFrequency"; to: "reportFrequencyText"} } + + // Z.bench to Z + Upgrade + { + functionName: "processCapabilityStudies" + fromVersion: "0.96.0" + toVersion: "0.96.1" + + ChangeRename {from: "processCapabilityTableZbench"; to: "processCapabilityTableZ"} + } } diff --git a/inst/help/processCapabilityStudies.md b/inst/help/processCapabilityStudies.md index 08bf87c8..c03b835a 100644 --- a/inst/help/processCapabilityStudies.md +++ b/inst/help/processCapabilityStudies.md @@ -97,7 +97,7 @@ The size of the subgroups is relevant for the calculation of the process varianc Process capability is determined by the variation that comes from common causes. It generally represents the best (potential) performance of the process. This is demonstrated when the process is being operated in a state of statistical control regardless the specifications [1]. Capability index Cp compares the process capability to the maximum allowable variation as indicated by the tolerance. Cp is not impacted by the process location. This index can be calculated only for bilateral (two-sided) tolerances, it has no meaning for the one-sided situation (unilateral tolerance, with only one specification limit). - Capability index Cpk takes the process location as well as the capability into account. Cpk will always be less than or equal to Cp. + Capability index Cpk takes the process location as well as the capability into account. Cpk will always be less than or equal to Cp. Z (ST) is equal to 3 * Cpk and corresponds to the distance of the process mean to the nearest bound in standard deviation units. *Note*: Capability study reports contain meaningless numbers if processes are not in a state of statistical control. - Process performance (total): the Pp and its confidence interval's values, PpL, PpU, PpK and its confidence interval's values, Cpm and its confidence interval's values. @@ -106,7 +106,7 @@ The size of the subgroups is relevant for the calculation of the process varianc Performance index Pp compares the process performance to the maximum allowable variation as indicated by the tolerance [1]. Pp is not impacted by the process location. This index can be calculated only for bilateral (two-sided) tolerances, it has no meaning for the one-sided situation (unilateral tolerance, with only one specification limit). Performance index Ppk takes the process location as well as the performance into account. - Ppk will always be less than or equal to Pp. + Ppk will always be less than or equal to Pp. Z (LT) is equal to 3 * Ppk and corresponds to the distance of the process mean to the nearest bound in standard deviation units. The Cpm index indicates how well the process can produce within specifications. Its calculation is similar to Cp, except that the standard deviation is calculated using the target value instead of the mean. The larger the Cpm, the more likely the process will produce output that meets specifications and is close to the target value. - Non-conformance statistics: the observed of ppm outside the specification limits, the expected ppm outside the specifications limits based on the overall standard deviation and the within standard deviation. diff --git a/inst/qml/processCapabilityStudies.qml b/inst/qml/processCapabilityStudies.qml index ec295c34..b0aaa662 100644 --- a/inst/qml/processCapabilityStudies.qml +++ b/inst/qml/processCapabilityStudies.qml @@ -582,8 +582,8 @@ Form CheckBox { - name: "processCapabilityTableZbench" - label: qsTr("Z bench") + name: "processCapabilityTableZ" + label: qsTr("Z") } } diff --git a/tests/testthat/test-processCapabilityStudies.R b/tests/testthat/test-processCapabilityStudies.R index ad3abd3d..b307871f 100644 --- a/tests/testthat/test-processCapabilityStudies.R +++ b/tests/testthat/test-processCapabilityStudies.R @@ -24,7 +24,7 @@ options$upperSpecificationLimit <- TRUE options$lowerSpecificationLimitValue <- 0 options$targetValue <- 6 options$upperSpecificationLimitValue <- 12 -options$processCapabilityTableZbench <- TRUE # not tested against Minitab +options$processCapabilityTableZ <- TRUE # not tested against Minitab set.seed(1) results <- runAnalysis("processCapabilityStudies", "datasets/processCapabilityStudy/processCapabilityAnalysisLongFormatDebug.csv", options) From ace8886cd407d514243790d95a0298d84f17bf0d Mon Sep 17 00:00:00 2001 From: Kucharssim Date: Thu, 12 Mar 2026 17:34:39 +0100 Subject: [PATCH 2/6] make the label more informative --- inst/qml/processCapabilityStudies.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/qml/processCapabilityStudies.qml b/inst/qml/processCapabilityStudies.qml index b0aaa662..b4d529d7 100644 --- a/inst/qml/processCapabilityStudies.qml +++ b/inst/qml/processCapabilityStudies.qml @@ -583,7 +583,7 @@ Form CheckBox { name: "processCapabilityTableZ" - label: qsTr("Z") + label: qsTr("Z (ST) / Z (LT)") } } From ba64f94e1757b0f4b1f11f847cf4300f25429767 Mon Sep 17 00:00:00 2001 From: JTPetter <61797391+JTPetter@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:30:23 +0100 Subject: [PATCH 3/6] Update comment for processCapabilityTableZ option --- tests/testthat/test-processCapabilityStudies.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-processCapabilityStudies.R b/tests/testthat/test-processCapabilityStudies.R index b307871f..7cb483a8 100644 --- a/tests/testthat/test-processCapabilityStudies.R +++ b/tests/testthat/test-processCapabilityStudies.R @@ -24,7 +24,7 @@ options$upperSpecificationLimit <- TRUE options$lowerSpecificationLimitValue <- 0 options$targetValue <- 6 options$upperSpecificationLimitValue <- 12 -options$processCapabilityTableZ <- TRUE # not tested against Minitab +options$processCapabilityTableZ <- TRUE # not tested against other Software set.seed(1) results <- runAnalysis("processCapabilityStudies", "datasets/processCapabilityStudy/processCapabilityAnalysisLongFormatDebug.csv", options) From 657f2f6311f4786ad2a67d55d8ce0daf0bfbac49 Mon Sep 17 00:00:00 2001 From: Kucharssim Date: Tue, 17 Mar 2026 18:02:20 +0100 Subject: [PATCH 4/6] add Z (ST) / Z (LT) to report, unify calculation logic with the rest of the analysis --- R/processCapabilityStudies.R | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/R/processCapabilityStudies.R b/R/processCapabilityStudies.R index 2ae54f3f..32e6514f 100644 --- a/R/processCapabilityStudies.R +++ b/R/processCapabilityStudies.R @@ -1117,6 +1117,8 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { if (options[["processCapabilityTableZ"]]) { table$addColumnInfo(name="zSt", title=gettext("Z (ST)"), type="number") + tableColNames <- c(tableColNames, "zSt") + sourceVector <- c(sourceVector, "Z (ST)") } table$showSpecifiedColumnsOnly <- TRUE @@ -1158,8 +1160,6 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { } else { cpk <- cpu } - zSt <- 3*cpk - if (options[["processCapabilityTableCi"]]) { ciAlpha <- 1 - ciLevel @@ -1181,8 +1181,11 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { tableDfCurrentStage <- data.frame(cp = round(cp, .numDecimals), cpl = round(cpl, .numDecimals), cpu = round(cpu, .numDecimals), - cpk = round(cpk, .numDecimals), - zSt = round(zSt, .numDecimals)) + cpk = round(cpk, .numDecimals)) + + if (options[["processCapabilityTableZ"]]) + tableDfCurrentStage[["zSt"]] <- round(3*cpk, .numDecimals) + if (options[["processCapabilityTableCi"]]) { if (!(options[["lowerSpecificationLimitBoundary"]] || options[["upperSpecificationLimitBoundary"]])) { tableDfCurrentStage[["cplci"]] <- round(ciLbCp, .numDecimals) @@ -1248,6 +1251,8 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { if (options[["processCapabilityTableCi"]] && !(options[["upperSpecificationLimitBoundary"]] && options[["lowerSpecificationLimitBoundary"]])) formattedTableDf[["cpkci"]] <- paste0("[", tableList[["cpklci"]], ", ", tableList[["cpkuci"]], "]") + if (options[["processCapabilityTableZ"]]) + formattedTableDf[["zSt"]] <- tableList[["zSt"]] colnames(formattedTableDf) <- sourceVector return(formattedTableDf) } @@ -1313,6 +1318,8 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { } if (options[["processCapabilityTableZ"]]) { table$addColumnInfo(name="zLt", title=gettext("Z (LT)"), type="number") + tableColNames <- c(tableColNames, "zLt") + sourceVector1 <- c(sourceVector1, "Z (LT)") } if (options[["target"]]) { table$addColumnInfo(name = "cpm", type = "integer", title = gettext("Cpm")) @@ -1366,7 +1373,6 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { } else { ppk <- ppu } - zLt <- 3*ppk cp <- (usl - lsl) / (tolMultiplier * sdw) if (options[["lowerSpecificationLimit"]] && options[["upperSpecificationLimit"]] && options[["target"]]) { @@ -1411,8 +1417,9 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { tableDfCurrentStage <- data.frame(pp = round(pp, .numDecimals), ppl = round(ppl, .numDecimals), ppu = round(ppu, .numDecimals), - ppk = round(ppk, .numDecimals), - zLt = round(zLt, .numDecimals)) + ppk = round(ppk, .numDecimals)) + if (options[["processCapabilityTableZ"]]) + tableDfCurrentStage[["zLt"]] <- round(3*ppk, .numDecimals) if (options[["target"]]) tableDfCurrentStage[["cpm"]] <- round(cpm, .numDecimals) if (options[["processCapabilityTableCi"]]) { @@ -1489,6 +1496,8 @@ processCapabilityStudies <- function(jaspResults, dataset, options) { if (options[["processCapabilityTableCi"]] && !(options[["lowerSpecificationLimitBoundary"]] && options[["upperSpecificationLimitBoundary"]])) formattedTableDf[["ppkci"]] <- paste0("[", tableList[["ppklci"]], ", ",tableList[["ppkuci"]], "]") + if (options[["processCapabilityTableZ"]]) + formattedTableDf[["zLt"]] <- tableList[["zLt"]] if (options[["target"]]) { formattedTableDf[["cpm"]] <- tableList[["cpm"]] if (options[["processCapabilityTableCi"]] && From 35a1ef164729dc4cdc01b914da60aa73d0b6623f Mon Sep 17 00:00:00 2001 From: Kucharssim Date: Tue, 17 Mar 2026 18:17:45 +0100 Subject: [PATCH 5/6] test Z (ST) / Z (LT) with stages --- tests/testthat/test-processCapabilityStudies.R | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-processCapabilityStudies.R b/tests/testthat/test-processCapabilityStudies.R index 7cb483a8..dcf2bd1d 100644 --- a/tests/testthat/test-processCapabilityStudies.R +++ b/tests/testthat/test-processCapabilityStudies.R @@ -100,6 +100,7 @@ options$upperSpecificationLimit <- TRUE options$lowerSpecificationLimitValue <- 0 options$targetValue <- 6 options$upperSpecificationLimitValue <- 12 +options$processCapabilityTableZ <- TRUE # Not tested against other software set.seed(1) results <- runAnalysis("processCapabilityStudies", "datasets/processCapabilityStudy/processCapabilityAnalysisLongFormatDebug.csv", options) @@ -114,9 +115,9 @@ test_that("LF2.2 (Normal) Basic tests of Process performance (total) table with table <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_normalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_normalCapabilityAnalysis_capabilityTableOverall"]][["data"]] jaspTools::expect_equal_tables(table, list(0.89, 0.73, 1.05, 1, 0.82, 0.65, 1, 1.18, 0.81, 0.82, 1.19, "1 (BL)", - 0.97, "-", "-", 1.13, 0.92, 0.77, 1.08, 1.33, 0.95, 0.92, 1.29, - 2, 0.08, 0.1, 0.06, 0.13, 0.1, "-", "-", 0.15, "-", 0.1, "-", - "Change (2 vs. BL)")) + 2.46, 0.97, "-", "-", 1.13, 0.92, 0.77, 1.08, 1.33, 0.95, 0.92, + 1.29, 2, 2.77, 0.08, 0.1, 0.06, 0.13, 0.1, "-", "-", 0.15, "-", + 0.1, "-", "Change (2 vs. BL)", 0.31)) }) test_that("LF2.3 (Normal) Basic tests of Non-conformance statistics table with subgroup variable and stages", { @@ -131,9 +132,10 @@ test_that("LF2.3 (Normal) Basic tests of Non-conformance statistics table with s test_that("LF2.4 (Normal) Basic tests of Process capability (within) table with subgroup variable and stages", { table <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_normalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_normalCapabilityAnalysis_capabilityTableWithin"]][["data"]] jaspTools::expect_equal_tables(table, - list(1.07, 0.88, 0.68, 1.08, 1.26, 0.85, 0.88, 1.29, "1 (BL)", 1.18, - 0.97, 0.79, 1.15, 1.4, 0.99, 0.97, 1.38, 2, 0.11, 0.09, "-", - "-", 0.14, "-", 0.09, "-", "Change (2 vs. BL)")) + list(1.07, 0.88, 0.68, 1.08, 1.26, 0.85, 0.88, 1.29, "1 (BL)", 2.63, + 1.18, 0.97, 0.79, 1.15, 1.4, 0.99, 0.97, 1.38, 2, 2.91, 0.11, + 0.09, "-", "-", 0.14, "-", 0.09, "-", "Change (2 vs. BL)", 0.28 + )) }) test_that("LF2.5 (Normal) Basic tests of Process summary table with subgroup variable and stages", { From 52ccb89674abd10569c99789d08e2638fb44183a Mon Sep 17 00:00:00 2001 From: Kucharssim Date: Tue, 17 Mar 2026 18:26:24 +0100 Subject: [PATCH 6/6] add Z (ST) / Z (LT) report tests --- .../process-capability-report21-subplot-8.svg | 108 +++++++-- ...process-capability-report22-subplot-11.svg | 216 ++++++++++++++---- .../testthat/test-processCapabilityStudies.R | 4 + 3 files changed, 256 insertions(+), 72 deletions(-) diff --git a/tests/testthat/_snaps/processCapabilityStudies/process-capability-report21-subplot-8.svg b/tests/testthat/_snaps/processCapabilityStudies/process-capability-report21-subplot-8.svg index 917e6e8f..c4ba392a 100644 --- a/tests/testthat/_snaps/processCapabilityStudies/process-capability-report21-subplot-8.svg +++ b/tests/testthat/_snaps/processCapabilityStudies/process-capability-report21-subplot-8.svg @@ -87,6 +87,16 @@ + + + + + + + + + + @@ -147,6 +157,16 @@ + + + + + + + + + + Cp @@ -207,6 +227,16 @@ + +Z (ST) + + + + +2.79 + + + @@ -268,22 +298,32 @@ - - + + - - + + - - + + - - + + + + + + + + + + + + @@ -348,22 +388,32 @@ - - + + + + + + + + + + + + - - + + - - + + - - + + @@ -427,23 +477,33 @@ - -Cpm + +Z (LT) + + + + +2.65 + + + + +Cpm - -0.93 + +0.93 - -90% CI Cpm + +90% CI Cpm - -[0.83, 1.04] + +[0.83, 1.04] diff --git a/tests/testthat/_snaps/processCapabilityStudies/process-capability-report22-subplot-11.svg b/tests/testthat/_snaps/processCapabilityStudies/process-capability-report22-subplot-11.svg index abac3be8..f6e993c6 100644 --- a/tests/testthat/_snaps/processCapabilityStudies/process-capability-report22-subplot-11.svg +++ b/tests/testthat/_snaps/processCapabilityStudies/process-capability-report22-subplot-11.svg @@ -97,6 +97,16 @@ + + + + + + + + + + @@ -307,6 +317,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Stage @@ -377,6 +417,11 @@ + +Z (ST) + + + [0.99, 1.38] @@ -447,6 +492,21 @@ + +2.63 + + + + +2.91 + + + + +0.28 + + + @@ -518,22 +578,32 @@ - - + + - - + + - - + + - - + + + + + + + + + + + + @@ -748,62 +818,92 @@ - - + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + @@ -877,8 +977,8 @@ - -Cpm + +Z (LT) @@ -887,8 +987,8 @@ - -90% CI Cpm + +Cpm @@ -897,6 +997,11 @@ + +90% CI Cpm + + + 1.18 @@ -957,33 +1062,48 @@ - -0.89 + +2.46 + + + + +2.77 + + + + +0.31 + + + + +0.89 - -0.97 + +0.97 - -0.08 + +0.08 - -[0.73, 1.05] + +[0.73, 1.05] - -[-, -] + +[-, -] - -[0.1, 0.06] + +[0.1, 0.06] Process capability (within) diff --git a/tests/testthat/test-processCapabilityStudies.R b/tests/testthat/test-processCapabilityStudies.R index dcf2bd1d..03c55261 100644 --- a/tests/testthat/test-processCapabilityStudies.R +++ b/tests/testthat/test-processCapabilityStudies.R @@ -1596,6 +1596,8 @@ options$reportProcessText <- "process name test" options$reportDateText <- "today" options$reportReportedByText <- "Name test" options$reportConclusionText <- "comments test" +options$processCapabilityTableZ <- TRUE + set.seed(1) results <- runAnalysis("processCapabilityStudies", "datasets/processCapabilityStudy/processCapabilityAnalysisLongFormatDebug.csv", options) @@ -1633,6 +1635,8 @@ options$reportProcessText <- "process name test" options$reportDateText <- "today" options$reportReportedByText <- "Name test" options$reportConclusionText <- "comments test" +options$processCapabilityTableZ <- TRUE + set.seed(1) results <- runAnalysis("processCapabilityStudies", "datasets/processCapabilityStudy/processCapabilityAnalysisLongFormatDebug.csv", options)