Skip to content

fix4163#455

Merged
JTPetter merged 1 commit intojasp-stats:masterfrom
JTPetter:fix4163
Apr 8, 2026
Merged

fix4163#455
JTPetter merged 1 commit intojasp-stats:masterfrom
JTPetter:fix4163

Conversation

@JTPetter
Copy link
Copy Markdown
Contributor

@JTPetter JTPetter commented Mar 27, 2026

  • fixes [Bug]: Process Capability won't generate on 3-parameter Weibull data jasp-issues#4163
  • Made 3 parameter weibull fitting more robust. If the estimation of the starting values (which provides results that more closely match other software, but is somewhat fragile) fails, the main estimation function is still run with some default starting values.
  • The p-value of the AD test was not formatted as p-value, but as integer, leading it to display 0 often.
  • Verified results with other software and created unit test.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves robustness and output correctness in the Process Capability Studies analysis (Quality Control module), specifically around 3-parameter Weibull fitting and Anderson–Darling p-value display, and adds regression coverage for the reported issue.

Changes:

  • Adjusts 3-parameter Weibull start-value handling to fall back to fixed defaults when start estimation fails.
  • Fixes Anderson–Darling p-value column typing so it renders as a p-value (not an integer).
  • Adds a new verification test case (incl. dataset + plot snapshot) for 3-parameter Weibull non-normal capability analysis.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
R/commonQualityControl.R Makes 3-parameter Weibull fitting more resilient by falling back to default starting values.
R/processCapabilityStudies.R Changes AD test p-value column type to pvalue to improve display/formatting.
tests/testthat/test-processCapabilityStudies.R Adds regression/verification tests and a plot snapshot assertion for the 3-parameter Weibull case.
tests/testthat/datasets/processCapabilityStudy/realDataExample1.csv Adds a real-data CSV used by the new test.
tests/testthat/_snaps/processCapabilityStudies/capability-of-the-processl55-subplot-1.svg Adds the expected plot snapshot for the new test case.

Comment thread R/commonQualityControl.R
}
table$addColumnInfo(name = "ad", title = gettext("AD"), type = "integer")
table$addColumnInfo(name = "p", title = gettext("<i>p</i>-value"), type = "integer")
table$addColumnInfo(name = "p", title = gettext("<i>p</i>-value"), type = "pvalue")
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p is now declared as type pvalue, but later (when nStages > 1) the code sets changeDf$p <- "-", which will coerce the entire p column to character during rbind(). That prevents p-value formatting and may break pvalue rendering. Consider keeping p numeric (e.g., use NA_real_ for change rows and leave the cell blank / add a footnote) so the pvalue column type can work consistently.

Suggested change
table$addColumnInfo(name = "p", title = gettext("<i>p</i>-value"), type = "pvalue")
table$addColumnInfo(name = "p", title = gettext("<i>p</i>-value"), type = "string")

Copilot uses AI. Check for mistakes.
Comment on lines +3274 to +3293
test_that("LF55.1 Additional 3-paraneter Weibull verification - Non-conformance statistics table results match", {
table <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_PerformanceNonNormal"]][["data"]]
jaspTools::expect_equal_tables(table,
list(0, 0, "ppm &lt; LSL", 25245.93, 23529.41, "ppm &gt; USL", 25245.93,
23529.41, "Total ppm"))
})

test_that("LF55.2 Additional 3-paraneter Weibull verification - Capability of the process plot matches", {
plotName <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_capabilityPlot"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "capability-of-the-processL55")
})

test_that("LF55.3 Additional 3-paraneter Weibull verification - Process performance (total) table results match", {
table <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_overallCapabilityNonNormal"]][["data"]]
jaspTools::expect_equal_tables(table,
list("<unicode>", 0.65, "<unicode>", 0.65))
})

test_that("LF55.4 Additional 3-paraneter Weibull verification - Process summary table results match", {
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new test descriptions contain a typo (“3-paraneter”). This makes it harder to search/compare with other LFxx test labels; please correct the spelling in these test_that() titles (and any other occurrences in this added block).

Suggested change
test_that("LF55.1 Additional 3-paraneter Weibull verification - Non-conformance statistics table results match", {
table <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_PerformanceNonNormal"]][["data"]]
jaspTools::expect_equal_tables(table,
list(0, 0, "ppm &lt; LSL", 25245.93, 23529.41, "ppm &gt; USL", 25245.93,
23529.41, "Total ppm"))
})
test_that("LF55.2 Additional 3-paraneter Weibull verification - Capability of the process plot matches", {
plotName <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_capabilityPlot"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "capability-of-the-processL55")
})
test_that("LF55.3 Additional 3-paraneter Weibull verification - Process performance (total) table results match", {
table <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_overallCapabilityNonNormal"]][["data"]]
jaspTools::expect_equal_tables(table,
list("<unicode>", 0.65, "<unicode>", 0.65))
})
test_that("LF55.4 Additional 3-paraneter Weibull verification - Process summary table results match", {
test_that("LF55.1 Additional 3-parameter Weibull verification - Non-conformance statistics table results match", {
table <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_PerformanceNonNormal"]][["data"]]
jaspTools::expect_equal_tables(table,
list(0, 0, "ppm &lt; LSL", 25245.93, 23529.41, "ppm &gt; USL", 25245.93,
23529.41, "Total ppm"))
})
test_that("LF55.2 Additional 3-parameter Weibull verification - Capability of the process plot matches", {
plotName <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_capabilityPlot"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "capability-of-the-processL55")
})
test_that("LF55.3 Additional 3-parameter Weibull verification - Process performance (total) table results match", {
table <- results[["results"]][["capabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis"]][["collection"]][["capabilityAnalysis_nonNormalCapabilityAnalysis_overallCapabilityNonNormal"]][["data"]]
jaspTools::expect_equal_tables(table,
list("<unicode>", 0.65, "<unicode>", 0.65))
})
test_that("LF55.4 Additional 3-parameter Weibull verification - Process summary table results match", {

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is perhaps good to fix

Comment thread tests/testthat/test-processCapabilityStudies.R
@@ -0,0 +1,171 @@
data
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSV header includes a UTF-8 BOM character before data (it renders as an invisible/odd character). This can cause the column name to be read as something other than data on some systems, which would break tests/options that refer to "data". Please save this file without a BOM so the header is exactly data.

Suggested change
data
data

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@Kucharssim Kucharssim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine to me, I can confirm that the error in the issue is fixed.

@JTPetter JTPetter merged commit 6bc5ea1 into jasp-stats:master Apr 8, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Process Capability won't generate on 3-parameter Weibull data

4 participants