File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/stats/base/dists/poisson Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,10 +111,42 @@ y = dist.pmf( 2.3 );
111111<!-- eslint no-undef: "error" -->
112112
113113``` javascript
114- var objectKeys = require ( ' @stdlib/utils/keys' );
115114var poisson = require ( ' @stdlib/stats/base/dists/poisson' );
116115
117- console .log ( objectKeys ( poisson ) );
116+ /*
117+ * Let's take a customer service center example: average rate of customer inquiries is 3 per hour.
118+ * This situation can be modeled using a Poisson distribution with λ = 3
119+ */
120+
121+ var lambda = 3 ;
122+
123+ // Mean can be used to calculate the average number of inquiries per hour:
124+ console .log ( poisson .mean ( lambda ) );
125+ // => 3
126+
127+ // Standard deviation can be used to calculate the measure of the spread of inquiries around the mean:
128+ console .log ( poisson .stdev ( lambda ) );
129+ // => ~1.7321
130+
131+ // Variance can be used to calculate the variability of the number of inquiries:
132+ console .log ( poisson .variance ( lambda ) );
133+ // => 3
134+
135+ // PMF can be used to calculate specific number of inquiries in an hour:
136+ console .log ( poisson .pmf ( 4 , lambda ) );
137+ // => ~0.1680
138+
139+ // CDF can be used to calculate probability upto certain number of inquiries in an hour:
140+ console .log ( poisson .cdf ( 2 , lambda ) );
141+ // => ~0.4232
142+
143+ // Quantile can be used to calculate the number of inquiries at which you can be 80% confident that the actual number will not exceed.
144+ console .log ( poisson .quantile ( 0.8 , lambda ) );
145+ // => 4
146+
147+ // MGF can be used for more advanced statistical analyses and generating moments of the distribution.
148+ console .log ( poisson .mgf ( 1.0 , lambda ) );
149+ // => ~173.2690
118150```
119151
120152</section >
Original file line number Diff line number Diff line change 1818
1919'use strict' ;
2020
21- var objectKeys = require ( '@stdlib/utils/keys' ) ;
2221var poisson = require ( './../lib' ) ;
2322
24- console . log ( objectKeys ( poisson ) ) ;
23+ /*
24+ * Let's take a customer service center example: average rate of customer inquiries is 3 per hour.
25+ * This situation can be modeled using a Poisson distribution with λ = 3
26+ */
27+
28+ var lambda = 3 ;
29+
30+ // Mean can be used to calculate the average number of inquiries per hour:
31+ console . log ( poisson . mean ( lambda ) ) ;
32+ // => 3
33+
34+ // Standard deviation can be used to calculate the measure of the spread of inquiries around the mean:
35+ console . log ( poisson . stdev ( lambda ) ) ;
36+ // => ~1.7321
37+
38+ // Variance can be used to calculate the variability of the number of inquiries:
39+ console . log ( poisson . variance ( lambda ) ) ;
40+ // => 3
41+
42+ // PMF can be used to calculate specific number of inquiries in an hour:
43+ console . log ( poisson . pmf ( 4 , lambda ) ) ;
44+ // => ~0.1680
45+
46+ // CDF can be used to calculate probability upto certain number of inquiries in an hour:
47+ console . log ( poisson . cdf ( 2 , lambda ) ) ;
48+ // => ~0.4232
49+
50+ // Quantile can be used to calculate the number of inquiries at which you can be 80% confident that the actual number will not exceed.
51+ console . log ( poisson . quantile ( 0.8 , lambda ) ) ;
52+ // => 4
53+
54+ // MGF can be used for more advanced statistical analyses and generating moments of the distribution.
55+ console . log ( poisson . mgf ( 1.0 , lambda ) ) ;
56+ // => ~173.2690
You can’t perform that action at this time.
0 commit comments