statrs-dev / statrs

Statistical computation library for Rust
https://docs.rs/statrs/latest/statrs/
MIT License
546 stars 78 forks source link

Fix invalid `k` letter in Poisson formula docs. #192

Closed iago-lito closed 2 months ago

iago-lito commented 11 months ago

For some reason, these formulae used a mixture of k and x for the same parameter. I haven't checked whether this problem is spread more widely within the docs though.

YeungOnion commented 3 months ago

Thanks for catching this, seems like there's similar - but less erroneous imo - usages of $k$ where the docs previously reference x, there's more consistency in the docs using x for the parameter of functions characterizing a distribution.

Would you be willing to add the ones in the distribution::hypergeometric in this PR as well?


Generally, I have no opposition to readings of statements in the manner that always uses $x$ in terms of a function parameter,

$$ K \sim \textrm{Pois}(\lambda) $$

$$ \implies \textrm{Pr}(K = x) = f_\lambda(x) $$

As it's also good for other 1D random variables, even if multi parameter,

$$ X \sim \textrm{HypGeom}(N,n,\vec{p}); |\vec{p}|_1 = K $$

$$ \implies \textrm{Pr}(X = x) = f_{N,n,\vec{p}}\ (x) $$

as well as continuous and to the same notation for CDF as well, which could be defined for float even on discrete distributions (of appropriate support).

iago-lito commented 3 months ago

Hello. I am not exactly sure I understand your request, but maybe this additional commit is what you expect?

YeungOnion commented 3 months ago

Yes! Thanks for figuring it out, I now realize how I could have better demonstrated what I meant.