Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: clarify the definition of the pdf of stats.fisk #14003

Merged
merged 4 commits into from
Feb 26, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions scipy/stats/_continuous_distns.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,12 @@ class burr_gen(rv_continuous):
-----
The probability density function for `burr` is:

.. math::

f(x, c, d) = c d x^{c - 1} / (1 + x^{c})^{d + 1}

Also equivalent to:

.. math::

f(x, c, d) = c d x^{-c - 1} / (1 + x^{-c})^{d + 1}
Copy link
Member

@ev-br ev-br May 8, 2021

Choose a reason for hiding this comment

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

These two formulas are only equivalent for d=1, i.e. for the fisk distribution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the pdf formula for burr distribution, so the first one is the right one ?

image

Copy link
Member

Choose a reason for hiding this comment

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

I agree, looks like the first one is the right one. Also, if we're using LaTeX anyway, let's use \frac and make it look identical to how the pdf is given on Wikipedia.

Copy link
Contributor

@mdhaber mdhaber Feb 23, 2022

Choose a reason for hiding this comment

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

It looks like the second one, the original one, is the intended one for the burr distribution.

This is the PDF corresponding to the third CDF given in Burr's list;
specifically, it is equation (11) in Burr's paper [1]_

This is:
image

Taking the derivative and changing the symbols used for the parameters, it turns into:
image

This is what the code implements when x != 0:

        output = _lazywhere(x == 0, [x, c, d],
                   lambda x_, c_, d_: c_ * d_ * (x_**(c_*d_-1)) / (1 + x_**c_),
                   f2 = lambda x_, c_, d_: (c_ * d_ * (x_ ** (-c_ - 1.0)) /
                                            ((1 + x_ ** (-c_)) ** (d_ + 1.0))))

(I'll leave simplifying that to another time...)

It seems that the other one is burr12.

Expand Down Expand Up @@ -1079,10 +1085,17 @@ class fisk_gen(burr_gen):
-----
The probability density function for `fisk` is:

.. math::

f(x, c) = c x^{c-1} (1 + x^{c})^{-2}

Also equivalent to:
Copy link
Member

Choose a reason for hiding this comment

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

This is actually confusing, without reading the linked issue it was non-obvious that this wasn't a mistake. I suggest the following rephrase: Please note that the above expression can be transformed into the following one, which is also commonly used:


.. math::

f(x, c) = c x^{-c-1} (1 + x^{-c})^{-2}


for :math:`x >= 0` and :math:`c > 0`.

`fisk` takes ``c`` as a shape parameter for :math:`c`.
Expand Down