Skip to content

Add ddof to PowerDivergenceTest and ChisqTest to allow changes to degrees of freedom#288

Open
sprague252 wants to merge 10 commits intoJuliaStats:masterfrom
sprague252:power-divergence-dof
Open

Add ddof to PowerDivergenceTest and ChisqTest to allow changes to degrees of freedom#288
sprague252 wants to merge 10 commits intoJuliaStats:masterfrom
sprague252:power-divergence-dof

Conversation

@sprague252
Copy link
Copy Markdown

Resolves #266

This change adds a new keyword parameter ddof to PowerDivergenceTest and ChisqTest allowing users to change the number of degrees of freedom used for calculating p-values. This works the same as the ddof parameter in scipy.stats.chisquare. See the documentation for that function at

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chisquare.html.

The ddof value defaults to 0 (no changes to the degrees of freedom). A supplied value for ddof decreases the number of degrees of freedom by the value of ddof. This is important when the distribution probabilities are calculated using parameters from measured data (e.g., mean and sample standard deviation), reducing the number of degrees of freedom.

I updated the docstrings for PowerDivergenceTest and ChisqTest and added a test for ChisqTest with ddof=2 to test/power_divergence.jl. (It passes.)

This ddof parameter specifies the decrease in the number of degrees of
freedom similar to the ddof parameter in scipy.stats.chisquare allowing
users to change the number of degrees of freedom used to calculate
p-values. This is important when the distribution probabilities are
calculated using parameters from measured data (e.g., mean and sample
standard deviation).
Copy link
Copy Markdown
Member

@nalimilan nalimilan left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment thread src/power_divergence.jl Outdated
Comment thread test/power_divergence.jl
Comment thread src/power_divergence.jl Outdated
Comment thread src/power_divergence.jl Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 13, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.75%. Comparing base (e03407a) to head (7bba907).
⚠️ Report is 138 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #288      +/-   ##
==========================================
+ Coverage   90.04%   93.75%   +3.70%     
==========================================
  Files          28       28              
  Lines        1467     1730     +263     
==========================================
+ Hits         1321     1622     +301     
+ Misses        146      108      -38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Custom degrees of freedom argument for the PowerDivergenceTest

3 participants