@@ -108,10 +108,36 @@ var mu = dist.mean;
108
108
<!-- eslint no-undef: "error" -->
109
109
110
110
``` javascript
111
- var objectKeys = require ( ' @stdlib/utils/keys ' );
111
+ var roundn = require ( ' @stdlib/math/base/special/roundn ' );
112
112
var chisquare = require ( ' @stdlib/stats/base/dists/chisquare' );
113
113
114
- console .log ( objectKeys ( chisquare ) );
114
+ // Define degrees of freedom:
115
+ var k = 5.0 ;
116
+
117
+ // Calculate distribution properties:
118
+ console .log ( ' Mean: %d' , chisquare .mean ( k ) );
119
+ console .log ( ' Median: %d' , roundn ( chisquare .median ( k ), - 4 ) );
120
+ console .log ( ' Mode: %d' , chisquare .mode ( k ) );
121
+ console .log ( ' Variance: %d' , chisquare .variance ( k ) );
122
+ console .log ( ' Standard Deviation: %d' , roundn ( chisquare .stdev ( k ), - 4 ) );
123
+ console .log ( ' Skewness: %d' , roundn ( chisquare .skewness ( k ), - 4 ) );
124
+ console .log ( ' Excess Kurtosis: %d' , roundn ( chisquare .kurtosis ( k ), - 4 ) );
125
+ console .log ( ' Entropy: %d' , roundn ( chisquare .entropy ( k ), - 4 ) );
126
+
127
+ // Evaluate probability functions:
128
+ var x = 3.0 ;
129
+ console .log ( ' \n Evaluating at x = %d' , x );
130
+ console .log ( ' PDF: %d' , roundn ( chisquare .pdf ( x, k ), - 4 ) );
131
+ console .log ( ' logPDF: %d' , roundn ( chisquare .logpdf ( x, k ), - 4 ) );
132
+ console .log ( ' CDF: %d' , roundn ( chisquare .cdf ( x, k ), - 4 ) );
133
+
134
+ // Calculate quantiles:
135
+ var p = 0.7 ;
136
+ console .log ( ' \n Quantile at p = %d: %d' , p, roundn ( chisquare .quantile ( p, k ), - 4 ) );
137
+
138
+ // Evaluate moment-generating function:
139
+ var t = 0.1 ;
140
+ console .log ( ' MGF at t = %d: %d' , t, roundn ( chisquare .mgf ( t, k ), - 4 ) );
115
141
```
116
142
117
143
</section >
0 commit comments