@@ -109,10 +109,44 @@ var y = dist.pdf( 0.8 );
109
109
<!-- eslint no-undef: "error" -->
110
110
111
111
``` javascript
112
- var objectKeys = require ( ' @stdlib/utils/keys' );
113
112
var rayleigh = require ( ' @stdlib/stats/base/dists/rayleigh' );
114
113
115
- console .log ( objectKeys ( rayleigh ) );
114
+ /*
115
+ * The Rayleigh distribution can be used to model wind speeds.
116
+ * Let's consider a scenario where we want to estimate various properties related to wind speeds.
117
+ */
118
+
119
+ // Set the Rayleigh distribution parameter (scale parameter):
120
+ var s = 10.0 ;
121
+
122
+ // Calculate mean, variance, and standard deviation of the Rayleigh distribution:
123
+ console .log ( rayleigh .mean ( s ) );
124
+ // => ~12.533
125
+
126
+ console .log ( rayleigh .variance ( s ) );
127
+ // => ~42.920
128
+
129
+ console .log ( rayleigh .stdev ( s ) );
130
+ // => ~6.551
131
+
132
+ // Evaluate the Probability Density Function (PDF) for a specific wind speed:
133
+ var w = 15.0 ;
134
+ console .log ( rayleigh .pdf ( w, s ) );
135
+ // => ~0.049
136
+
137
+ // Determine Cumulative Distribution Function (CDF) for wind speeds up to a certain value:
138
+ var t = 15.0 ;
139
+ console .log ( rayleigh .cdf ( t, s ) );
140
+ // => ~0.675
141
+
142
+ // Calculate the probability of wind speeds exceeding the threshold:
143
+ var p = 1.0 - rayleigh .cdf ( t, s );
144
+ console .log ( ' Probability of wind speeds exceeding ' + t + ' m/s:' , p );
145
+
146
+ // Find the wind speed at which there's a 70% chance it won't exceed using the Quantile function:
147
+ var c = 0.7 ;
148
+ console .log ( rayleigh .quantile ( c, s ) );
149
+ // => ~15.518
116
150
```
117
151
118
152
</section >
0 commit comments