Skip to content

Conversation

@sprague252
Copy link

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
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!

@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +3.70 🎉

Comparison is base (e03407a) 90.04% compared to head (7bba907) 93.75%.

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     
Impacted Files Coverage Δ
src/power_divergence.jl 98.48% <100.00%> (-0.91%) ⬇️

... and 27 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

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