scipy-yli/docs/internal.rst

69 lines
2.5 KiB
ReStructuredText

Internal utilities
==================
Data wrangling
--------------
.. autofunction:: yli.utils.as_2groups
.. autofunction:: yli.utils.as_numeric
.. autofunction:: yli.utils.convert_pandas_nullable
*p* values
----------
.. autofunction:: yli.utils.fmt_p
.. autoclass:: yli.utils.PValueStyle
.. attribute:: VALUE_ONLY
Display only the *p* value (e.g. ``0.08``, ``<0.001*``)
This is an alias for specifying no flags.
.. attribute:: RELATION
Force displaying a relational operator before the *p* value (e.g. ``= 0.08``, ``< 0.001*``)
.. attribute:: TABULAR
Pad with spaces to ensure decimal points align (incompatible with :attr:`RELATION`)
.. attribute:: HTML
Format as HTML (e.g. escape ``<``)
Formula manipulation
--------------------
.. autofunction:: yli.utils.cols_for_formula
.. autofunction:: yli.utils.formula_factor_ref_category
.. autofunction:: yli.utils.parse_patsy_term
Library style
-------------
For API nomenclature, the following guidelines are used:
* Prefer to call a test by its specific name (e.g. *anova* rather than *ftest* where applicable), unless most commonly known only by the distribution of the test statistic (e.g. *chi2*, *ttest*).
..
* A test/statistic is not referred to by both a distribution and specific name (e.g. *mannwhitney* rather than *mannwhitneyu*), unless required for disambiguation (e.g. *pearsonr* to distinguish the Pearson *χ*:sup:`2` test).
..
* The word "test" is omitted (e.g. *chi2* rather than *chi2test*), unless the name would otherwise be a single letter (e.g. *ttest*, *ftest*), or unless required for disambiguation (e.g. *LikelihoodRatioTestResult* to distinguish from the unrelated meaning of "likelihood ratio" in epidemiology).
..
* Underscores are usually omitted from the names of specific tests, test families and statistics (e.g. *ttest*, *oddsratio*, *pearsonr*, *pvalue*), but are used to separate these from other components (e.g. *ttest_ind*, *anova_oneway*, *lrtest_null*). There are a few exceptions (e.g. *rank_biserial*, *pseudo_rsquared*, *f_statistic*).
..
* The result class for a test has the same naming convention as the test function (e.g. *TTestResult* for *ttest_ind*), with abbreviations spelled out (e.g. *PearsonChiSquaredResult*, *LikelihoodRatioTestResult*); unless the result class is generic among several tests (e.g. *FTestResult* for *anova_oneway* and *RegressionResult.ftest*), or unless required for disambiguation (e.g. *PearsonChiSquaredResult* for *chi2*, as there are other *χ*:sup:`2` tests).