maTH
  • 👋Welcome!
  • 🗿Installation
  • Reference
    • 😱Mathematical operations
      • add
      • pascal
      • factorial
      • factorialL
      • GCD
      • LCM
      • pow
      • permutations
      • combinations
      • combinationsWithRep
      • subtract
      • multiply
      • divide
      • sin
      • cos
      • ln
      • log
      • radToDeg
      • degToRad
      • mod
      • abs
      • floor
      • ceil
      • root
      • exp
      • tan
      • arcsin
      • arccos
      • arctan
      • sinh
      • cosh
      • round
    • 🥶Statistics
      • Binomial
      • Poisson
      • Geometric
      • Pascal
      • Hypergeometric
      • Exponential
      • Uniform
    • 🥵Data structures
      • Stack
      • Queue
      • LinkedList
    • 🤓Algorithms
      • Bubble sort
      • Insertion sort
      • Selection sort
      • Merge sort
      • Quicksort
      • Heap sort
      • Count sort
      • Bucket sort
      • Radix sort
    • 😳Constants
Powered by GitBook
On this page
  • Create a new Poisson distribution
  • Example
  1. Reference
  2. Statistics

Poisson

Represents the number of events occurring within a fixed interval of time or space. It is used for modeling the number of times an event happens in a given period of time, distance, area, or volume when these events occur with a known constant mean rate and independently of the time since the last event.

Create a new Poisson distribution

Poisson X = Poisson(lambda); 

creates a discrete Poisson probability distribution.

Distribution properties:

Property
Type/Return type
Description

lambda (λ)

double

Average number of events in the interval (also known as the rate parameter)

E()

double

Returns the expected value of average number of events in the interval.

D()

double

Represents variance, that measures the spread of dispersion of the random variable around its expected value E(X).

P(int k)

double

Probability of observing exactly 𝑘 events in an interval: P(X = k)

P_LT(int k)

double

Probability of observing less than 𝑘 events in an interval: P(X < k)

P_LTE(int k)

double

Probability of observing less than or exactly 𝑘 events in an interval: P(X ≤ k)

P_HT(int k)

double

Probability of observing more than 𝑘 events in an interval: P(X > k) = P(X ≤ k)

P_HTE(int k)

double

Probability of observing more than or exactly 𝑘 events in an interval: P(X ≥ k) = P(X < k)

Example

//Example: A bookstore expects 3 visitors per hour. What's the probability 
//of encountering 5 visitors in an hour?
double lambda = 3; //3 visitors per hour
Poisson X = Poisson(lambda);
std::cout << X.P(5) << std::endl; //0.100819
Poisson X = Poisson(5); 
std::cout << X.P(-1) << std::endl; //Error: Random variable cannot be less than 0.  

Good to know: k cannot be negative.

PreviousBinomialNextGeometric

Last updated 11 months ago

🥶