Skip to content

feat: add DS-np control chart wrapper#21

Merged
flaviobarros merged 1 commit into
masterfrom
cchart-dsnp
Jul 1, 2026
Merged

feat: add DS-np control chart wrapper#21
flaviobarros merged 1 commit into
masterfrom
cchart-dsnp

Conversation

@flaviobarros

Copy link
Copy Markdown
Owner

Summary

  • Add cchart.DSnp() as the high-level function for building double-sampling np control charts, completing the DS-np API proposed in issue [P1] Implementar gráfico DS-np corrigido para processos de alta qualidade #5
  • Implement two-stage decision logic: first-stage accept/signal based on x1 vs integer thresholds derived from fractional limits, second-stage evaluation using combined x1 + x2 counts
  • Add S3 plot.cchart.DSnp() method for operational visualization of the chart

Changes

New files:

  • R/cchart.DSnp.R — main function, S3 plot method, and full roxygen2 documentation
  • tests/testthat/test-cchart-DSnp.R — 74 tests covering structure, classification, validation, limit computation, performance consistency, and plotting
  • man/cchart.DSnp.Rd, man/plot.cchart.DSnp.Rd — generated documentation

Modified files:

  • DESCRIPTION — restored knitr/rmarkdown Suggests and VignetteBuilder: knitr (lost in dsnp-limits branch)
  • NAMESPACE — added cchart.DSnp export, plot.cchart.DSnp S3 method, graphics::legend import
  • R/d2.R — added missing stats::integrate import
  • README.md — added DS-np to implemented methods table; marked DS-np as Implemented in roadmap
  • vignettes/iqcc-positioning.Rmd — added dsnp_limits() + cchart.DSnp() example; updated roadmap
  • man/*.Rd — regenerated by roxygen2 7.3.1

Limit resolution logic

  1. If limits object provided → use limits$best thresholds
  2. If wl, ucl1, ucl2 provided → use directly
  3. If none provided → call dsnp_limits() automatically
  4. If partial → error

Test results

All 316 tests pass (74 new + 242 existing). R CMD check passes with only pre-existing warnings (version number, missing qpdf).

Closes #5

Add cchart.DSnp() as the high-level function for building double-sampling
np control charts. The function classifies observations through a two-stage
decision process using fractional limits (wl, ucl1, ucl2) and returns a
structured object with data, limits, parameters, and performance metrics.

Includes:
- R/cchart.DSnp.R: main function and S3 plot method
- tests/testthat/test-cchart-DSnp.R: 74 tests covering structure,
  classification logic, validation, limit computation, and plot
- Updated README with DS-np in implemented methods table
- Updated vignette with dsnp_limits() and cchart.DSnp() examples
- Restored VignetteBuilder/knitr/rmarkdown in DESCRIPTION
- Fixed missing stats::integrate import in d2.R

Closes #5
@flaviobarros flaviobarros merged commit 1f73a7b into master Jul 1, 2026
2 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.

[P1] Implementar gráfico DS-np corrigido para processos de alta qualidade

1 participant