• PHP Video Tutorials

PHP - Stats Dens PMF Poisson() Function



Definition and Usage

The stats_dens_pmf_poisson() function is a probability mass function of the Poisson distribution.

Syntax

  float stats_dens_pmf_poisson( float $x, float $lb )

Parameters

Sr.No Parameter Description
1

x

The value at which the probability mass is calculatedv

2

lb

The parameter of the Poisson distribution

Return Values

The stats_dens_pmf_poisson() function can return the probability mass at x, where the random variable can follow the Poisson distribution whose parameter is lb, or false for failure.

Dependencies

This function was first introduced in statistics extension (PHP 4.0.0 and PEAR 1.4.0). We have used latest release of stats-2.0.3 (PHP 7.0.0 or newer and PEAR 1.4.0 or newer) for this tutorial.

Example

In the following example, we compute probability mass at each x.

<?php
   // check for each x
   foreach (range(0, 5) as $x) {
      var_dump(round(stats_dens_pmf_poisson($x, 1), 6));
      echo "<br>";
   }
?>

Output

This will produce following result −

  float(0.367879)
  float(0.367879)
  float(0.18394)
  float(0.061313)
  float(0.015328)
  float(0.003066)

Example

In the following example, we compute probability mass for each lb.

<?php
   // check for each lb
   foreach (range(0.5, 3, 0.5) as $lb) {
      var_dump(round(stats_dens_pmf_poisson(1, $lb), 6));
      echo "<br>";
   }
?>

Output

This will produce following result −

  float(0.303265)
  float(0.367879)
  float(0.334695)
  float(0.270671)
  float(0.205212)
  float(0.149361)
Advertisements