Skip to content

chisquare and chisquare_power functions are missing in docs #7369

Open

Description

@dbalabka

Describe the bug

Following functions missing in docs:

  1. statsmodels.stats.gof.chisquare
  2. statsmodels.stats.gof.chisquare_power

Expected Output

Both functions exist in code and should appear in the documentation:
https://www.statsmodels.org/devel/stats.html#goodness-of-fit-tests-and-measures

Activity

  1. changed the title [-]chisquare and chisquare_power function missing in docs[/-] [+]chisquare and chisquare_power functions are missing in docs[/+] on Mar 9, 2021
  2. josef-pkt commented on Mar 9, 2021

    @josef-pkt
    Member

    Thanks for reporting

    chisquare is likely missing intentionally
    I think there is no advantage in using it compared to scipy.stats.chisquare.

    similarly, power_discrepancy has gotten a more maintained version, after some time when I wrote this.

    chisquare_power might be a useful function for the docs, but the main access is through the power class which also includes sample size computation. https://www.statsmodels.org/devel/generated/statsmodels.stats.power.GofChisquarePower.html
    This part is AFAIR, because there are different versions of chisquare (based) tests and associated power computation.

    I guess most of that module would need a proper review.

  3. dbalabka commented on Mar 10, 2021

    @dbalabka
    Author

    @josef-pkt thanks for the quick response. It would be great to have some note in the documentation of what package's method (statsmodels or scipy) developers should use. Currently, I'm trying to search over two packages. It would be helpful to have links from statsmodels to scipy and vice-versa, to have at least one source that provides a more complete reference for statistical inference.

    I'm good to close this ticket because of the initial issue that has been solved by your answer.

  4. josef-pkt commented on Mar 10, 2021

    @josef-pkt
    Member

    It would be great to have some note in the documentation of what package's method (statsmodels or scipy) developers should use

    That's a bit of a moving target because both packages are changing and it depends on the use case. So we add See Also (if we didn't forget doing it.), but no recommendation.

    In general, if scipy.stats has what you need, then you can use it. scipy.stats has now many maintainers and contributors. In several cases scipy.stats had the simpler interface or return.
    e.g. I often use simple t-test from scipy instead of statsmodels.

    It used to be that statsmodels has more options when there is an overlap in functionality. But recent development in scipy.stats is also adding more option, and also adding some kind of results structure instead of just returning numbers.
    So, that difference is decreasing.
    statsmodels often has vectorized versions of hypothesis test or similar, as long as the arguments broadcast appropriately.

    an example: scipy.stats got brunner_munzel test a year or two ago and it is just the hypothesis test, My recent version in statsmodels has confidence intervals, equivalence tests and similar additions to the basic test statistic and hypothesis test.

    gof in the case of this issue is better maintained in scipy.stats, but we have additional effect size and power and sample size computation.

  5. added this to the 0.15 milestone on Jun 29, 2022
  6. josef-pkt commented on Jun 29, 2022

    @josef-pkt
    Member

    I put this on my todo, to review list for 0.15

    chisquare has

    Notes
        -----
        The case with value greater than zero is similar to an equivalence test,
        that the exact null hypothesis is replaced by an approximate hypothesis.
        However, TOST "reverses" null and alternative hypothesis, while here the
        alternative hypothesis is that the distance (divergence) is larger than a
        threshold.
    

    that is, chisquare has a value argument for minimum effect test, I called it nonequivalence in poisson rates.
    I also did something similar/opposite in oneway with equivalence test based on a chisquare like distance statistic.

    Related: I have worked more on binned or discrete chisquare test for model diagnostic.
    Also related, tests for multinomial samples or proportions.

    I don't have an overview right now, but there should be some common structure and overlap.
    I need a SUMM issue to look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions