Created
January 13, 2021 12:12
-
-
Save epogrebnyak/a2a42822562878aaa7b90eb94648ef50 to your computer and use it in GitHub Desktop.
Poisson replicated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.stats import poisson | |
from dataclasses import dataclass | |
from math import factorial, exp | |
@dataclass | |
class Poisson: | |
mu : float | |
def __postinit__(self): | |
assert self.mu > 0 | |
def probability(self, k): | |
return (self.mu ** k) / factorial (k) * exp(-1 * self.mu) | |
assert abs(Poisson(5).probability(4) - poisson(5).pmf(4)) < 0.0001 | |
""" | |
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.poisson.html#scipy.stats.poisson | |
http://www.stats.ox.ac.uk/~filippi/Teaching/psychology_humanscience_2015/lecture5.pdf | |
https://stats.stackexchange.com/questions/504701/why-is-poisson-distribution-centered-left-of-mean | |
https://u.math.biu.ac.il/~amirgi/CTMCnotes.pdf | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment