Statistics/Normal distribution: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Sidef}}: Fix link: Perl 6 --> Raku) |
(Add Factor) |
||
Line 518: | Line 518: | ||
2.4: == |
2.4: == |
||
2.6: = |
2.6: = |
||
</pre> |
|||
=={{header|Factor}}== |
|||
{{works with|Factor|0.99 2020-01-23}} |
|||
<lang factor>USING: assocs formatting kernel math math.functions |
|||
math.statistics random sequences sorting ; |
|||
2,000,000 [ 0 1 normal-random-float ] replicate ! make data set |
|||
dup [ mean ] [ population-std ] bi ! calculate and show |
|||
"Mean: %f\nStdev: %f\n\n" printf ! mean and stddev |
|||
[ 10 * floor 10 / ] map ! map data to buckets |
|||
histogram >alist [ first ] sort-with ! create histogram sorted by bucket (key) |
|||
dup values supremum ! find maximum count |
|||
[ |
|||
[ /f 100 * >integer ] keepd ! how big should this histogram bar be? |
|||
[ [ CHAR: * ] "" replicate-as ] dip ! make the bar |
|||
"% 5.2f: %s %d\n" printf ! print a line of the histogram |
|||
] curry assoc-each</lang> |
|||
{{out}} |
|||
<pre style="font-size:80%; height: 120ex; overflow: scroll"> |
|||
Mean: 0.000798 |
|||
Stdev: 1.000549 |
|||
-4.90: 2 |
|||
-4.80: 1 |
|||
-4.70: 1 |
|||
-4.60: 3 |
|||
-4.50: 3 |
|||
-4.40: 6 |
|||
-4.30: 15 |
|||
-4.20: 13 |
|||
-4.10: 16 |
|||
-4.00: 42 |
|||
-3.90: 62 |
|||
-3.80: 68 |
|||
-3.70: 98 |
|||
-3.60: 145 |
|||
-3.50: 205 |
|||
-3.40: 311 |
|||
-3.30: 379 |
|||
-3.20: 580 |
|||
-3.10: 739 |
|||
-3.00: * 1002 |
|||
-2.90: * 1349 |
|||
-2.80: ** 1893 |
|||
-2.70: *** 2499 |
|||
-2.60: **** 3211 |
|||
-2.50: ***** 4035 |
|||
-2.40: ****** 5141 |
|||
-2.30: ******* 6392 |
|||
-2.20: ********* 7869 |
|||
-2.10: ************ 9780 |
|||
-2.00: ************** 11787 |
|||
-1.90: ****************** 14483 |
|||
-1.80: ********************* 17183 |
|||
-1.70: ************************* 20387 |
|||
-1.60: ****************************** 24049 |
|||
-1.50: ********************************** 27555 |
|||
-1.40: **************************************** 32153 |
|||
-1.30: ********************************************* 36707 |
|||
-1.20: *************************************************** 40921 |
|||
-1.10: ********************************************************* 45928 |
|||
-1.00: *************************************************************** 50707 |
|||
-0.90: ********************************************************************* 55697 |
|||
-0.80: *************************************************************************** 60377 |
|||
-0.70: ******************************************************************************** 64358 |
|||
-0.60: ************************************************************************************ 67928 |
|||
-0.50: ***************************************************************************************** 71911 |
|||
-0.40: ********************************************************************************************* 75054 |
|||
-0.30: ************************************************************************************************ 77073 |
|||
-0.20: ************************************************************************************************** 78768 |
|||
-0.10: *************************************************************************************************** 79732 |
|||
0.00: **************************************************************************************************** 79952 |
|||
0.10: *************************************************************************************************** 79412 |
|||
0.20: ************************************************************************************************ 77511 |
|||
0.30: ********************************************************************************************* 74487 |
|||
0.40: ****************************************************************************************** 72250 |
|||
0.50: ************************************************************************************** 68789 |
|||
0.60: ******************************************************************************** 64408 |
|||
0.70: *************************************************************************** 60122 |
|||
0.80: ********************************************************************* 55619 |
|||
0.90: *************************************************************** 50869 |
|||
1.00: ********************************************************* 45883 |
|||
1.10: **************************************************** 41586 |
|||
1.20: ********************************************** 37145 |
|||
1.30: *************************************** 31715 |
|||
1.40: ********************************** 27779 |
|||
1.50: ****************************** 24270 |
|||
1.60: ************************* 20516 |
|||
1.70: ********************* 17221 |
|||
1.80: ***************** 14344 |
|||
1.90: ************** 11789 |
|||
2.00: ************ 9796 |
|||
2.10: ********* 7922 |
|||
2.20: ******* 6331 |
|||
2.30: ****** 5138 |
|||
2.40: ***** 4044 |
|||
2.50: *** 3065 |
|||
2.60: ** 2397 |
|||
2.70: ** 1846 |
|||
2.80: * 1462 |
|||
2.90: * 1001 |
|||
3.00: 765 |
|||
3.10: 587 |
|||
3.20: 393 |
|||
3.30: 299 |
|||
3.40: 197 |
|||
3.50: 132 |
|||
3.60: 100 |
|||
3.70: 74 |
|||
3.80: 59 |
|||
3.90: 32 |
|||
4.00: 29 |
|||
4.10: 12 |
|||
4.20: 15 |
|||
4.30: 6 |
|||
4.40: 3 |
|||
4.50: 4 |
|||
4.60: 3 |
|||
4.70: 2 |
|||
4.80: 1 |
|||
</pre> |
</pre> |
||