Skip to content

fix: DoE ANOVA model/total SS wrong for type II/III - #522

Open
julianwuth wants to merge 6 commits into
jasp-stats:masterfrom
julianwuth:fix/doe-anova-model-total-ss
Open

julianwuth wants to merge 6 commits into
jasp-stats:masterfrom
julianwuth:fix/doe-anova-model-total-ss

Conversation

@julianwuth

Copy link
Copy Markdown
Contributor

Model & Total rows summed term SS, only valid for type I. Now:

  • Model SS = SST - SSE, Model F/p from overall regression test
  • Total SS = SST
  • group rows (linear/squared/interaction/covariates) tested jointly for type II/III, now with MS/F/p

Model & Total rows summed term SS, only valid for type I. Now:
- Model SS = SST - SSE, Model F/p from overall regression test
- Total SS = SST
- group rows (linear/squared/interaction/covariates) tested jointly for type II/III, now with MS/F/p

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

👋 Friendly reminder: It looks like NEWS.md wasn't updated in this Pull Request.

If your changes include bug fixes, new features, or UI tweaks, please consider adding a quick note to the # jaspYourModule (development version) section so our users know about your awesome work! (If this is just a minor typo fix, feel free to ignore this message.)

julianwuth and others added 4 commits October 30, 2026 16:27
- DoE help from inst/help md into info/infoBottom
- add ANOVA table + SS type docs
- remove doeAnalysis/doeFactorial/doeResponseSurfaceMethodology.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per-value `info` in DropDown values not shown in help. Moved descriptions into
parent `info` as markdown list for:
- designType
- rsmPredefinedTerms
- sumOfSquaresType (also drop trailing comma)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@julianwuth
julianwuth marked this pull request as ready for review October 31, 2026 15:58
@juliuspfadt

Copy link
Copy Markdown
Contributor

Checked on the PR head in R and in JASP (dev module).

Correctness

  • test-doeAnalysis.R: 258 tests, 0 failures. All 46 changed test blocks are ANOVA tables.
  • Unbalanced 2^3 factorial + covariate, type I/II/III: all rows (Model, groups, single terms, Error, Total) match independent calculations to ~1e-10. Single terms vs car::Anova, group rows vs nested-model SS, Model F/p vs summary(lm).
  • CCD with blocks and squared terms: all 14 rows match for all three types.
  • Also fine: 3-level factor in the uncoded ANOVA (multi-column terms), saturated design (F/p blank, no crash), aliased half-fraction (coded and uncoded).
  • Same factorial run in JASP (type III and II): identical to R.
  • CI: the failing DoE tests (46) are the same set as on master's scheduled run of the same day; none are ANOVA tables.

Suggestions

  1. No test covers the new logic; the PR only updates expected values. A small unbalanced design checked against car::Anova (type II/III) would protect .doeAnovaGroupSumOfSquares.
  2. Overlap with other open PRs: merges cleanly with fix: DoE effects = 2 x coef for all term orders #525 (merged tree passes all 263 DoE tests), but conflicts with docs: switch to qml info generated help files #501 (info text in doeAnalysis.qml, doeFactorial.qml, doeResponseSurfaceMethodology.qml, ShowAndExportDesign.qml) and fix: 3+ level discrete factors treated as numeric in coded DoE analysis #521 (test-doeAnalysis.R, doeAnalysis.md deleted here but modified there). Merge order needs deciding.

Not verified

  • How the new infoBottom text and the help images render in JASP's Help panel (image paths changed from %HELP_FOLDER%/images/… to <%HELP_FOLDER%images/…>). Worth a quick look.

@juliuspfadt

Copy link
Copy Markdown
Contributor

Docs gap: Response optimizer section has no info:

The PR moves the DoE help into QML info, but the Response optimizer section in doeAnalysis.qml (the Section titled "Response optimizer") has none, so it's missing from the generated help. The old doeAnalysis.md had one line for it ("Show optimal response…"), and that control no longer exists under that name, so the line was dropped without a replacement. Please add info: (and infoLabel: where the control has no label) to these controls:

  • Section: what the optimizer does (finds the factor settings that maximize the composite desirability of the included responses).
  • responsesResponseOptimizer (Included responses) and the row fields. Suggested wording, based on .calculateDesirability:
    • Goal: maximize, minimize, or hit a target value.
    • Lower / Upper: values at which the individual desirability is 0. Lower is used for maximize and target, Upper for minimize and target. Only editable with "Set all bounds manually"; otherwise the minimum/maximum of the observed response is used.
    • Target: value at which the individual desirability is 1. Always editable for the Target goal; for maximize/minimize only with "Set all targets manually", otherwise the maximum/minimum of the observed response.
    • Weight (0.1–10): shape of the individual desirability between bound and target. 1 is linear; larger values require the response to be closer to the target; smaller values are more lenient.
    • Importance (0.1–10): relative importance of the response in the composite desirability (weighted geometric mean, normalized to sum to 1). Only enabled with more than one response.
  • responseOptimizerManualBounds / responseOptimizerManualTarget: use the entered bounds/targets instead of estimating them from the data.
  • optimizationSolutionTable (Show optimal solution): settings table plus the optimal factor levels, composite desirability and predicted responses.
  • optimizationPlot (Show optimization plot), optimizationPlotPredictionType (Predict: predicted response or individual desirability), optimizationPlotCustomParameters and its factor/value list (plot at manually entered factor values instead of the optimum).

The wording above is a draft, so please check it against the code. Adding the info: strings with an LLM from .calculateDesirability and the optimizer tables should be quick.

@juliuspfadt juliuspfadt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mostly in good shape, see the comments. Nice work on moving the help file to the info fields. I am working on the same thing for the whole module in a separate PR.

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.

2 participants