feat: moderndive R argument parity (correlation methods, newdata, …)#18
Merged
Conversation
- get_correlation(method="spearman"|"kendall", na_rm=): rank correlations via scipy; na_rm toggles per-pair null dropping. - get_regression_points(newdata=, ID=): predict on a held-out frame (residual included when the outcome is present) and use a column as the identifier. - get_regression_table(default_categorical_levels=True): keep raw statsmodels factor-level term names instead of the prettified "var: level" form. - gg_parallel_slopes(alpha=): point transparency (both engines). Docs (correlation methods + newdata prediction) and CHANGELOG updated. 291 tests, 100% coverage, ruff clean, docs build -W clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CTL1QSTg1DmDUpqYuPEog
This was referenced Jun 20, 2026
…arity # Conflicts: # CHANGELOG.md # doc/_build/html/.doctrees/api.doctree # doc/_build/html/.doctrees/environment.pickle # doc/_build/html/.doctrees/getting-started.doctree # doc/_build/html/.doctrees/guides/confidence-intervals.doctree # doc/_build/html/.doctrees/guides/hypothesis-testing.doctree # doc/_build/html/.doctrees/guides/plotting.doctree # doc/_build/html/.doctrees/guides/regression.doctree # doc/_build/html/.doctrees/guides/theory-based.doctree # doc/_build/html/.doctrees/index.doctree # doc/_build/html/searchindex.js # doc/_build/jupyter_execute/datasets.ipynb # doc/_build/jupyter_execute/getting-started.ipynb # doc/_build/jupyter_execute/guides/confidence-intervals.ipynb # doc/_build/jupyter_execute/guides/hypothesis-testing.ipynb # doc/_build/jupyter_execute/guides/messages.ipynb # doc/_build/jupyter_execute/guides/plotting.ipynb # doc/_build/jupyter_execute/guides/regression.ipynb # doc/_build/jupyter_execute/guides/sampling.ipynb # doc/_build/jupyter_execute/guides/theory-based.ipynb # doc/_build/jupyter_execute/index.ipynb
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CTL1QSTg1DmDUpqYuPEog
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CTL1QSTg1DmDUpqYuPEog
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 1492 1546 +54
=========================================
+ Hits 1492 1546 +54
🚀 New features to boost your workflow:
|
ismayc
added a commit
that referenced
this pull request
Jun 20, 2026
#20) * docs+test: NEWS.md, R-compatibility notes, and R-reference value tests - NEWS.md summarizing the current state under 0.1.0. - doc/r-compatibility.md documenting the deliberate choices made to match R results that differ from "typical" Python (pop_sd ddof=0, regression-summary mse denominator, prop_test chi-square+Yates+Wilson CI, get_p_value two-sided convention, UTC datetimes, derived early_january_2023_weather, plotly default, correlation na_rm default, etc.). - tests/test_r_reference.py: cross-package checks asserting the Python results equal R's exact values on a fixed dataset (get_regression_table/summaries, get_correlation, pop_sd, t_test). New-argument R validations live with their feature tests (#18/#19). 279 tests, 100% coverage, ruff clean, docs build -W clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CTL1QSTg1DmDUpqYuPEog * docs: rebuild HTML after merging main (#19) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CTL1QSTg1DmDUpqYuPEog --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of two PRs closing the remaining R argument-level gaps (functions all already existed). This one covers
moderndive:get_correlation(method=, na_rm=)— Spearman and Kendall rank correlations (via scipy), in addition to Pearson;na_rmtoggles per-pair null dropping.get_regression_points(newdata=, ID=)— apply the model to a held-out set (aresidualis included when the outcome is present innewdata), and use a column as the row identifier.get_regression_table(default_categorical_levels=True)— keep the raw statsmodels factor-level term names instead of the prettified"var: level"form.gg_parallel_slopes(alpha=)— point transparency (both engines).Tests cover scipy-matching for each correlation method,
na_rm=False→nan, newdata with/without outcome, ID from a source column and from newdata, all error paths, raw vs prettified terms, and the alpha plots. Docs updated (correlation methods + newdata prediction). 291 tests, 100% coverage, ruff clean, docs-Wclean.The companion infer arg-parity PR (median point null, prop_test options, weighted sampling,
generate(variables=), shadefill,dens_color) is next.🤖 Generated with Claude Code