Skip to content

Fix abtest bayesian - #323

Merged
JohnnyDoorn merged 10 commits into
jasp-stats:masterfrom
JohnnyDoorn:fix-abtest-bayesian
Apr 13, 2026
Merged

Fix abtest bayesian#323
JohnnyDoorn merged 10 commits into
jasp-stats:masterfrom
JohnnyDoorn:fix-abtest-bayesian

Conversation

@JohnnyDoorn

@JohnnyDoorn JohnnyDoorn commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Also add plot fallback files

Copilot AI review requested due to automatic review settings April 9, 2026 12:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR aims to fix the ABTest Bayesian analysis by adapting the input passed to abtest::ab_test() and updating test snapshots accordingly.

Changes:

  • Rename/massage input data so abtest::ab_test() receives expected y1/n1/y2/n2 fields.
  • Update prior/posterior pie chart labeling to avoid coord_polar() rendering differences.
  • Regenerate snapshot SVGs and update renv.lock to a newer jaspBase commit.

Reviewed changes

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

File Description
R/abtestbayesian.R Adjusts dataset column handling and switches ab_test() input to a named list; tweaks pie chart labeling.
tests/testthat/test-abtestbayesian.R Changes macOS skip behavior for a snapshot-based plot test.
tests/testthat/_snaps/**.svg Updates snapshot outputs to match new rendering/layout.
renv.lock Bumps jaspBase remote SHA to align dependency state with new behavior.
Comments suppressed due to low confidence (1)

tests/testthat/test-abtestbayesian.R:1

  • Leaving skip_on_os(\"mac\") commented out makes the test behavior ambiguous and can lead to unexpected CI failures on macOS without documenting why. Either remove the line entirely (if macOS is now supported) or re-enable the skip with a clear comment explaining the specific macOS failure mode and (ideally) the condition under which it can be removed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/abtestbayesian.R Outdated
Comment on lines +23 to +29
if (ready) {
# ab_test expects data with columns named n1, n2, y1, y2
colnames(dataset) <- stringr::str_replace_all(
colnames(dataset),
setNames(c("n1", "n2", "y1", "y2"), c(options$n1, options$n2, options$y1, options$y2))
)
}

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

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

Mutating colnames(dataset) to n1/n2/y1/y2 can break other code paths that still expect the original column names via options$n1/options$y1/... (e.g., descriptives tables or any downstream access by the selected variable names). Also, stringr::str_replace_all() uses regex/substitution and can rename unintended columns if options$* values are substrings of other column names. Prefer constructing data_list directly from the selected columns (using dataset[[options$y1]], etc.) without renaming dataset, or (if renaming is unavoidable) rename via exact-name matching on a copy (e.g., dataset_ab <- dataset) rather than regex replacement.

Copilot uses AI. Check for mistakes.
Comment thread R/abtestbayesian.R
Comment thread R/abtestbayesian.R Outdated
p_prior <- p_prior[names(hyp_index2)]
p_post <- p_post [names(hyp_index2)]

# use NonPolar variant to avoid coord_polar rendering issues in newer ggplot2

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

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

The comment says a “NonPolar variant” is being used, but the code still calls jaspGraphs::plotPieChart() and simply removes the explicit coord_polar() call. Please update the comment to accurately describe what changed, or switch to the actual non-polar plotting helper (if one exists in jaspGraphs) so the comment matches the implementation.

Suggested change
# use NonPolar variant to avoid coord_polar rendering issues in newer ggplot2
# continue to use jaspGraphs::plotPieChart(); this code path avoids adding an
# extra explicit coord_polar() layer here

Copilot uses AI. Check for mistakes.
Comment thread R/abtestbayesian.R
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@JohnnyDoorn
JohnnyDoorn force-pushed the fix-abtest-bayesian branch from ce532fb to 6ee9ff4 Compare April 13, 2026 08:42
@JohnnyDoorn
JohnnyDoorn merged commit 1a09b83 into jasp-stats:master Apr 13, 2026
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.

4 participants