Skip to content

ENH: missing, unclear docs in newer functions #7564

Open

Description

@josef-pkt

Activity

  1. added this to the 0.13 milestone on Jul 8, 2021
  2. josef-pkt commented on Sep 8, 2021

    @josef-pkt
    MemberAuthor

    references to literature and to docs of other packages is missing in several functions, e.g. 2 sample proportion

  3. josef-pkt commented on Sep 8, 2021

    @josef-pkt
    MemberAuthor

    https://www.statsmodels.org/dev/generated/statsmodels.stats.outliers_influence.GLMInfluence.summary_frame.html
    says The resultant DataFrame contains six variables in addition to the dfbetas but then lists only 4

    plot_index could get an example like plot_inluence

  4. josef-pkt commented on Sep 9, 2021

    @josef-pkt
    MemberAuthor

    https://www.statsmodels.org/dev/generated/statsmodels.stats.power.FTestAnovaPower.power.html
    should be more explicit that nobs is total nobs, sum over all groups.
    and that effect size is Cohen's f
    (I guess docstrings were mostly copy-paste, but because they are copied, we can adjust them.)

    Confusion about nobs and effect size (f2 versus f) in
    https://stats.stackexchange.com/questions/544027/different-results-for-anova-power-calculation-by-r-and-statsmodels/544144#544144

    FTestAnovaPower.power should also get a "see also" cross-link to the oneway effectsize function

  5. josef-pkt commented on Sep 10, 2021

    @josef-pkt
    MemberAuthor

    https://www.statsmodels.org/dev/generated/statsmodels.stats.proportion.proportions_ztest.html

    The Notes section points to equivalence to proportions_chisquare test. However, we need to adjust prop_var for that, at least in the one sample case. Unit tests also have an example for equivalence in 2 sample case (without prop_var? I didn't verify that.)
    https://stackoverflow.com/questions/69133025/when-to-use-chisquare-or-a-simple-teste-for-proportion/69133640#69133640

    update
    two sample case doesn't need prop_var. What's the difference to one-sample case?

    res1 = prop.proportions_ztest(np.asarray([15, 10]),
                                        np.asarray([20., 20]),
                                        value=0)
    res2 = prop.proportions_chisquare(np.asarray([15, 10]),
                                        np.asarray([20., 20]))
    # test only p-value
    assert_almost_equal(res1[1], res2[1], decimal=13)
    
    res1, res2
    ((1.6329931618554523, 0.10247043485974937),
     (2.666666666666667,
      0.10247043485974885,
      (array([[15.,  5.],
              [10., 10.]]),
       array([[12.5,  7.5],
              [12.5,  7.5]]))))
    

    The ztest uses the pooled variance which is the null estimate if value=0 (assumption equal proportion).
    This is not the null if value is different from zero.
    chisquare test only allows the null of identical proportions (i.e. value = 0 across columns of contingency table)

    We need "See Also" in proportions_ztest to the new 2-sample proportion functions, which e.g. allow for score test when value != 0, and includes or and rr besides diff.

    Related:
    older stats.stackexchange complaint about documenting defaults
    https://stats.stackexchange.com/questions/447462/why-does-the-proportions-ztest-function-in-statsmodels-produce-different-values?rq=1

  6. josef-pkt commented on Sep 15, 2021

    @josef-pkt
    MemberAuthor

    aside: we get warnings during sphinx doc build about invalid sections like Returns in class docstrings
    one example is OLSInfluence

    my guess now:
    Attributes, cached properties are automatically included in the class docstring.
    (cached properties show up twice? once in text list, once in list with links)

    Some docstrings for cached properties contain those sections that show up in the sdoc build warning,
    e.g. OLSInfluence.dffits has Returns and References section.
    The section headers are ignored by doc rendering, e.g. see Attributes section in https://www.statsmodels.org/dev/generated/statsmodels.stats.outliers_influence.OLSInfluence.html

    However:
    cached properties are correctly documented as Properties (list of links), e.g.
    https://www.statsmodels.org/dev/generated/statsmodels.stats.outliers_influence.OLSInfluence.dffits.html

    another example
    OLSResults has 5 warnings for Notes section.
    The 4 HCx_xe cached attributes inherited from RegressionResults have Notes sections. I cannot find a 5th.

  7. josef-pkt commented on Sep 15, 2021

    @josef-pkt
    MemberAuthor
  8. josef-pkt commented on Sep 16, 2021

    @josef-pkt
    MemberAuthor

    Having no docstring and inherit is better than a stub docstring

    GenericLikelihoodModel.fit has a minimal stub docstring.
    I think, if we delete it, then we get automtically the full docstring from the super class. It looks that way in recent doc updates.

    update
    Maybe not from_formula doesn't inherit docstring
    https://www.statsmodels.org/dev/generated/statsmodels.miscmodels.ordinal_model.OrderedModel.from_formula.html
    is empty

    But in copulas inheritance worked

  9. josef-pkt commented on Sep 22, 2021

    @josef-pkt
    MemberAuthor
  10. josef-pkt commented on Sep 22, 2021

    @josef-pkt
    MemberAuthor
  11. modified the milestones: 0.13, 0.14 on Apr 17, 2023
  12. josef-pkt commented on Oct 9, 2024

    @josef-pkt
    MemberAuthor

    CountDiagnostic and PoissonDiagnostic are missing in docs

    (MLEInfluence is in docs and in see also of get_influence function that I checked)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions