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] docstring with mathematical description for QPD_Empirical #255

Merged
merged 3 commits into from
Apr 19, 2024

Conversation

fkiraly
Copy link
Collaborator

@fkiraly fkiraly commented Apr 18, 2024

This PR adds a mathematical description in the docstring of QPD_Empirical.

The docstring also explains why the distribution is quantile parameterized, and its relation to Empirical.

A review would be appreciated, @Ram0nB, @setoguchi-naoki, @FelixWick - I also hope (and would appreciate a check) for typos in the math.

FYI @VascoSch92, as this is an example where two formal objects:

  • are equivalent if considered without parameterization
  • but not equivalent if considered together with the parameterization

and the more general question what the class/design principle should be here. Compare Fibonacci vs OEIS(n) object. Also relates to the "multiple names" discussion in VascoSch92/sequentium#49, I am currently of the opinion that different class names should imply difference in parametric object.

@fkiraly fkiraly added module:probability&simulation probability distributions and simulators documentation Documentation & tutorials labels Apr 18, 2024
Comment on lines +33 to +37
In explicit terms, the distribution is an empirical distribution (sum-of-diracs),
supported at the quantiles :math:`q_1, q_2, \dots, q_N`,
with weights :math:`w_1, w_2, \dots, w_N`
such that :math:`w_i = (p_{i+1} - p_{i-1})/2` for :math:`1 = 1, \dots, N`,
where we define :math:`p_0 = -p_1` and :math:`p_{N+1} = 2 - p_N`.

Choose a reason for hiding this comment

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

Just one question:
you say: such that w_i = (p_{i+1} - p_{i-1})/2 for 1 = 1, \dots, N and then you define p_0 and p_{N+1}. Why you define them? How are these two values playing a role here?

Copy link
Collaborator Author

@fkiraly fkiraly Apr 18, 2024

Choose a reason for hiding this comment

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

$w_i$ is defined in terms of $p_{i+1}$ and $p_{i-1}$ for $i= 1\dots N$, and $p_i$ have been defined above also only for $i= 1\dots N$.

So we need to treat $w_1$, $w_N$, either by writing them down explicitly, or by writing equivalent values for $p_0$, $p_{N+1}$. I thought the latter was clearer, in terms how the boundary treatment looks like?

Choose a reason for hiding this comment

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

Ah sorry now I see ;-)

thanks for the explanation. I didn't check that there it was a p_{i-1}) and we have to define p_0 (same for p_{i+1}

Copy link
Collaborator Author

@fkiraly fkiraly Apr 18, 2024

Choose a reason for hiding this comment

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

the $w_i$ should sum to 1, hopefully. The weights should make it that the steps in the ppf are exactly in the middle between two adjacent $p_i$.

@fkiraly fkiraly merged commit d9c3f88 into main Apr 19, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation & tutorials module:probability&simulation probability distributions and simulators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants