Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@stdlib/stats-base-dists-poisson-logpmf
Advanced tools
Natural logarithm of the probability mass function (PMF) for a Poisson distribution.
Evaluate the natural logarithm of the probability mass function (PMF) for a Poisson distribution.
The probability mass function (PMF) for a Poisson random variable is
where lambda > 0
is the mean parameter.
npm install @stdlib/stats-base-dists-poisson-logpmf
var logpmf = require( '@stdlib/stats-base-dists-poisson-logpmf' );
Evaluates the natural logarithm of the probability mass function (PMF) for a Poisson distribution with mean parameter lambda
.
var y = logpmf( 4.0, 3.0 );
// returns ~-1.784
y = logpmf( 1.0, 3.0 );
// returns ~-1.901
y = logpmf( -1.0, 2.0 );
// returns -Infinity
If provided NaN
as any argument, the function returns NaN
.
var y = logpmf( NaN, 2.0 );
// returns NaN
y = logpmf( 0.0, NaN );
// returns NaN
If provided a negative mean parameter lambda
, the function returns NaN
.
var y = logpmf( 2.0, -1.0 );
// returns NaN
y = logpmf( 4.0, -2.0 );
// returns NaN
If provided lambda = 0
, the function evaluates the natural logarithm of the PMF of a degenerate distribution centered at 0.0
.
var y = logpmf( 2.0, 0.0 );
// returns -Infinity
y = logpmf( 0.0, 0.0 );
// returns 0.0
Returns a function for evaluating the natural logarithm of the probability mass function (PMF) for a Poisson distribution with mean parameter lambda
.
var mylogpmf = logpmf.factory( 1.0 );
var y = mylogpmf( 3.0 );
// returns ~-2.792
y = mylogpmf( 1.0 );
// returns ~-1.0
var randu = require( '@stdlib/random-base-randu' );
var round = require( '@stdlib/math-base-special-round' );
var logpmf = require( '@stdlib/stats-base-dists-poisson-logpmf' );
var lambda;
var x;
var y;
var i;
for ( i = 0; i < 10; i++ ) {
x = round( randu() * 10.0 );
lambda = randu() * 10.0;
y = logpmf( x, lambda );
console.log( 'x: %d, λ: %d, ln(P(X=x;λ)): %d', x, lambda.toFixed( 4 ), y.toFixed( 4 ) );
}
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2021. The Stdlib Authors.
0.0.3 (2021-06-27)
No changes reported for this release.
</section> <!-- /.release --> <section class="release" id="v0.0.2">FAQs
Natural logarithm of the probability mass function (PMF) for a Poisson distribution.
The npm package @stdlib/stats-base-dists-poisson-logpmf receives a total of 781 weekly downloads. As such, @stdlib/stats-base-dists-poisson-logpmf popularity was classified as not popular.
We found that @stdlib/stats-base-dists-poisson-logpmf demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.