Last active
August 30, 2021 18:49
-
-
Save sausheong/c62cbb5b8f01c0d7dc64e696b17231b9 to your computer and use it in GitHub Desktop.
Estimations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"_, minmax, mean, var, skewness, kurtosis = stats.describe(points)\n", | |
"sd = math.sqrt(var)\n", | |
"\n", | |
"print(\"Tasks\")\n", | |
"print(\"-----\")\n", | |
"data[\"Total\"] = data.sum(axis=1).values\n", | |
"print(data.T)\n", | |
"print()\n", | |
"\n", | |
"print(\"Statistics\")\n", | |
"print(\"----------\")\n", | |
"print(\"minimum:\", \"%.1f\" % minmax[0], \"maximum:\", \n", | |
" \"%.1f\" % minmax[1])\n", | |
"print(\"mean:\", \"%.1f\" % mean)\n", | |
"print(\"standard deviation:\", \"%.1f\" % sd)\n", | |
"print(\"skewness:\", \"%.2f\" % skewness)\n", | |
"print(\"kurtosis:\", \"%.2f\" % kurtosis)\n", | |
"print()\n", | |
"\n", | |
"# prints out the probability\n", | |
"def print_probability(bins, mean, sd, experiments, fraction):\n", | |
" upper = len(np.where(bins <= mean + sd)[0])\n", | |
" lower = len(np.where(bins <= mean - sd)[0])\n", | |
" prob = (np.sum(n[:upper])-np.sum(n[:lower]))*100\n", | |
" print(\"* between\", \"%.1f\" % (mean-sd/2), \"and\", \n", | |
" \"%.1f\" % (mean+sd/2), \":\", \"%.1f%%\" % prob, \n", | |
" \"(within %sσ)\" % fraction)\n", | |
"\n", | |
"print(\"Probabilities\")\n", | |
"print(\"-------------\")\n", | |
"print_probability(bins, mean, sd/2, no_of_experiments, \"0.5\")\n", | |
"print_probability(bins, mean, sd, no_of_experiments, \"1\")\n", | |
"print_probability(bins, mean, 2*sd, no_of_experiments, \"2\")\n", | |
"print_probability(bins, mean, 3*sd, no_of_experiments, \"3\")" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.8" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment