{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 11 | INTRODUCTION TO DISTRIBUTIONS AND THEIR USE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

This chapter of an Introduction to Health Data Science by Dr JH Klopper is licensed under Attribution-NonCommercial-NoDerivatives 4.0 International

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This chapter introduces the topics of discrete and continuous distributions. Random variable values in a population and in a sample taken from a population follow _patterns_ with respect to how often single values (in the case of discrete variables) or an interval of values (in the case of continuous variables) occur. These _patterns_ are called distributions. The distributions of random variables are important because they are used to make inferences about the population from which a sample is taken." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Even statistics calculated from sample values follow, or are describe by, distributions. This chapter introduces these concepts and discusses the foundations of distributions and how they might be used in inferential statistics." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Packages used in this chapter" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following packages are used in this notebook. Note that no namespace abbreviations are used. This is a stylistic and grammatical choice." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import numpy\n", "from plotly import graph_objects, figure_factory\n", "import pandas\n", "from scipy import stats" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Variables" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first chapter introduced the concept of levels of measurement. A review of these levels is given below.\n", "\n", "- Categorical data type\n", " - __Nominal__: This is a type of data that is used to label variables without providing any quantitative value. It's the simplest form of data that isn’t measured but categorized. Nominal data can include names, labels, or categories, and cannot be arranged in any meaningful order. For example, the named of diseases (hypertension, diabetes, chronic obstructive airway disease).\n", " - __Ordinal__: This is a type of data that includes a set order or scale of values, allowing them to be sorted or ranked. However, the exact differences between the ranks may not be known or consistent. Ordinal data combines the characteristics of both nominal and interval data. An example of ordinal data is a customer satisfaction survey that asks customers to rate a service on a scale of _very unsatisfied_, _unsatisfied_, _neutral_, _satisfied_, or _very satisfied_. The data is categorical as with nominal data, but there is a clear order to the categories.\n", "- Numerical data type\n", " - __Interval__: This is a type of numerical data in which the difference between two values is meaningful and quantifiable, but there is no true zero point. This means that values can add and subtract with interval data, but multiplication and division do not have a meaningful interpretation. Examples of interval data include temperature measured in Celsius or Fahrenheit (because $0$ degrees does not imply _no temperature_), or the years on a calendar (because the year $0$ does not imply _no time_).\n", " - __Ratio-type__: This is the highest level of data measurement. With ratio-type data, values can add, subtract, multiply, and divide, and statements about ratios are meaningful. Examples of ratio data include height, weight, age, or distance, where zero indicates the absence of the attribute being measured. For example, a weight of $0$ punds means there is no weight, and a distance of $0$ miles means there is no distance." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Chapter 5 introduced the concept of variables. These are the names given to a specific instance of data that is measured or collected. These names are used in the first row of a spreadsheet file that is in long-format (tidy data). The data captured for each observations is the same level of measurement, but the values may be different. For example, the variable _age_ may be used to capture the age of a patient. The variable _age_ is the same for each patient, but the value of the variable is different for each patient." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A __random variable__ is a function that maps the outcomes of random processes to numerical values. In this sense, the age of a randomly selected person is a random variable. The age of a randomly selected person is a random variable because the age of the person is unknown until the person is selected. The age of the person is a random variable because the age is a numerical value that is mapped to the outcome of a random process (selecting a person at random)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are two types of random variables.\n", "\n", "- __Discrete random variable__: A discrete random variable is a random variable that can take on a countable number of values. For example, the number of patients in a hospital is a discrete random variable because the number of patients can only be a positive integer. The number of patients in a hospital cannot be $1.5$ or $-2$.\n", "- __Continuous random variable__: A continuous random variable is a random variable that can take on an uncountable number of values. For example, the weight of a patient is a continuous random variable because the weight of a patient can be any real number. The weight of a patient can be $203.2$ or $123.5$ pounds." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Discrete random variables are used to model count data. Continuous random variables are used to model measurement data. In the case of a nominal variable, the variable is discrete because the number of categories is countable. In the case of an ordinal variable, the variable is discrete because the number of categories is countable. In the case of an interval variable, the variable is continuous because the number of values is uncountable. In the case of a ratio-type variable, the variable is continuous because the number of values is uncountable." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The values of a random variable are called __realizations__. For example, the age of a randomly selected person is a random variable. The age of the person is a realization of the random variable. The number of patients in a hospital is a random variable. The number of patients with diabetes in an surgical ward is a realization of the random variable. Note that in this case of the number of patients with diabetes, the variable that might be used is a spreadsheet is _Diabetes_ and the values that are captured in the data might be _Yes_ or _No_. The number of patients with diabetes is a random variable, though." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Statistical analysis is used in terms of random variables. A random process occurs and a random variables maps the outcome of this process to a number. There are two important defintions in relation to random processes.\n", "\n", "- __Random experiment__: A random experiment is a process or procedure that leads to one of several possible outcomes. The outcome is not known in advance and will vary when the experiment is repeated under the same conditions. Examples of random experiments include flipping a coin, rolling a die, or drawing a card from a deck.\n", "- __Trial__: A trial refers to each occasion when a random experiment is carried out. For example, if you flip a coin 10 times, each individual coin flip is considered a trial. The result of each trial is an outcome. In this case, the outcome of each trial could be a head or a tail." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The __sample space__ of a random experiment is the set of all possible outcomes of that experiment. It is usually denoted by the letter $S$ or the Greek letter $\\Sigma$. For example, if a coin is flipped, the sample space is the set of values $\\Omega= \\{\\text{Heads}, \\text{Tails}\\}$. If a six-sided die is rolled, the sample space is $S=\\{1, 2, 3, 4, 5, 6\\}$. For a more complex experiment, such as the flipping of two coins, the sample space would be $\\Omega=\\{ (\\text{Heads}, \\text{Heads}), (\\text{Heads}, \\text{Tails}), (\\text{Tails}, \\text{Heads}), (\\text{Tails}, \\text{Tails})\\}$. Each individual outcome in the sample space is called a sample point. The sample space should include all outcomes that are possible to occur." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Distributions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Discrete random variables" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Consider a trial that roles two fair six-sided dice and add the two values that land face up. The fact that the dice are fair means that each of the six faces has an equal likelihood of landing face up. The sample space of each trial is $\\Omega = \\{ 2,3,4,5,6,7,8,9,10,11,12\\}$. A random experiment might be to roll the dice $1000$ times (the trial is repeated $1000$ times). This can be simulated with Python code." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The code below seeds the numpy pseudo-random number generator with the integer $28$. The pseudo-random values that are generated produces repeatable results. For every integer used, the same values will be returned. An empty Python list is created and then a for loop is used to create to random values on the interval $[1,6]$ that are added and appended to the list." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Seed the random number generator with a known value\n", "numpy.random.seed(28)\n", "\n", "# Create a empty list named \"results\" to store the results\n", "results = []\n", "\n", "# Create a for loop to roll the dice 1000 times\n", "for _ in range(1000):\n", " results.append(numpy.random.randint(1, 7) + numpy.random.randint(1, 7))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The commented code below shows a more compact way to generate the same list of values. The code uses a list comprehension to generate the list of values." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "# Seed the random number generator with a known value\n", "numpy.random.seed(0)\n", "\n", "# Select two ramdom integers between 1 and 6 and add them\n", "def roll_dice():\n", " return numpy.random.randint(1, 7) + numpy.random.randint(1, 7)\n", "\n", "# Roll the dice 1000 times and store the results\n", "rolls = [roll_dice() for _ in range(1000)]\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A dataframe object is created from the results." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Convert the numpy array to a pandas DataFrame\n", "results = pandas.DataFrame(results, columns=['Value'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A second dataframe object is created to hold the results of the `value_counts` method applied to the first dataframe. The `value_counts` method returns a series object that contains the number of times each value occurs in the dataframe. The `sort_index` method is used to sort the series by the index values." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " count\n", "Value \n", "2 24\n", "3 39\n", "4 93\n", "5 108\n", "6 121\n", "7 183\n", "8 152\n", "9 105\n", "10 103\n", "11 53\n", "12 19\n" ] } ], "source": [ "# Create a DataFrame object from the value counts and sort the index\n", "value_counts = pandas.DataFrame(results['Value'].value_counts()).sort_index()\n", "\n", "# Print the series object to the screen\n", "print(value_counts)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A bar plot shows the number of times each value occurs in the dataframe. The bar plot shows that the value $7$ occurs most often and the values $2$ and $12$ occur least often." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "text": [ 24, 39, 93, 108, 121, 183, 152, 105, 103, 53, 19 ], "textposition": "auto", "type": "bar", "x": [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], "y": [ 24, 39, 93, 108, 121, 183, 152, 105, 103, 53, 19 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Value Counts for 1000 Dice Rolls" }, "width": 700, "xaxis": { "title": { "text": "Dice Value" } }, "yaxis": { "title": { "text": "Count" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create a bar chart of the value counts\n", "fig = graph_objects.Figure(\n", " graph_objects.Bar(\n", " x=value_counts.index.to_list(),\n", " y=value_counts.values[:, 0],\n", " text=value_counts.values[:, 0],\n", " textposition='auto'\n", " )\n", ")\n", "\n", "# Update the layout to improve readability\n", "fig.update_layout(\n", " title='Value Counts for 1000 Dice Rolls',\n", " xaxis_title='Dice Value',\n", " yaxis_title='Count',\n", " width=700,\n", ")\n", "\n", "# Display the plot\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the case of this experiment the random variable, $X$, is the sum of the two values that land face up. The random variable is discrete because the number of possible values is countable (an integer). It can also be stated that the random variable is discrete because the values are finite and that the random variable is discrete because the values are not continuous." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The random variable $X$ can take on the values $2,3,4,5,6,7,8,9,10,11,12$. The probability that the random variable takes on a specific value is called the __probability mass function__ (PMF). The PMF is denoted by $f(x)$ and is defined as $P \\left( X=x \\right)$, where $x$ can take any value $2,3,4,5,6,7,8,9,10,11,12$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this simple case of a discrete random variable, the PMF can be calculated by dividing the number of times a value occurs by the total number of trials. For example, the value $7$ occurs $165$ times in the dataframe. The total number of trials is $1000$. The PMF for the value $7$ is calculated below." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
count
Value
224
339
493
5108
6121
7183
8152
9105
10103
1153
1219
\n", "
" ], "text/plain": [ " count\n", "Value \n", "2 24\n", "3 39\n", "4 93\n", "5 108\n", "6 121\n", "7 183\n", "8 152\n", "9 105\n", "10 103\n", "11 53\n", "12 19" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Experimental probability mass function of the two-dice sum distribution\n", "value_counts" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Probability of rolling a 7: 0.183\n" ] } ], "source": [ "# Calculate the probability of rolling a 7 in this experiment\n", "print('Probability of rolling a 7:', value_counts.iloc[5].values.tolist()[0] / 1000)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The bar plot below visualizes the probability mass function." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "type": "bar", "x": [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], "y": [ 0.024, 0.039, 0.093, 0.108, 0.121, 0.183, 0.152, 0.105, 0.103, 0.053, 0.019 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Visualizing the Probabilities" }, "width": 700, "xaxis": { "title": { "text": "Dice Value" } }, "yaxis": { "title": { "text": "Probability (proportion)" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create a bar chart of the value counts\n", "fig = graph_objects.Figure(\n", " graph_objects.Bar(\n", " x=value_counts.index.to_list(),\n", " y=value_counts.values[:, 0] / 1000\n", " )\n", ")\n", "\n", "# Update the layout to improve readability\n", "fig.update_layout(\n", " title='Visualizing the Probabilities',\n", " xaxis_title='Dice Value',\n", " yaxis_title='Probability (proportion)',\n", " width=700\n", ")\n", "\n", "# Display the plot\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that the probabilities are simply proportions. Each probability is on the interval $[0,1]$ and all the probabilities sum to $1$. An experiemnt such as this takes a sample ($1000$ trials here). The probabilities are estimates of a theoretical probability mass function. The estimates PMF (using the data from this experiment) is shown below in (1). The hat, $\\hat{}$, on the $P$ denotes that the probabilities are estimates." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\hat{P}(X=x) = \\begin{cases} 0.032 &\\text{ if } x = 2 \\\\ 0.051 &\\text{ if } x = 3 \\\\ 0.074 &\\text{ if } x = 4 \\\\ 0.13 &\\text{ if } x = 5 \\\\ 0.126 &\\text{ if } x = 6 \\\\ 0.165 &\\text{ if } x = 7 \\\\ 0.0146 &\\text{ if } x = 8 \\\\ 0.106 &\\text{ if } x = 9 \\\\ 0.09 &\\text{ if } x = 10 \\\\ 0.049 &\\text{ if } x = 11 \\\\ 0.031 &\\text{ if } x = 12 \\end{cases} \\tag{1}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There is only a single way to roll a $2$ and that is a $1$ and a $1$. There are two ways to roll as $3$ and that is a $1$ and a $2$ or a $2$ and a $1$. The sum of $7$ can be rolled in six ways. In total there are $36$ possibilities. The theoretical PMF is given below in (2)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "P(X=x) = \\begin{cases} \\frac{1}{36} &\\text{ if } x = 2 \\\\ \\frac{2}{36} &\\text{ if } x = 3 \\\\ \\frac{3}{36} &\\text{ if } x = 4 \\\\ \\frac{4}{36} &\\text{ if } x = 5 \\\\ \\frac{5}{36} &\\text{ if } x = 6 \\\\ \\frac{6}{36} &\\text{ if } x = 7 \\\\ \\frac{5}{36} &\\text{ if } x = 8 \\\\ \\frac{4}{36} &\\text{ if } x = 9 \\\\ \\frac{3}{36} &\\text{ if } x = 10 \\\\ \\frac{2}{36} &\\text{ if } x = 11 \\\\ \\frac{1}{36} &\\text{ if } x = 12 \\end{cases} \\tag{2}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The theoretical PMF is visualized below." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "type": "bar", "x": [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], "y": [ 0.027777777777777776, 0.05555555555555555, 0.08333333333333333, 0.1111111111111111, 0.1388888888888889, 0.16666666666666666, 0.1388888888888889, 0.1111111111111111, 0.08333333333333333, 0.05555555555555555, 0.027777777777777776 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Visualizing the PMF" }, "width": 700, "xaxis": { "title": { "text": "Dice Value" } }, "yaxis": { "title": { "text": "Probability (proportion)" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create a bar chart of the value counts\n", "fig = graph_objects.Figure(\n", " graph_objects.Bar(\n", " x=numpy.arange(2,13),\n", " y=numpy.array([1,2,3,4,5,6,5,4,3,2,1]) / 36\n", " )\n", ")\n", "\n", "# Update the layout to improve readability\n", "fig.update_layout(\n", " title='Visualizing the PMF',\n", " xaxis_title='Dice Value',\n", " yaxis_title='Probability (proportion)',\n", " width=700\n", ")\n", "\n", "# Display the plot\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using the theoretical PMF it is possible to ask questions such as: _What is the probability of rolling a value of_ $10$ _or more?_ Since the outcome of each trial is independent, the individual probabilities can be added together. The probability of rolling a value of $10$ or more is $P(X=10) + P(X=11) + P(X=12)$. The probability sums to $0.167$ and is visualized below." ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": [ "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "crimson", "crimson", "crimson" ] }, "type": "bar", "x": [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], "y": [ 0.027777777777777776, 0.05555555555555555, 0.08333333333333333, 0.1111111111111111, 0.1388888888888889, 0.16666666666666666, 0.1388888888888889, 0.1111111111111111, 0.08333333333333333, 0.05555555555555555, 0.027777777777777776 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Probability of rolling a 10 or more (red)" }, "width": 700, "xaxis": { "title": { "text": "Dice Value" } }, "yaxis": { "title": { "text": "Probability (proportion)" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Generate bar colors\n", "colors = ['lightslategray',] * 11\n", "colors[8] = 'crimson'\n", "colors[9] = 'crimson'\n", "colors[10] = 'crimson'\n", "\n", "\n", "# Create a bar chart of the value counts\n", "fig = graph_objects.Figure(\n", " graph_objects.Bar(\n", " x=numpy.arange(2,13),\n", " y=numpy.array([1,2,3,4,5,6,5,4,3,2,1]) / 36,\n", " marker_color=colors\n", " )\n", ")\n", "\n", "# Update the layout to improve readability\n", "fig.update_layout(\n", " title='Probability of rolling a 10 or more (red)',\n", " xaxis_title='Dice Value',\n", " yaxis_title='Probability (proportion)',\n", " width=700\n", ")\n", "\n", "# Display the plot\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Continuous random variables" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Continuous variables can take on an infinite number of values. This is because these values are real numbers. The probability that a continuous random variable takes on a specific value is zero. For example, the probability that a patient's weight is exactly $150$ pounds is zero. The probability that a patient's weight is between $150$ and $151$ pounds is not zero. It is only possible to consider the probability that a continuous random variable is within a range of values." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Instead of a probability mass function, a continuous random variable has a __probability density function__ (PDF). The PDF is denoted by $f(x)$ and is defined as $P \\left( a \\leq X \\leq b \\right)$, where $a$ and $b$ are real numbers. The PDF is the area under the curve of the PDF between $a$ and $b$. The probability that a patient's weight is between $150$ and $151$ pounds is the area under the probability density function (PDF) between $150$ and $151$ pounds." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The normal distribution is perhaps the best know distribution for a continuous random variable. The normal distribution is defined by two parameters, the mean, $\\mu$, and the standard deviation, $\\sigma$. The mean is the center of the distribution and the standard deviation is a measure of the spread of the distribution. The normal distribution is denoted by $N(\\mu, \\sigma)$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The code cell below creates a numpy array of $10000$ values, taken from a normal distribution, $N(\\mu=100, \\sigma=10)$ and plots the probability density function." ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "legendgroup": "Values", "marker": { "color": "rgb(31, 119, 180)" }, "mode": "lines", "name": "Values", "showlegend": true, "type": "scatter", "x": [ 57.41290622025573, 57.57801246058677, 57.743118700917805, 57.90822494124885, 58.07333118157989, 58.23843742191092, 58.403543662241965, 58.56864990257301, 58.73375614290404, 58.898862383235084, 59.063968623566126, 59.22907486389716, 59.3941811042282, 59.559287344559245, 59.72439358489028, 59.88949982522132, 60.05460606555236, 60.2197123058834, 60.38481854621444, 60.54992478654548, 60.71503102687652, 60.88013726720756, 61.0452435075386, 61.210349747869635, 61.37545598820068, 61.54056222853172, 61.705668468862754, 61.870774709193796, 62.03588094952484, 62.20098718985588, 62.366093430186915, 62.53119967051796, 62.69630591084899, 62.86141215118003, 63.026518391511075, 63.19162463184212, 63.35673087217315, 63.521837112504194, 63.68694335283523, 63.85204959316627, 64.01715583349731, 64.18226207382835, 64.3473683141594, 64.51247455449042, 64.67758079482147, 64.84268703515251, 65.00779327548355, 65.17289951581459, 65.33800575614563, 65.50311199647666, 65.6682182368077, 65.83332447713875, 65.99843071746979, 66.16353695780083, 66.32864319813187, 66.4937494384629, 66.65885567879394, 66.82396191912498, 66.98906815945602, 67.15417439978707, 67.31928064011811, 67.48438688044914, 67.64949312078018, 67.81459936111122, 67.97970560144226, 68.1448118417733, 68.30991808210435, 68.47502432243539, 68.64013056276642, 68.80523680309746, 68.9703430434285, 69.13544928375954, 69.30055552409058, 69.46566176442163, 69.63076800475265, 69.7958742450837, 69.96098048541474, 70.12608672574578, 70.29119296607682, 70.45629920640786, 70.62140544673889, 70.78651168706993, 70.95161792740097, 71.11672416773202, 71.28183040806306, 71.4469366483941, 71.61204288872513, 71.77714912905617, 71.94225536938721, 72.10736160971825, 72.2724678500493, 72.43757409038034, 72.60268033071137, 72.76778657104241, 72.93289281137345, 73.09799905170449, 73.26310529203553, 73.42821153236656, 73.59331777269762, 73.75842401302864, 73.92353025335969, 74.08863649369073, 74.25374273402177, 74.41884897435281, 74.58395521468384, 74.74906145501488, 74.91416769534592, 75.07927393567697, 75.24438017600801, 75.40948641633904, 75.57459265667008, 75.73969889700112, 75.90480513733216, 76.0699113776632, 76.23501761799425, 76.40012385832529, 76.56523009865631, 76.73033633898736, 76.8954425793184, 77.06054881964944, 77.22565505998048, 77.39076130031152, 77.55586754064257, 77.7209737809736, 77.88608002130464, 78.05118626163568, 78.21629250196672, 78.38139874229776, 78.54650498262879, 78.71161122295983, 78.87671746329087, 79.04182370362192, 79.20692994395296, 79.372036184284, 79.53714242461504, 79.70224866494607, 79.86735490527711, 80.03246114560815, 80.1975673859392, 80.36267362627024, 80.52777986660126, 80.69288610693232, 80.85799234726335, 81.02309858759439, 81.18820482792543, 81.35331106825646, 81.51841730858752, 81.68352354891854, 81.84862978924959, 82.01373602958063, 82.17884226991167, 82.34394851024271, 82.50905475057374, 82.6741609909048, 82.83926723123582, 83.00437347156686, 83.1694797118979, 83.33458595222895, 83.49969219255999, 83.66479843289102, 83.82990467322206, 83.9950109135531, 84.16011715388414, 84.32522339421519, 84.49032963454621, 84.65543587487727, 84.8205421152083, 84.98564835553934, 85.15075459587038, 85.31586083620142, 85.48096707653247, 85.6460733168635, 85.81117955719454, 85.97628579752558, 86.14139203785662, 86.30649827818766, 86.4716045185187, 86.63671075884974, 86.80181699918077, 86.96692323951181, 87.13202947984286, 87.2971357201739, 87.46224196050494, 87.62734820083597, 87.79245444116701, 87.95756068149805, 88.1226669218291, 88.28777316216014, 88.45287940249116, 88.61798564282222, 88.78309188315325, 88.94819812348429, 89.11330436381533, 89.27841060414637, 89.44351684447741, 89.60862308480844, 89.7737293251395, 89.93883556547053, 90.10394180580157, 90.26904804613261, 90.43415428646364, 90.5992605267947, 90.76436676712572, 90.92947300745676, 91.0945792477878, 91.25968548811883, 91.42479172844989, 91.58989796878093, 91.75500420911197, 91.920110449443, 92.08521668977404, 92.25032293010509, 92.41542917043613, 92.58053541076717, 92.7456416510982, 92.91074789142924, 93.07585413176028, 93.24096037209132, 93.40606661242236, 93.57117285275339, 93.73627909308443, 93.90138533341548, 94.06649157374653, 94.23159781407756, 94.3967040544086, 94.56181029473964, 94.72691653507067, 94.89202277540173, 95.05712901573276, 95.2222352560638, 95.38734149639484, 95.55244773672587, 95.71755397705692, 95.88266021738795, 96.04776645771899, 96.21287269805003, 96.37797893838108, 96.54308517871212, 96.70819141904315, 96.8732976593742, 97.03840389970523, 97.20351014003627, 97.36861638036731, 97.53372262069834, 97.6988288610294, 97.86393510136043, 98.02904134169147, 98.19414758202251, 98.35925382235354, 98.5243600626846, 98.68946630301562, 98.85457254334668, 99.0196787836777, 99.18478502400875, 99.34989126433979, 99.51499750467082, 99.68010374500187, 99.8452099853329, 100.01031622566394, 100.17542246599498, 100.34052870632601, 100.50563494665707, 100.6707411869881, 100.83584742731915, 101.00095366765018, 101.16605990798122, 101.33116614831226, 101.4962723886433, 101.66137862897435, 101.82648486930538, 101.99159110963642, 102.15669734996746, 102.3218035902985, 102.48690983062954, 102.65201607096057, 102.81712231129161, 102.98222855162265, 103.14733479195371, 103.31244103228474, 103.47754727261578, 103.64265351294682, 103.80775975327785, 103.9728659936089, 104.13797223393993, 104.30307847427098, 104.46818471460202, 104.63329095493305, 104.7983971952641, 104.96350343559513, 105.12860967592617, 105.29371591625721, 105.45882215658824, 105.6239283969193, 105.78903463725032, 105.95414087758138, 106.11924711791241, 106.28435335824345, 106.44945959857449, 106.61456583890552, 106.77967207923658, 106.9447783195676, 107.10988455989865, 107.27499080022969, 107.44009704056072, 107.60520328089177, 107.7703095212228, 107.93541576155386, 108.10052200188488, 108.26562824221593, 108.43073448254697, 108.595840722878, 108.76094696320905, 108.92605320354008, 109.09115944387112, 109.25626568420216, 109.42137192453319, 109.58647816486425, 109.75158440519527, 109.91669064552632, 110.08179688585736, 110.2469031261884, 110.41200936651944, 110.57711560685048, 110.74222184718153, 110.90732808751255, 111.07243432784361, 111.23754056817464, 111.40264680850568, 111.56775304883672, 111.73285928916775, 111.8979655294988, 112.06307176982983, 112.22817801016087, 112.39328425049192, 112.55839049082296, 112.723496731154, 112.88860297148503, 113.05370921181608, 113.21881545214711, 113.38392169247815, 113.5490279328092, 113.71413417314022, 113.87924041347128, 114.04434665380231, 114.20945289413335, 114.37455913446439, 114.53966537479542, 114.70477161512648, 114.8698778554575, 115.03498409578856, 115.20009033611959, 115.36519657645063, 115.53030281678167, 115.6954090571127, 115.86051529744375, 116.02562153777478, 116.19072777810582, 116.35583401843687, 116.5209402587679, 116.68604649909895, 116.85115273942998, 117.01625897976102, 117.18136522009206, 117.3464714604231, 117.51157770075415, 117.67668394108519, 117.84179018141623, 118.00689642174726, 118.1720026620783, 118.33710890240934, 118.50221514274038, 118.66732138307142, 118.83242762340245, 118.9975338637335, 119.16264010406454, 119.32774634439558, 119.49285258472662, 119.65795882505766, 119.8230650653887, 119.98817130571973, 120.15327754605079, 120.31838378638182, 120.48349002671286, 120.6485962670439, 120.81370250737493, 120.97880874770598, 121.14391498803701, 121.30902122836805, 121.4741274686991, 121.63923370903012, 121.80433994936118, 121.9694461896922, 122.13455243002326, 122.29965867035429, 122.46476491068532, 122.62987115101637, 122.7949773913474, 122.96008363167843, 123.12518987200949, 123.29029611234054, 123.45540235267157, 123.62050859300263, 123.78561483333365, 123.95072107366468, 124.11582731399574, 124.28093355432677, 124.44603979465779, 124.61114603498885, 124.77625227531988, 124.94135851565093, 125.10646475598196, 125.27157099631302, 125.43667723664404, 125.60178347697507, 125.76688971730613, 125.93199595763716, 126.09710219796821, 126.26220843829924, 126.4273146786303, 126.59242091896132, 126.75752715929235, 126.92263339962341, 127.08773963995444, 127.25284588028546, 127.41795212061652, 127.58305836094755, 127.7481646012786, 127.91327084160963, 128.0783770819407, 128.24348332227171, 128.40858956260274, 128.5736958029338, 128.73880204326483, 128.90390828359588, 129.0690145239269, 129.23412076425797, 129.399227004589, 129.56433324492002, 129.72943948525108, 129.8945457255821, 130.05965196591313, 130.2247582062442, 130.38986444657525, 130.55497068690627, 130.72007692723733, 130.88518316756836, 131.05028940789938, 131.2153956482304, 131.38050188856147, 131.5456081288925, 131.71071436922355, 131.87582060955458, 132.04092684988564, 132.20603309021666, 132.37113933054772, 132.53624557087875, 132.70135181120978, 132.86645805154083, 133.03156429187186, 133.19667053220292, 133.36177677253394, 133.526883012865, 133.69198925319603, 133.85709549352705, 134.0222017338581, 134.18730797418914, 134.35241421452017, 134.51752045485122, 134.68262669518225, 134.8477329355133, 135.01283917584433, 135.1779454161754, 135.34305165650642, 135.50815789683745, 135.6732641371685, 135.83837037749953, 136.0034766178306, 136.1685828581616, 136.33368909849267, 136.4987953388237, 136.66390157915473, 136.82900781948578, 136.9941140598168, 137.15922030014787, 137.3243265404789, 137.48943278080995, 137.65453902114098, 137.819645261472, 137.98475150180306, 138.1498577421341, 138.31496398246512, 138.48007022279617, 138.6451764631272, 138.81028270345826, 138.97538894378928, 139.14049518412034, 139.30560142445137, 139.4707076647824, 139.63581390511345, 139.80092014544448 ], "xaxis": "x", "y": [ 0.000004818526547795933, 0.0000051675020865092525, 0.000005540244309152496, 0.0000059382574606163535, 0.000006363132707972938, 0.000006816552591810867, 0.000007300295668007943, 0.000007816241345723064, 0.000008366374927414531, 0.000008952792856707563, 0.000009577708179935246, 0.000010243456227167905, 0.000010952500518522063, 0.00001170743890150048, 0.000012511009925060906, 0.000013366099456041285, 0.00001427574754347808, 0.000015243155536249924, 0.000016271693459351198, 0.000017364907653951315, 0.00001852652868623015, 0.000019760479529784703, 0.000021070884026189586, 0.000022462075628052634, 0.000023938606428641925, 0.000025505256481866792, 0.000027167043416076167, 0.000028929232344787473, 0.000030797346077079215, 0.00003277717562997142, 0.00003487479104467474, 0.00003709655250811373, 0.00003944912178062107, 0.000041939473930156, 0.00004457490937281953, 0.00004736306621882445, 0.00005031193292242462, 0.00005342986123361818, 0.000056725579448705574, 0.00006020820595602425, 0.00006388726307236144, 0.00006777269116470937, 0.00007187486305113368, 0.00007620459867359596, 0.00008077318003460687, 0.00008559236638856778, 0.000090674409677618, 0.0000960320702007053, 0.0001016786325034685, 0.00010762792147534856, 0.00011389431863914048, 0.00012049277861693353, 0.00012743884575512458, 0.00013474867088984288, 0.00014243902823278437, 0.00015052733235604727, 0.00015903165525315595, 0.00016797074345197496, 0.00017736403515376727, 0.00018723167737111278, 0.0001975945430358793, 0.00020847424804688628, 0.00021989316822531817, 0.00023187445614434926, 0.0002444420577978572, 0.0002576207290714616, 0.0002714360519775231, 0.0002859144506141025, 0.0003010832068062629, 0.00031697047538648964, 0.000333605299069366, 0.00035101762287409477, 0.0003692383080468475, 0.0003882991454333855, 0.0004082328682508797, 0.000429073164206379, 0.00045085468690789617, 0.0004736130665127475, 0.0004973849195563612, 0.0005222078579035405, 0.0005481204967628932, 0.0005751624617040498, 0.0006033743946161163, 0.0006327979585449261, 0.0006634758413456655, 0.0006954517580866708, 0.0007287704521395048, 0.0007634776948897998, 0.0007996202840028714, 0.0008372460401778135, 0.000876403802323476, 0.0009171434210897181, 0.0009595157506873307, 0.0010035726389302964, 0.0010493669154343283, 0.0010969523779062846, 0.0011463837764596572, 0.0011977167958922416, 0.001251008035863214, 0.0013063149889079191, 0.0013636960162304443, 0.001423210321215236, 0.0014849179206013125, 0.0015488796132643722, 0.0016151569465544784, 0.0016838121801395014, 0.0017549082473070816, 0.0018285087136809517, 0.0019046777333104553, 0.001983480002095541, 0.0020649807085131085, 0.002149245481614278, 0.0022363403362664425, 0.0023263316156179503, 0.0024192859307679507, 0.0025152700976285775, 0.0026143510709716036, 0.0027165958756568366, 0.002822071535044836, 0.0029308449966022653, 0.003042983054713754, 0.003158552270720271, 0.003277618890210082, 0.003400248757594679, 0.003526507228008741, 0.003656459076579477, 0.0037901684051180433, 0.003927698546292159, 0.00406911196534647, 0.004214470159444291, 0.004363833554711507, 0.004517261401071151, 0.004674811664964208, 0.004836540920059977, 0.0050025042360667266, 0.005172755065761051, 0.005347345130361787, 0.0055263243033818335, 0.005709740493099013, 0.005897639523794238, 0.006090065015912764, 0.006287058265311686, 0.0064886581217635415, 0.006694900866893881, 0.00690582009173605, 0.007121446574094608, 0.007341808155914287, 0.007566929620857682, 0.007796832572301758, 0.008031535311967366, 0.008271052719403042, 0.008515396132548198, 0.008764573229606193, 0.009018587912462041, 0.009277440191882947, 0.009541126074744827, 0.009809637453529023, 0.010082961998338262, 0.01036108305168157, 0.010643979526280361, 0.010931625806148992, 0.011223991651203434, 0.01152104210565258, 0.011822737410425537, 0.012129032919887846, 0.0124398790230978, 0.012755221069851483, 0.013074999301763845, 0.013399148788627375, 0.013727599370288496, 0.014060275604275321, 0.014397096719406107, 0.01473797657560173, 0.015082823630118362, 0.01543154091041068, 0.015784025993826653, 0.016140170994327713, 0.01649986255641841, 0.016862981856460253, 0.017229404611534396, 0.017599001096006244, 0.017971636165934668, 0.018347169291455766, 0.01872545459725865, 0.019106340911258284, 0.019489671821555678, 0.01987528574176316, 0.02026301598475664, 0.020652690844902486, 0.02104413368879148, 0.021437163054495396, 0.0218315927593481, 0.02222723201623329, 0.022623885558347854, 0.023021353772390295, 0.023419432840107998, 0.02381791488811951, 0.024216588145909927, 0.024615237111882026, 0.02501364272732512, 0.025411582558149452, 0.025808830984214274, 0.02620515939606068, 0.02660033639884459, 0.026994128023245596, 0.027386297943113102, 0.02777660769959317, 0.028164816931462996, 0.028550683611385855, 0.028933964287781243, 0.029314414331992347, 0.029691788190416443, 0.030065839641251386, 0.030436322055496786, 0.03080298866183594, 0.031165592815012844, 0.03152388826730604, 0.031877629442691756, 0.03222657171327737, 0.03257047167757783, 0.032909087440199256, 0.03324217889248571, 0.033569507993679776, 0.033890839052140256, 0.03420593900615737, 0.034514577703899756, 0.034816528182027066, 0.035111566942498604, 0.03539947422710751, 0.03568003428927171, 0.035953035662611904, 0.03621827142585087, 0.036475539463570926, 0.03672464272237009, 0.03696538946196462, 0.037197593500789515, 0.037421074455658336, 0.037635657975050425, 0.03784117596560389, 0.03803746681140286, 0.03822437558565844, 0.03840175425439628, 0.03856946187177505, 0.038727364766676056, 0.038875336720217896, 0.039013259133866114, 0.03914102118782497, 0.03925851998941461, 0.03936566071115614, 0.039462356718304774, 0.03954852968559115, 0.03962410970295071, 0.039689035370041065, 0.03974325387936878, 0.039786721087867793, 0.03981940157679377, 0.039841268699820645, 0.039852304619247846, 0.03985250033024941, 0.03984185567311873, 0.03982037933348581, 0.03978808883050635, 0.03974501049304548, 0.0396911794239011, 0.03962663945213522, 0.039551443073603657, 0.03946565137979713, 0.039369333975128956, 0.0392625688828258, 0.03914544243959983, 0.03901804917930118, 0.0388804917057704, 0.03873288055512995, 0.03857533404777383, 0.03840797813033244, 0.038230946207908234, 0.038044378966895095, 0.03784842418871048, 0.03764323655478579, 0.03742897744317452, 0.03720581471715329, 0.036973922506202274, 0.03673348097976518, 0.036484676114200275, 0.03622769945334295, 0.03596274786311213, 0.03569002328059883, 0.03540973245808428, 0.03512208670244097, 0.034827301610374554, 0.03452559679997069, 0.034217195639012085, 0.03390232497053485, 0.03358121483609414, 0.03325409819720833, 0.032921210655452074, 0.032582790171664294, 0.03223907678473709, 0.03189031233044519, 0.0315367401607724, 0.031178604864186013, 0.030816151987301425, 0.030449627758374957, 0.030079278813051443, 0.029705351922785787, 0.029328093726347655, 0.028947750464806025, 0.028564567720381826, 0.02817879015954114, 0.027790661280692148, 0.027400423166832683, 0.027008316243482766, 0.026614579042222353, 0.02621944797013716, 0.025823157085463358, 0.0254259378797029, 0.025028019066466695, 0.024629626377286603, 0.02423098236461812, 0.023832306212242114, 0.023433813553253153, 0.02303571629580717, 0.02263822245678244, 0.022241536003490867, 0.02184585670355892, 0.021451379983079888, 0.021058296793122693, 0.02066679348466316, 0.020277051691989553, 0.019889248224614343, 0.019503554967709277, 0.01912013879106444, 0.018739161466554237, 0.018360779594080195, 0.01798514453594246, 0.017612402359578633, 0.01724269378859349, 0.016876154161988656, 0.01651291340148914, 0.016153095986847985, 0.01579682093900102, 0.015444201810928773, 0.01509534668607268, 0.014750358184142163, 0.014409333474136927, 0.014072364294402092, 0.013739536979521884, 0.013410932493850811, 0.013086626471473595, 0.012766689262376126, 0.012451185984606135, 0.012140176582192953, 0.01183371588859374, 0.01153185369542637, 0.01123463482624644, 0.01094209921512276, 0.010654281989761257, 0.010371213558927448, 0.01009291970391381, 0.00981942167379879, 0.009550736284243562, 0.009286876019571861, 0.009027849137880564, 0.008773659778928156, 0.008524308074551179, 0.008279790261360305, 0.008040098795470704, 0.007805222469024227, 0.007575146528264605, 0.007349852792931098, 0.00712931977673968, 0.006913522808726385, 0.006702434155231979, 0.006496023142312568, 0.00629425627836686, 0.006097097376775998, 0.005904507678358904, 0.0057164459734519646, 0.005532868723428851, 0.005353730181482953, 0.005178982512501899, 0.005008575911871213, 0.0048424587230503835, 0.004680577553773517, 0.00452287739073269, 0.004369301712610584, 0.004219792601336366, 0.004074290851445689, 0.003932736077434453, 0.003795066819002251, 0.003661220644089704, 0.0035311342496212763, 0.003404743559871968, 0.003281983822384558, 0.00316278970137012, 0.003047095368532695, 0.002934834591265234, 0.002825940818170884, 0.0027203472618706906, 0.002617986979064957, 0.002518792947821853, 0.0024226981420731666, 0.0023296356033032056, 0.002239538509422029, 0.002152340240820583, 0.0020679744436101015, 0.001986375090053341, 0.0019074765362005548, 0.0018312135767474388, 0.0017575214971367551, 0.0016863361229301401, 0.0016175938664798684, 0.0015512317709349872, 0.0014871875516190634, 0.001425399634820835, 0.0013658071940417646, 0.0013083501837474786, 0.0012529693706730901, 0.0011996063627343534, 0.0011482036355994875, 0.0010987045569779464, 0.0010510534086847977, 0.0010051954065407015, 0.0009610767181689256, 0.0009186444787523589, 0.0008778468048142628, 0.00083863280608746, 0.00080095259553756, 0.0007647572976060011, 0.000729999054739481, 0.0006966310322721523, 0.0006646074217273693, 0.0006338834426054977, 0.0006044153427240574, 0.0005761603971763495, 0.0005490769059739084, 0.0005231241904378829, 0.0004982625884034148, 0.00047445344830057494, 0.00045165912217431887, 0.00042984295770496855, 0.0004089692892897507, 0.0003890034282446575, 0.00036991165218469487, 0.00035166119363934693, 0.00033422022795872664, 0.00031755786056439367, 0.0003016441135975421, 0.0002864499120156191, 0.00027194706918703054, 0.0002581082720319484, 0.000244907065755774, 0.00023231783822008138, 0.0002203158039944115, 0.00020887698813051693, 0.0001979782096991831, 0.0001875970651279906, 0.0001777119113768814, 0.00016830184898669959, 0.00015934670503428282, 0.000150827016026143, 0.00014272401076110498, 0.00013501959319082055, 0.00012769632530543833, 0.00012073741007028455, 0.00011412667443787096, 0.00010784855245810085, 0.00010188806850814176, 0.00009623082066201636, 0.00009086296421859939, 0.00008577119540542112, 0.00008094273527433495, 0.00007636531380391752, 0.00007202715422219675, 0.0000679169575621855, 0.0000640238874615288, 0.00006033755521648723, 0.00005684800509944623, 0.00005354569994809472, 0.00005042150703348388, 0.000047466684213209537, 0.00004467286637510328, 0.000042032052175948674, 0.000039536591078930595, 0.00003717917069277221, 0.00003495280441475766, 0.00003285081937917349, 0.00003086684471202183, 0.000028994800092263632, 0.0000272288846192549, 0.000025563565985495944, 0.00002399356995331125, 0.00002251387013359277, 0.00002111967806429553, 0.000019806433585973247, 0.000018569795511245803, 0.000017405632584755476, 0.00001631001472983271, 0.000015279204577811597, 0.000014309649275659468 ], "yaxis": "y" } ], "layout": { "barmode": "overlay", "hovermode": "closest", "legend": { "traceorder": "reversed" }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Probability density function for normal distribution" }, "width": 700, "xaxis": { "anchor": "y2", "domain": [ 0, 1 ], "title": { "text": "Variable value" }, "zeroline": false }, "yaxis": { "anchor": "free", "domain": [ 0, 1 ], "position": 0, "title": { "text": "Probability density" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Set the numpy pseudo-random number generator seed\n", "numpy.random.seed(28)\n", "\n", "# Create an array of 10000 values from a normal distribution with a mean of 100 and a standard deviation of 10 assigned to the variables values\n", "values = numpy.random.normal(100, 10, 10000)\n", "\n", "# Create a plotly create_distplot figure of the data in values\n", "fig = figure_factory.create_distplot(\n", " [values], ['Values'],\n", " show_hist=False,\n", " histnorm='probability desnity',\n", " curve_type='normal',\n", " show_rug=False\n", ")\n", "\n", "fig.update_layout(\n", " title='Probability density function for normal distribution',\n", " xaxis_title='Variable value',\n", " yaxis_title='Probability density',\n", " width=700\n", ")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "More values occur in the array around the mean of $100$ than at the tails of the distribution. The left and right tails are the _zones_ further away to the left and right of the mean." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For the sake of interest, the equation for the normal distribution is shown in (3)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "f(x) = \\frac{1}{\\sigma \\sqrt{2 \\pi}} e^{- \\frac{1}{2} \\left( \\frac{x - \\mu}{\\sigma} \\right)^{2}}\\tag{3}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "From the plot it should be clear that $50\\%$ of the values are below $100$. The normal distribution is symmetrical. The total area under the curve is $1$. The idea of area is the same as the idea of an area of a circle or the area of a square. Because proportion is the same as probability, the area under the curve is the same as the probability that a value is within a range of values." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The __standard normal distribution__ has a mean of $0$ and a standard deviation of $1$, written as $N(0,1)$. Before the general availability of computers, probabilities (area under teh curve for a given interval) was calculated using tables. These were created for the standard normal distribution. There is an equation for converting from a normal distribution with a mean of $\\mu$ and a standard deviation of $\\sigma$ to a standard normal distribution. This is shown in (4), where $Z$ is the symbol for the converted value and $x$ is the value that the random variable $X$ takes." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "Z = \\frac{x - \\mu}{\\sigma}\\tag{4}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This allows for answering an example question such as the following. _Given that a random variable follows normal distribution with a mean of $100$ and a standard deviation of $10$, what is the probability that the value is less than $90$?_ Since the probability is a proportion of the total area under the curve, the questions really asks what proportion of the area under the curve (the plot above) is to the left of $90$. The answer is $0.1587$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The value of $90$ can be converted using (4), shown in (5)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "Z = \\frac{90-100}{10} = -1\\tag{5}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Instead of asking the probability of a value being less than $90$, written as $P(X<90)$ (and given that $X$ follows a normal distribution with a mean of $100$ and a standard deviation of $10$), the question can be asked as the probability of a value being less than $-1$, written as $P(Z<-1)$ (and given that $Z$ is described by the standard normal distribution)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `cdf` function from the stats module in the scipy package can perform the calculation. The `cdf` function takes a value and returns the probability that a value is less than or equal to that value. The value of $-1$ is passed to the `cdf` function and the result is $0.1587$." ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Probability of a value less than -1: 0.15865525393145707\n" ] } ], "source": [ "# Calculate the probability of a value less than -1 for the standard normal distribution\n", "print('Probability of a value less than -1:', stats.norm.cdf(-1))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The probability that a random value taken from the distribution (plot above) is at most $90$, is $0.159$ or about $15.9\\%$. This is the same as saying that the area under the curve to the left of $90$, is $0.159$ or about $15.9\\%$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Probability distributions can be used to consider population paramaters such as $\\mu$ and $\\sigma$ by selecting a sample from a population. The mean and standard deviation for a continuous variable, calculated from a sample of individuals taken from a population, is written as $\\bar{X}$ and $s$. Here $\\bar{X}$ and $s$ are estimates of the population mean and standard deviation, $\\mu$ and $\\sigma$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Inference" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__Inference__ is the use of calculations, that is, statistics, based on a sample taken from a population to learn about population parameters. In the frequenctist approach to statistics, there are two type of inference. These are __interval estimation__ (uncertainty or confidence intervals) and __hypothesis testing__." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Uncertainty" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To understand the concept of uncertainty, a variable is created for a simulated population, with a population size of $1000$ individuals (considering perhaps a rare disease). The variable is created from continuous uniform distribution (each value is as likeliky as any other value on an interval). The code below generates the values for the variable in the population using the `rvs` function. the values are on the interval $[50,100]$" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "autobinx": false, "histnorm": "probability density", "legendgroup": "Population", "marker": { "color": "rgb(31, 119, 180)" }, "name": "Population", "opacity": 0.7, "type": "histogram", "x": [ 75.9435314459436, 98.94202404876468, 96.01375350627148, 59.330237624013975, 69.71836983488062, 77.3085399462105, 64.2365976266595, 97.91571078947612, 74.77215612468974, 83.39926388650896, 62.85798954481837, 63.72980880345495, 91.78258097353809, 68.35488917648725, 70.94322471614382, 58.03060969056926, 57.32049475851409, 65.13877986206897, 65.3089962984455, 75.06398962026188, 97.91571078947612, 90.46575033353176, 64.05996947979783, 68.25072908548557, 61.94789576041468, 95.91293798357708, 75.91444886612508, 55.2341513738998, 78.38373664209965, 85.3881371452695, 73.78346574492257, 53.071911599743245, 78.11957731984752, 61.66076226583396, 53.0497909525323, 84.89401095605899, 55.29131045710471, 79.83749120938519, 59.15556356690571, 97.7668335249646, 52.7357661000054, 54.24334528738427, 74.1084596302071, 61.779042614588015, 70.58457388655921, 59.91179208384231, 71.47844167959688, 60.83847426162674, 79.68354499764175, 79.00662827860364, 99.50172073219508, 65.47804284193126, 74.88101963054424, 67.21667034650794, 75.42121491181013, 58.99376594097985, 61.95034475366913, 70.72855541320902, 61.229755510344866, 67.1732577050996, 99.22012298936308, 68.02652791771328, 50.33863271652718, 65.68283800457334, 99.05003164838921, 86.83924478516867, 68.3108996902212, 61.229755510344866, 64.18581230756918, 69.25299945342643, 70.49343331565112, 55.29131045710471, 51.60876620241769, 75.18523314830962, 53.797258246713255, 55.11285088500381, 85.3881371452695, 57.83365140888118, 71.60305639527384, 78.03165839876382, 73.14643263312294, 70.90530271662564, 57.81410407918388, 76.74428531985235, 73.72439002124469, 64.18581230756918, 51.61460746796707, 57.0571257098082, 68.94194328991979, 63.17386086410494, 96.4354283842847, 95.56387399338135, 91.7762742128431, 97.32257614831738, 99.21067341258895, 73.0859729581586, 92.4757270666431, 53.071911599743245, 59.908216975180814, 82.80115384952303, 86.83924478516867, 65.22348752071144, 87.63224734042005, 52.621986295318266, 79.68354499764175, 53.30994925415264, 76.32266490900754, 59.456123974193495, 83.75392726392099, 54.82527734010459, 94.68578850891183, 67.40561819596567, 74.67820151759585, 74.2150072760404, 50.66616740981807, 87.82729001800418, 92.25723188230083, 86.64128195108887, 51.07470284862533, 98.17530857325052, 50.17717049471222, 87.2949604603597, 61.91311927650987, 77.2592227153202, 63.50173632653833, 81.08805415742553, 99.72309809918038, 55.37201393982098, 58.454094831843854, 66.93511479070202, 96.49437875844968, 76.66915222984142, 96.86191876505201, 78.94682601961077, 65.93914096720157, 98.17532345812009, 95.89598269320136, 92.91911984723268, 97.4918287502336, 50.038629874446656, 92.45185057704971, 66.93511479070202, 79.28225581893851, 57.70013843121145, 79.28225581893851, 74.94493122980671, 54.814615324391795, 62.76755953083849, 69.68001013028969, 99.21067341258895, 61.04860360306411, 72.94868605604108, 93.79246869140064, 70.94322471614382, 61.782242485761415, 98.94202404876468, 52.621986295318266, 75.85741764809333, 68.38381194113647, 58.03060969056926, 94.43894914267666, 91.98751067987324, 78.03165839876382, 79.74000309624579, 68.1504198667343, 61.877441557706916, 69.70033573177862, 80.57035298218312, 86.45068711445596, 53.20601623823242, 95.10937416477242, 96.05394415642675, 89.28727651410973, 86.87038509326416, 56.16765636839091, 66.45157630613254, 91.81785434663358, 92.92655998336924, 58.11179435959126, 61.229755510344866, 96.4354283842847, 51.45834308133475, 93.5492737379575, 70.90530271662564, 94.81897922388924, 74.94493122980671, 50.53441077754937, 87.63224734042005, 57.32049475851409, 99.14328711240856, 92.826882514071, 89.89330869942518, 64.51453996506886, 89.50058123324709, 68.02652791771328, 74.48526683716804, 87.5819603455426, 69.3088566510814, 63.81628996065032, 61.95034475366913, 60.14295990685736, 64.18581230756918, 75.96442340878869, 71.931660073954, 71.58672717227778, 77.2592227153202, 77.24690737736401, 58.049592286696445, 58.11308516722436, 70.98889384429198, 64.90553414116503, 99.100944725746, 61.85024602541877, 85.06645789843502, 84.45569867129396, 91.613024968403, 92.12662253138987, 52.391256495431925, 89.66173743184129, 51.05808965118641, 57.85197600837992, 68.03374905625186, 83.44436471338082, 52.910758525636204, 61.66076226583396, 97.91571078947612, 95.8521415569701, 95.07761996080022, 64.18581230756918, 57.70013843121145, 85.9795405764372, 96.29098227832374, 98.56429048403109, 58.410613744853876, 87.23241423530195, 55.37201393982098, 84.38621025033287, 75.72044947505682, 83.01817033037689, 57.98991243078271, 91.50347028255463, 87.5819603455426, 93.14444189173221, 74.48526683716804, 68.64651790382925, 91.613024968403, 59.89216915251303, 89.06541031367381, 89.30892957046395, 76.49666117651454, 94.12771203301644, 56.204286350927944, 87.0099459276793, 84.03229059281348, 57.134185431192435, 84.26493471350808, 54.88009079055235, 66.29705888714874, 56.908137283256146, 78.20059186517231, 81.42060639442833, 87.00711159460123, 84.71781421320942, 75.43664624131294, 91.70449510884549, 84.08080238861946, 80.66967098662484, 68.09292514323931, 67.18172393572827, 75.85741764809333, 82.08228847678896, 52.12613189584433, 67.987092811277, 97.8851061506596, 96.01375350627148, 50.09155527553143, 65.57307599405166, 65.20238184861027, 75.54964908265566, 65.16005564613967, 59.93675956300781, 91.66169848417762, 92.12662253138987, 96.95918197543946, 88.51661459243115, 93.2610472925375, 56.083920061960455, 92.67564376244263, 76.49666117651454, 59.13466792079125, 97.75732171587934, 58.11308516722436, 95.60573381217719, 98.89591929199477, 86.03446746656968, 94.5905773293989, 59.330802773128475, 52.621986295318266, 64.51453996506886, 89.06541031367381, 95.53233167069111, 96.29098227832374, 82.66713799286968, 97.91571078947612, 73.83404205191701, 65.40186142453648, 63.91988581337852, 61.176391940733446, 57.46918652501882, 55.001113561696506, 99.52896033078893, 72.51123389944986, 53.521903076859026, 59.38022729125453, 71.95500293511496, 54.88009079055235, 50.42265812642845, 96.78321500977546, 72.67745740575288, 99.84646455423162, 57.85197600837992, 53.0497909525323, 84.8582040502883, 91.54441551064306, 69.10648090803164, 80.96927303136187, 86.03446746656968, 93.91729773298259, 52.577875305054164, 85.35283556775313, 57.98991243078271, 85.66657321672368, 65.20238184861027, 69.25299945342643, 67.4214348665819, 98.0895431616115, 51.41015860141956, 76.59632728772226, 75.32405597505694, 98.4724111862028, 57.27698338263008, 72.92511820752657, 78.38373664209965, 63.04090674999636, 52.99481403618703, 86.02334766633334, 74.36463087150476, 58.11179435959126, 53.828843629516335, 92.45185057704971, 88.26357680074278, 60.85416371215642, 73.0859729581586, 86.31243352590023, 65.71233945563336, 81.99821324103208, 92.67564376244263, 99.22012298936308, 84.03229059281348, 77.63417656852933, 86.87038509326416, 59.22071893167985, 75.873323772529, 87.15029728759272, 96.59936810025981, 76.12026737026147, 59.18698996355102, 98.49618995838885, 92.32948125289421, 88.27399089105387, 61.50214979426966, 66.71533535817353, 51.27611137028059, 57.0571257098082, 88.22456531200797, 98.43157432806679, 86.31243352590023, 73.30394961818186, 65.57307599405166, 97.4918287502336, 84.71781421320942, 69.2109976323765, 65.3089962984455, 69.68001013028969, 62.10674008446431, 95.7119477335252, 88.25443117322827, 80.66967098662484, 76.26986105832943, 79.38584738395681, 79.66372908456941, 97.91571078947612, 89.66173743184129, 82.15453653362259, 68.17256837353854, 78.97334526844436, 66.93511479070202, 92.94594118418765, 92.91911984723268, 72.35813754644262, 98.86281653124051, 88.77392787750172, 76.59632728772226, 86.58903393843715, 86.94014722261194, 80.96927303136187, 55.11285088500381, 53.082282695640544, 58.03060969056926, 63.70012757024146, 53.082282695640544, 85.90776198480918, 60.46368727553174, 83.5417705500696, 53.262122162602935, 64.69878839059902, 69.87961843500585, 77.08697250513863, 95.10310014998029, 58.863928849978606, 93.14444189173221, 88.9484373266116, 54.814615324391795, 73.72439002124469, 95.91293798357708, 91.81785434663358, 74.89052599563364, 66.12805457227536, 94.377620056184, 75.42799169378546, 81.8786813366677, 65.3089962984455, 97.38860578760945, 71.75019579276248, 91.81785434663358, 92.90884134966008, 74.1084596302071, 97.90232345756978, 55.98260695563822, 98.56625498112149, 90.02538284253578, 63.04090674999636, 59.91179208384231, 50.377261570887946, 79.83749120938519, 66.53035029299417, 95.17522805766943, 89.0901396631853, 69.7711419916213, 97.76859463174047, 88.27399089105387, 86.26775298239603, 76.59241968151164, 66.12805457227536, 77.08697250513863, 89.50058123324709, 76.59632728772226, 74.53203666697304, 88.20942046179687, 51.07470284862533, 83.00014659561334, 74.48526683716804, 50.09155527553143, 52.79072315400595, 77.2592227153202, 84.71781421320942, 73.23147853482149, 69.68001013028969, 61.36184243153176, 89.0901396631853, 89.95525093937592, 76.07195782105968, 66.53035029299417, 65.75040011481683, 59.92337374858044, 69.51125174049587, 65.22348752071144, 67.4214348665819, 63.81628996065032, 86.64128195108887, 94.61644684144329, 62.76755953083849, 53.147580507581324, 90.47278012954138, 74.67820151759585, 97.51229248586988, 69.09362611375973, 56.083920061960455, 81.50748420221025, 52.99481403618703, 95.89598269320136, 51.647493205931966, 52.391256495431925, 91.70037791775673, 99.15328909582851, 65.67991200053334, 93.2610472925375, 94.52264739005209, 90.87580535900885, 52.99481403618703, 88.6057588976753, 54.82527734010459, 93.5492737379575, 93.80915063905486, 75.81157696164527, 87.2949604603597, 54.91190893105255, 59.330237624013975, 95.07761996080022, 83.5417705500696, 59.16257947031699, 96.84731161740119, 86.64128195108887, 89.06541031367381, 69.95100887512136, 90.21214257956255, 97.21447998303739, 87.54964386310851, 87.87835364819912, 73.15507695770087, 72.25490576186225, 83.9402367704261, 51.58098013050132, 80.96927303136187, 50.02427007211345, 75.16201697456647, 70.98881908822608, 59.08022063879805, 76.74428531985235, 95.10937416477242, 97.21447998303739, 94.77759915270751, 79.64196541154321, 79.00662827860364, 82.58858770997357, 88.58381862680223, 78.13410968197904, 51.62385995815158, 80.75625110146493, 53.654788738298, 78.33512134668341, 59.79440575288606, 51.745657455891056, 96.05172874921546, 61.229755510344866, 78.44183687297333, 93.67291142825572, 87.23241423530195, 75.91444886612508, 59.456123974193495, 69.3557106131789, 54.513352696048145, 95.89598269320136, 61.94789576041468, 58.058496569423504, 86.31243352590023, 73.89813651785833, 50.588165682853436, 83.39926388650896, 68.5824413725059, 68.93378078414042, 88.22456531200797, 66.45157630613254, 98.90781392923557, 70.90530271662564, 85.89939138186419, 51.27611137028059, 95.53533841628143, 89.1913834375339, 59.456123974193495, 86.94014722261194, 87.15029728759272, 79.90089040061986, 58.463413970234654, 75.54964908265566, 51.27611137028059, 51.41015860141956, 95.60573381217719, 59.79440575288606, 64.30208917427184, 73.78346574492257, 88.71034884442263, 61.85024602541877, 73.15008234024046, 83.39926388650896, 59.18775103603212, 92.38782710318041, 83.45668472287126, 63.10476191459413, 75.53348673775648, 75.9435314459436, 96.08624260104735, 81.91417440402641, 55.616146118759616, 51.27611137028059, 55.86408076454103, 79.98318135849904, 56.69072658489745, 51.965159108461314, 60.14295990685736, 72.94868605604108, 72.28424447057591, 63.91988581337852, 72.67745740575288, 66.04225533240617, 65.40186142453648, 61.489931208088706, 92.92655998336924, 62.85798954481837, 63.139848607244815, 66.85029975255253, 89.49011117863255, 56.083920061960455, 79.7938702384286, 53.77045460664214, 74.94493122980671, 64.31897801973037, 56.77439939672884, 82.15453653362259, 89.95525093937592, 87.33500458865144, 50.17717049471222, 69.68001013028969, 54.55040631935073, 94.85937811913051, 96.59936810025981, 88.69157792944266, 91.70037791775673, 67.34541159415356, 74.7748899068465, 86.45068711445596, 72.87272456782115, 58.058496569423504, 94.65955211749753, 56.54585588193353, 87.53229856545086, 99.17851325880852, 92.67564376244263, 94.88086466604781, 84.45569867129396, 74.48526683716804, 57.134185431192435, 93.36094066995611, 74.1084596302071, 87.11625882032753, 75.42799169378546, 70.7752976244664, 65.83168478653096, 97.8851061506596, 53.77045460664214, 97.91571078947612, 92.45185057704971, 92.05399953137696, 80.57035298218312, 74.0425373011177, 94.14306832047842, 55.001113561696506, 95.91293798357708, 74.53203666697304, 66.45157630613254, 97.51229248586988, 59.08022063879805, 84.17562280500842, 98.0895431616115, 98.56429048403109, 59.445336343923906, 55.066324817146736, 58.049592286696445, 80.70979585136894, 95.97219209295879, 63.139848607244815, 83.00014659561334, 53.062552710047235, 63.50173632653833, 61.32249527860632, 99.21067341258895, 69.74905125402674, 84.16488264660983, 72.23708915941005, 51.06943234393704, 55.86408076454103, 91.66169848417762, 64.54848233736644, 95.54350389501535, 52.28514985163218, 50.305638486259966, 86.31243352590023, 56.396516808189126, 92.58697427798899, 96.01375350627148, 78.13410968197904, 98.86281653124051, 83.22323703809931, 62.76755953083849, 86.03446746656968, 78.11957731984752, 51.41015860141956, 91.69516432740615, 73.15008234024046, 67.18172393572827, 58.049592286696445, 75.83929262354906, 59.38022729125453, 51.566047407310336, 53.637772349766664, 78.97334526844436, 91.74316156712882, 61.04860360306411, 95.07761996080022, 50.42696696742987, 94.71565555740817, 95.21227653322138, 67.4214348665819, 57.34321419484663, 55.86408076454103, 93.66923671043286, 86.64128195108887, 69.15487132290964, 94.68578850891183, 59.91179208384231, 58.313685109951216, 73.89813651785833, 88.3585127212451, 53.30612949301196, 93.4883241207094, 61.737031234634664, 61.41867940501002, 53.20601623823242, 85.55105364708534, 95.60573381217719, 99.15328909582851, 59.93675956300781, 94.377620056184, 55.70656340682494, 54.23009387738031, 58.96288333428816, 75.42121491181013, 77.40809633640218, 61.04860360306411, 72.51123389944986, 50.53716757709034, 56.083920061960455, 64.49556087309537, 72.87272456782115, 55.80296267444474, 54.51619643905064, 61.489931208088706, 86.18269183745453, 51.647493205931966, 53.30612949301196, 88.26357680074278, 50.53716757709034, 52.12613189584433, 76.98210740644484, 94.77759915270751, 83.44436471338082, 87.00711159460123, 99.67483370069135, 80.24417550628213, 99.15328909582851, 80.0300766914687, 58.410613744853876, 73.03355961145728, 67.80585572411026, 87.11625882032753, 65.89875698122961, 76.66915222984142, 75.873323772529, 66.12805457227536, 76.49426814968004, 92.45185057704971, 58.195941902210336, 98.49618995838885, 85.74544838833226, 77.44046549709907, 57.134185431192435, 61.489931208088706, 51.58098013050132, 86.30223343035398, 58.049592286696445, 97.38860578760945, 88.58381862680223, 90.82023112744005, 74.88101963054424, 77.05527316716255, 67.80585572411026, 59.677906558233225, 81.75779043854133, 81.83121832822084, 97.04077174822228, 71.10467288885, 92.65864666703702, 67.64688848010319, 86.17632844085584, 65.67991200053334, 60.30863865320453, 58.863928849978606, 71.85241876452078, 99.52896033078893, 94.81897922388924, 94.81897922388924, 53.20601623823242, 63.70012757024146, 74.6082139564342, 58.863928849978606, 98.17532345812009, 72.82791474867426, 65.4855401538851, 69.3557106131789, 56.77439939672884, 91.09834730764004, 56.16765636839091, 88.71034884442263, 74.88101963054424, 91.78258097353809, 79.4826923840987, 70.58457388655921, 64.90553414116503, 74.88101963054424, 51.31769242549353, 57.46574765992423, 79.35230493528313, 92.65864666703702, 68.1504198667343, 79.4826923840987, 68.94966901126757, 99.84646455423162, 59.79440575288606, 66.54612476674556, 97.17268135855065, 86.26775298239603, 75.57268913700122, 98.17530857325052, 51.07470284862533, 58.54022300366531, 61.7332730892211, 71.47844167959688, 88.25443117322827, 92.50891313005303, 80.7785706158535, 58.96288333428816, 83.72828224188011, 68.09292514323931, 86.18269183745453, 75.58408447301655, 82.294069706721, 57.46574765992423, 67.21667034650794, 55.970135449533636, 88.16328349561758, 61.75938344530996, 57.3924800641465, 69.24974692179215, 54.36717207798547, 94.68578850891183, 54.513352696048145, 92.32948125289421, 64.18581230756918, 96.95918197543946, 99.52896033078893, 79.68747241005339, 89.28727651410973, 56.21690153467379, 87.44868965757783, 74.1084596302071, 54.23009387738031, 55.2341513738998, 84.38621025033287, 79.83749120938519, 83.05153152986327, 56.16765636839091, 95.19452610249321, 83.75392726392099, 84.38621025033287, 97.46592521373613, 78.94682601961077, 97.28215273418245, 87.32271095663629, 91.50347028255463, 61.36184243153176, 83.39926388650896, 97.85726723269039, 58.058496569423504, 61.779042614588015, 79.90089040061986, 95.10310014998029, 80.31609139676495, 98.86281653124051, 87.87308297467993, 93.31671013654358, 72.44726434507963, 61.740417730072146, 95.48243013579885, 88.97037166357114, 79.20589199597221, 55.80296267444474, 94.41389570905987, 62.59102328521985, 82.44321708583642, 94.81897922388924, 79.64196541154321, 95.7119477335252, 76.11673607387397, 93.95990200599152, 71.6245719586413, 77.38067992731918, 98.98717416547163, 59.16257947031699, 82.294069706721, 61.877441557706916, 97.38860578760945, 55.87849150163691, 55.970135449533636, 91.98751067987324, 68.3108996902212, 65.89875698122961, 73.05601518862636, 74.2150072760404, 68.55958118142256, 76.51719398153797, 76.48761985632737, 59.72472176941612, 99.22012298936308, 95.48243013579885, 92.12662253138987, 78.11967857363912, 80.10423910615225, 90.5431353278515, 52.577875305054164, 53.0497909525323, 97.75732171587934, 76.12026737026147, 53.30994925415264, 95.97219209295879, 63.03042889546642, 62.59914142252326, 94.5562420649884, 62.59914142252326, 94.39162969544208, 54.2591301422904, 71.1165281063633, 67.5952761693148, 94.88086466604781, 91.78258097353809, 52.79072315400595, 51.45834308133475, 92.67564376244263, 72.87272456782115, 65.40186142453648, 93.53537516337282, 78.13410968197904, 96.05172874921546, 98.36150653221092, 94.39162969544208, 79.7641416556027, 88.27399089105387, 65.3089962984455, 90.73424592857579, 98.71825565698, 51.24575971995406, 87.87308297467993, 85.66657321672368, 58.49846158391289, 59.77996554478716, 68.43087601583355, 68.23831504478076, 83.44436471338082, 61.94789576041468, 61.737031234634664, 97.51229248586988, 63.139848607244815, 99.85927555919643, 69.7711419916213, 60.14295990685736, 76.59816346059613, 61.36184243153176, 54.513352696048145, 80.5190789202995, 87.0099459276793, 59.35157218957948, 60.044790413739484, 74.31072426326924, 52.910758525636204, 90.21214257956255, 71.43954307561421, 66.2147623279716, 51.58098013050132, 95.60573381217719, 61.498471369099725, 78.03165839876382, 67.13443440088878, 75.96442340878869, 68.38381194113647, 97.4918287502336, 88.3585127212451, 57.134185431192435, 65.3089962984455, 50.42696696742987, 99.100944725746, 74.8415557308997 ], "xaxis": "x", "xbins": { "end": 99.85927555919643, "size": 1, "start": 50.02427007211345 }, "yaxis": "y" } ], "layout": { "barmode": "overlay", "hovermode": "closest", "legend": { "traceorder": "reversed" }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Histogram of population values" }, "width": 700, "xaxis": { "anchor": "y2", "domain": [ 0, 1 ], "title": { "text": "Variable value" }, "zeroline": false }, "yaxis": { "anchor": "free", "domain": [ 0, 1 ], "position": 0, "title": { "text": "Frequency" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Seed the numpy pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Create an array of 1000 values using a continuous uniform distribution between 50 and 100 and assign it to the variable population\n", "population = numpy.random.uniform(50, 100, 1000)\n", "\n", "# Create a plotly create_distplot figure of the data in population\n", "fig = figure_factory.create_distplot(\n", " [numpy.random.choice(population, 1000)], ['Population'],\n", " show_hist=True,\n", " show_rug=False,\n", " show_curve=False\n", ")\n", "\n", "fig.update_layout(\n", " title='Histogram of population values',\n", " xaxis_title='Variable value',\n", " yaxis_title='Frequency',\n", " width=700\n", ")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Even though the random variable, $X$, does not follow a normal distribution, the population mean and standard deviation can still be caluclated." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "74.8702856608023" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the population mean of the population and assign it to the variable mu\n", "mu = population.mean()\n", "mu" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "14.807689712963851" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the population standard deviation of the population and assign it to the variable sigma\n", "sigma = population.std()\n", "sigma" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The mean (green line) and standard deviation (red dashed lines) are added to the plot below." ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "autobinx": false, "histnorm": "probability density", "legendgroup": "Population", "marker": { "color": "rgb(31, 119, 180)" }, "name": "Population", "opacity": 0.7, "type": "histogram", "x": [ 75.9435314459436, 98.94202404876468, 96.01375350627148, 59.330237624013975, 69.71836983488062, 77.3085399462105, 64.2365976266595, 97.91571078947612, 74.77215612468974, 83.39926388650896, 62.85798954481837, 63.72980880345495, 91.78258097353809, 68.35488917648725, 70.94322471614382, 58.03060969056926, 57.32049475851409, 65.13877986206897, 65.3089962984455, 75.06398962026188, 97.91571078947612, 90.46575033353176, 64.05996947979783, 68.25072908548557, 61.94789576041468, 95.91293798357708, 75.91444886612508, 55.2341513738998, 78.38373664209965, 85.3881371452695, 73.78346574492257, 53.071911599743245, 78.11957731984752, 61.66076226583396, 53.0497909525323, 84.89401095605899, 55.29131045710471, 79.83749120938519, 59.15556356690571, 97.7668335249646, 52.7357661000054, 54.24334528738427, 74.1084596302071, 61.779042614588015, 70.58457388655921, 59.91179208384231, 71.47844167959688, 60.83847426162674, 79.68354499764175, 79.00662827860364, 99.50172073219508, 65.47804284193126, 74.88101963054424, 67.21667034650794, 75.42121491181013, 58.99376594097985, 61.95034475366913, 70.72855541320902, 61.229755510344866, 67.1732577050996, 99.22012298936308, 68.02652791771328, 50.33863271652718, 65.68283800457334, 99.05003164838921, 86.83924478516867, 68.3108996902212, 61.229755510344866, 64.18581230756918, 69.25299945342643, 70.49343331565112, 55.29131045710471, 51.60876620241769, 75.18523314830962, 53.797258246713255, 55.11285088500381, 85.3881371452695, 57.83365140888118, 71.60305639527384, 78.03165839876382, 73.14643263312294, 70.90530271662564, 57.81410407918388, 76.74428531985235, 73.72439002124469, 64.18581230756918, 51.61460746796707, 57.0571257098082, 68.94194328991979, 63.17386086410494, 96.4354283842847, 95.56387399338135, 91.7762742128431, 97.32257614831738, 99.21067341258895, 73.0859729581586, 92.4757270666431, 53.071911599743245, 59.908216975180814, 82.80115384952303, 86.83924478516867, 65.22348752071144, 87.63224734042005, 52.621986295318266, 79.68354499764175, 53.30994925415264, 76.32266490900754, 59.456123974193495, 83.75392726392099, 54.82527734010459, 94.68578850891183, 67.40561819596567, 74.67820151759585, 74.2150072760404, 50.66616740981807, 87.82729001800418, 92.25723188230083, 86.64128195108887, 51.07470284862533, 98.17530857325052, 50.17717049471222, 87.2949604603597, 61.91311927650987, 77.2592227153202, 63.50173632653833, 81.08805415742553, 99.72309809918038, 55.37201393982098, 58.454094831843854, 66.93511479070202, 96.49437875844968, 76.66915222984142, 96.86191876505201, 78.94682601961077, 65.93914096720157, 98.17532345812009, 95.89598269320136, 92.91911984723268, 97.4918287502336, 50.038629874446656, 92.45185057704971, 66.93511479070202, 79.28225581893851, 57.70013843121145, 79.28225581893851, 74.94493122980671, 54.814615324391795, 62.76755953083849, 69.68001013028969, 99.21067341258895, 61.04860360306411, 72.94868605604108, 93.79246869140064, 70.94322471614382, 61.782242485761415, 98.94202404876468, 52.621986295318266, 75.85741764809333, 68.38381194113647, 58.03060969056926, 94.43894914267666, 91.98751067987324, 78.03165839876382, 79.74000309624579, 68.1504198667343, 61.877441557706916, 69.70033573177862, 80.57035298218312, 86.45068711445596, 53.20601623823242, 95.10937416477242, 96.05394415642675, 89.28727651410973, 86.87038509326416, 56.16765636839091, 66.45157630613254, 91.81785434663358, 92.92655998336924, 58.11179435959126, 61.229755510344866, 96.4354283842847, 51.45834308133475, 93.5492737379575, 70.90530271662564, 94.81897922388924, 74.94493122980671, 50.53441077754937, 87.63224734042005, 57.32049475851409, 99.14328711240856, 92.826882514071, 89.89330869942518, 64.51453996506886, 89.50058123324709, 68.02652791771328, 74.48526683716804, 87.5819603455426, 69.3088566510814, 63.81628996065032, 61.95034475366913, 60.14295990685736, 64.18581230756918, 75.96442340878869, 71.931660073954, 71.58672717227778, 77.2592227153202, 77.24690737736401, 58.049592286696445, 58.11308516722436, 70.98889384429198, 64.90553414116503, 99.100944725746, 61.85024602541877, 85.06645789843502, 84.45569867129396, 91.613024968403, 92.12662253138987, 52.391256495431925, 89.66173743184129, 51.05808965118641, 57.85197600837992, 68.03374905625186, 83.44436471338082, 52.910758525636204, 61.66076226583396, 97.91571078947612, 95.8521415569701, 95.07761996080022, 64.18581230756918, 57.70013843121145, 85.9795405764372, 96.29098227832374, 98.56429048403109, 58.410613744853876, 87.23241423530195, 55.37201393982098, 84.38621025033287, 75.72044947505682, 83.01817033037689, 57.98991243078271, 91.50347028255463, 87.5819603455426, 93.14444189173221, 74.48526683716804, 68.64651790382925, 91.613024968403, 59.89216915251303, 89.06541031367381, 89.30892957046395, 76.49666117651454, 94.12771203301644, 56.204286350927944, 87.0099459276793, 84.03229059281348, 57.134185431192435, 84.26493471350808, 54.88009079055235, 66.29705888714874, 56.908137283256146, 78.20059186517231, 81.42060639442833, 87.00711159460123, 84.71781421320942, 75.43664624131294, 91.70449510884549, 84.08080238861946, 80.66967098662484, 68.09292514323931, 67.18172393572827, 75.85741764809333, 82.08228847678896, 52.12613189584433, 67.987092811277, 97.8851061506596, 96.01375350627148, 50.09155527553143, 65.57307599405166, 65.20238184861027, 75.54964908265566, 65.16005564613967, 59.93675956300781, 91.66169848417762, 92.12662253138987, 96.95918197543946, 88.51661459243115, 93.2610472925375, 56.083920061960455, 92.67564376244263, 76.49666117651454, 59.13466792079125, 97.75732171587934, 58.11308516722436, 95.60573381217719, 98.89591929199477, 86.03446746656968, 94.5905773293989, 59.330802773128475, 52.621986295318266, 64.51453996506886, 89.06541031367381, 95.53233167069111, 96.29098227832374, 82.66713799286968, 97.91571078947612, 73.83404205191701, 65.40186142453648, 63.91988581337852, 61.176391940733446, 57.46918652501882, 55.001113561696506, 99.52896033078893, 72.51123389944986, 53.521903076859026, 59.38022729125453, 71.95500293511496, 54.88009079055235, 50.42265812642845, 96.78321500977546, 72.67745740575288, 99.84646455423162, 57.85197600837992, 53.0497909525323, 84.8582040502883, 91.54441551064306, 69.10648090803164, 80.96927303136187, 86.03446746656968, 93.91729773298259, 52.577875305054164, 85.35283556775313, 57.98991243078271, 85.66657321672368, 65.20238184861027, 69.25299945342643, 67.4214348665819, 98.0895431616115, 51.41015860141956, 76.59632728772226, 75.32405597505694, 98.4724111862028, 57.27698338263008, 72.92511820752657, 78.38373664209965, 63.04090674999636, 52.99481403618703, 86.02334766633334, 74.36463087150476, 58.11179435959126, 53.828843629516335, 92.45185057704971, 88.26357680074278, 60.85416371215642, 73.0859729581586, 86.31243352590023, 65.71233945563336, 81.99821324103208, 92.67564376244263, 99.22012298936308, 84.03229059281348, 77.63417656852933, 86.87038509326416, 59.22071893167985, 75.873323772529, 87.15029728759272, 96.59936810025981, 76.12026737026147, 59.18698996355102, 98.49618995838885, 92.32948125289421, 88.27399089105387, 61.50214979426966, 66.71533535817353, 51.27611137028059, 57.0571257098082, 88.22456531200797, 98.43157432806679, 86.31243352590023, 73.30394961818186, 65.57307599405166, 97.4918287502336, 84.71781421320942, 69.2109976323765, 65.3089962984455, 69.68001013028969, 62.10674008446431, 95.7119477335252, 88.25443117322827, 80.66967098662484, 76.26986105832943, 79.38584738395681, 79.66372908456941, 97.91571078947612, 89.66173743184129, 82.15453653362259, 68.17256837353854, 78.97334526844436, 66.93511479070202, 92.94594118418765, 92.91911984723268, 72.35813754644262, 98.86281653124051, 88.77392787750172, 76.59632728772226, 86.58903393843715, 86.94014722261194, 80.96927303136187, 55.11285088500381, 53.082282695640544, 58.03060969056926, 63.70012757024146, 53.082282695640544, 85.90776198480918, 60.46368727553174, 83.5417705500696, 53.262122162602935, 64.69878839059902, 69.87961843500585, 77.08697250513863, 95.10310014998029, 58.863928849978606, 93.14444189173221, 88.9484373266116, 54.814615324391795, 73.72439002124469, 95.91293798357708, 91.81785434663358, 74.89052599563364, 66.12805457227536, 94.377620056184, 75.42799169378546, 81.8786813366677, 65.3089962984455, 97.38860578760945, 71.75019579276248, 91.81785434663358, 92.90884134966008, 74.1084596302071, 97.90232345756978, 55.98260695563822, 98.56625498112149, 90.02538284253578, 63.04090674999636, 59.91179208384231, 50.377261570887946, 79.83749120938519, 66.53035029299417, 95.17522805766943, 89.0901396631853, 69.7711419916213, 97.76859463174047, 88.27399089105387, 86.26775298239603, 76.59241968151164, 66.12805457227536, 77.08697250513863, 89.50058123324709, 76.59632728772226, 74.53203666697304, 88.20942046179687, 51.07470284862533, 83.00014659561334, 74.48526683716804, 50.09155527553143, 52.79072315400595, 77.2592227153202, 84.71781421320942, 73.23147853482149, 69.68001013028969, 61.36184243153176, 89.0901396631853, 89.95525093937592, 76.07195782105968, 66.53035029299417, 65.75040011481683, 59.92337374858044, 69.51125174049587, 65.22348752071144, 67.4214348665819, 63.81628996065032, 86.64128195108887, 94.61644684144329, 62.76755953083849, 53.147580507581324, 90.47278012954138, 74.67820151759585, 97.51229248586988, 69.09362611375973, 56.083920061960455, 81.50748420221025, 52.99481403618703, 95.89598269320136, 51.647493205931966, 52.391256495431925, 91.70037791775673, 99.15328909582851, 65.67991200053334, 93.2610472925375, 94.52264739005209, 90.87580535900885, 52.99481403618703, 88.6057588976753, 54.82527734010459, 93.5492737379575, 93.80915063905486, 75.81157696164527, 87.2949604603597, 54.91190893105255, 59.330237624013975, 95.07761996080022, 83.5417705500696, 59.16257947031699, 96.84731161740119, 86.64128195108887, 89.06541031367381, 69.95100887512136, 90.21214257956255, 97.21447998303739, 87.54964386310851, 87.87835364819912, 73.15507695770087, 72.25490576186225, 83.9402367704261, 51.58098013050132, 80.96927303136187, 50.02427007211345, 75.16201697456647, 70.98881908822608, 59.08022063879805, 76.74428531985235, 95.10937416477242, 97.21447998303739, 94.77759915270751, 79.64196541154321, 79.00662827860364, 82.58858770997357, 88.58381862680223, 78.13410968197904, 51.62385995815158, 80.75625110146493, 53.654788738298, 78.33512134668341, 59.79440575288606, 51.745657455891056, 96.05172874921546, 61.229755510344866, 78.44183687297333, 93.67291142825572, 87.23241423530195, 75.91444886612508, 59.456123974193495, 69.3557106131789, 54.513352696048145, 95.89598269320136, 61.94789576041468, 58.058496569423504, 86.31243352590023, 73.89813651785833, 50.588165682853436, 83.39926388650896, 68.5824413725059, 68.93378078414042, 88.22456531200797, 66.45157630613254, 98.90781392923557, 70.90530271662564, 85.89939138186419, 51.27611137028059, 95.53533841628143, 89.1913834375339, 59.456123974193495, 86.94014722261194, 87.15029728759272, 79.90089040061986, 58.463413970234654, 75.54964908265566, 51.27611137028059, 51.41015860141956, 95.60573381217719, 59.79440575288606, 64.30208917427184, 73.78346574492257, 88.71034884442263, 61.85024602541877, 73.15008234024046, 83.39926388650896, 59.18775103603212, 92.38782710318041, 83.45668472287126, 63.10476191459413, 75.53348673775648, 75.9435314459436, 96.08624260104735, 81.91417440402641, 55.616146118759616, 51.27611137028059, 55.86408076454103, 79.98318135849904, 56.69072658489745, 51.965159108461314, 60.14295990685736, 72.94868605604108, 72.28424447057591, 63.91988581337852, 72.67745740575288, 66.04225533240617, 65.40186142453648, 61.489931208088706, 92.92655998336924, 62.85798954481837, 63.139848607244815, 66.85029975255253, 89.49011117863255, 56.083920061960455, 79.7938702384286, 53.77045460664214, 74.94493122980671, 64.31897801973037, 56.77439939672884, 82.15453653362259, 89.95525093937592, 87.33500458865144, 50.17717049471222, 69.68001013028969, 54.55040631935073, 94.85937811913051, 96.59936810025981, 88.69157792944266, 91.70037791775673, 67.34541159415356, 74.7748899068465, 86.45068711445596, 72.87272456782115, 58.058496569423504, 94.65955211749753, 56.54585588193353, 87.53229856545086, 99.17851325880852, 92.67564376244263, 94.88086466604781, 84.45569867129396, 74.48526683716804, 57.134185431192435, 93.36094066995611, 74.1084596302071, 87.11625882032753, 75.42799169378546, 70.7752976244664, 65.83168478653096, 97.8851061506596, 53.77045460664214, 97.91571078947612, 92.45185057704971, 92.05399953137696, 80.57035298218312, 74.0425373011177, 94.14306832047842, 55.001113561696506, 95.91293798357708, 74.53203666697304, 66.45157630613254, 97.51229248586988, 59.08022063879805, 84.17562280500842, 98.0895431616115, 98.56429048403109, 59.445336343923906, 55.066324817146736, 58.049592286696445, 80.70979585136894, 95.97219209295879, 63.139848607244815, 83.00014659561334, 53.062552710047235, 63.50173632653833, 61.32249527860632, 99.21067341258895, 69.74905125402674, 84.16488264660983, 72.23708915941005, 51.06943234393704, 55.86408076454103, 91.66169848417762, 64.54848233736644, 95.54350389501535, 52.28514985163218, 50.305638486259966, 86.31243352590023, 56.396516808189126, 92.58697427798899, 96.01375350627148, 78.13410968197904, 98.86281653124051, 83.22323703809931, 62.76755953083849, 86.03446746656968, 78.11957731984752, 51.41015860141956, 91.69516432740615, 73.15008234024046, 67.18172393572827, 58.049592286696445, 75.83929262354906, 59.38022729125453, 51.566047407310336, 53.637772349766664, 78.97334526844436, 91.74316156712882, 61.04860360306411, 95.07761996080022, 50.42696696742987, 94.71565555740817, 95.21227653322138, 67.4214348665819, 57.34321419484663, 55.86408076454103, 93.66923671043286, 86.64128195108887, 69.15487132290964, 94.68578850891183, 59.91179208384231, 58.313685109951216, 73.89813651785833, 88.3585127212451, 53.30612949301196, 93.4883241207094, 61.737031234634664, 61.41867940501002, 53.20601623823242, 85.55105364708534, 95.60573381217719, 99.15328909582851, 59.93675956300781, 94.377620056184, 55.70656340682494, 54.23009387738031, 58.96288333428816, 75.42121491181013, 77.40809633640218, 61.04860360306411, 72.51123389944986, 50.53716757709034, 56.083920061960455, 64.49556087309537, 72.87272456782115, 55.80296267444474, 54.51619643905064, 61.489931208088706, 86.18269183745453, 51.647493205931966, 53.30612949301196, 88.26357680074278, 50.53716757709034, 52.12613189584433, 76.98210740644484, 94.77759915270751, 83.44436471338082, 87.00711159460123, 99.67483370069135, 80.24417550628213, 99.15328909582851, 80.0300766914687, 58.410613744853876, 73.03355961145728, 67.80585572411026, 87.11625882032753, 65.89875698122961, 76.66915222984142, 75.873323772529, 66.12805457227536, 76.49426814968004, 92.45185057704971, 58.195941902210336, 98.49618995838885, 85.74544838833226, 77.44046549709907, 57.134185431192435, 61.489931208088706, 51.58098013050132, 86.30223343035398, 58.049592286696445, 97.38860578760945, 88.58381862680223, 90.82023112744005, 74.88101963054424, 77.05527316716255, 67.80585572411026, 59.677906558233225, 81.75779043854133, 81.83121832822084, 97.04077174822228, 71.10467288885, 92.65864666703702, 67.64688848010319, 86.17632844085584, 65.67991200053334, 60.30863865320453, 58.863928849978606, 71.85241876452078, 99.52896033078893, 94.81897922388924, 94.81897922388924, 53.20601623823242, 63.70012757024146, 74.6082139564342, 58.863928849978606, 98.17532345812009, 72.82791474867426, 65.4855401538851, 69.3557106131789, 56.77439939672884, 91.09834730764004, 56.16765636839091, 88.71034884442263, 74.88101963054424, 91.78258097353809, 79.4826923840987, 70.58457388655921, 64.90553414116503, 74.88101963054424, 51.31769242549353, 57.46574765992423, 79.35230493528313, 92.65864666703702, 68.1504198667343, 79.4826923840987, 68.94966901126757, 99.84646455423162, 59.79440575288606, 66.54612476674556, 97.17268135855065, 86.26775298239603, 75.57268913700122, 98.17530857325052, 51.07470284862533, 58.54022300366531, 61.7332730892211, 71.47844167959688, 88.25443117322827, 92.50891313005303, 80.7785706158535, 58.96288333428816, 83.72828224188011, 68.09292514323931, 86.18269183745453, 75.58408447301655, 82.294069706721, 57.46574765992423, 67.21667034650794, 55.970135449533636, 88.16328349561758, 61.75938344530996, 57.3924800641465, 69.24974692179215, 54.36717207798547, 94.68578850891183, 54.513352696048145, 92.32948125289421, 64.18581230756918, 96.95918197543946, 99.52896033078893, 79.68747241005339, 89.28727651410973, 56.21690153467379, 87.44868965757783, 74.1084596302071, 54.23009387738031, 55.2341513738998, 84.38621025033287, 79.83749120938519, 83.05153152986327, 56.16765636839091, 95.19452610249321, 83.75392726392099, 84.38621025033287, 97.46592521373613, 78.94682601961077, 97.28215273418245, 87.32271095663629, 91.50347028255463, 61.36184243153176, 83.39926388650896, 97.85726723269039, 58.058496569423504, 61.779042614588015, 79.90089040061986, 95.10310014998029, 80.31609139676495, 98.86281653124051, 87.87308297467993, 93.31671013654358, 72.44726434507963, 61.740417730072146, 95.48243013579885, 88.97037166357114, 79.20589199597221, 55.80296267444474, 94.41389570905987, 62.59102328521985, 82.44321708583642, 94.81897922388924, 79.64196541154321, 95.7119477335252, 76.11673607387397, 93.95990200599152, 71.6245719586413, 77.38067992731918, 98.98717416547163, 59.16257947031699, 82.294069706721, 61.877441557706916, 97.38860578760945, 55.87849150163691, 55.970135449533636, 91.98751067987324, 68.3108996902212, 65.89875698122961, 73.05601518862636, 74.2150072760404, 68.55958118142256, 76.51719398153797, 76.48761985632737, 59.72472176941612, 99.22012298936308, 95.48243013579885, 92.12662253138987, 78.11967857363912, 80.10423910615225, 90.5431353278515, 52.577875305054164, 53.0497909525323, 97.75732171587934, 76.12026737026147, 53.30994925415264, 95.97219209295879, 63.03042889546642, 62.59914142252326, 94.5562420649884, 62.59914142252326, 94.39162969544208, 54.2591301422904, 71.1165281063633, 67.5952761693148, 94.88086466604781, 91.78258097353809, 52.79072315400595, 51.45834308133475, 92.67564376244263, 72.87272456782115, 65.40186142453648, 93.53537516337282, 78.13410968197904, 96.05172874921546, 98.36150653221092, 94.39162969544208, 79.7641416556027, 88.27399089105387, 65.3089962984455, 90.73424592857579, 98.71825565698, 51.24575971995406, 87.87308297467993, 85.66657321672368, 58.49846158391289, 59.77996554478716, 68.43087601583355, 68.23831504478076, 83.44436471338082, 61.94789576041468, 61.737031234634664, 97.51229248586988, 63.139848607244815, 99.85927555919643, 69.7711419916213, 60.14295990685736, 76.59816346059613, 61.36184243153176, 54.513352696048145, 80.5190789202995, 87.0099459276793, 59.35157218957948, 60.044790413739484, 74.31072426326924, 52.910758525636204, 90.21214257956255, 71.43954307561421, 66.2147623279716, 51.58098013050132, 95.60573381217719, 61.498471369099725, 78.03165839876382, 67.13443440088878, 75.96442340878869, 68.38381194113647, 97.4918287502336, 88.3585127212451, 57.134185431192435, 65.3089962984455, 50.42696696742987, 99.100944725746, 74.8415557308997 ], "xaxis": "x", "xbins": { "end": 99.85927555919643, "size": 1, "start": 50.02427007211345 }, "yaxis": "y" } ], "layout": { "barmode": "overlay", "hovermode": "closest", "legend": { "traceorder": "reversed" }, "shapes": [ { "line": { "color": "green", "width": 2 }, "type": "line", "x0": 74.8702856608023, "x1": 74.8702856608023, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "red", "dash": "dash", "width": 2 }, "type": "line", "x0": 60.062595947838446, "x1": 60.062595947838446, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "line": { "color": "red", "dash": "dash", "width": 2 }, "type": "line", "x0": 89.67797537376615, "x1": 89.67797537376615, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" } ], "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Histogram of population values" }, "width": 700, "xaxis": { "anchor": "y2", "domain": [ 0, 1 ], "title": { "text": "Variable value" }, "zeroline": false }, "yaxis": { "anchor": "free", "domain": [ 0, 1 ], "position": 0, "title": { "text": "Frequency" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Add a horizontal line to the plot at the mean and dashed lines for the standard deviation\n", "fig.add_vline(x=mu, line_width=2, line_color='green')\n", "fig.add_vline(x=mu - sigma, line_width=2, line_dash='dash', line_color='red')\n", "fig.add_vline(x=mu + sigma, line_width=2, line_dash='dash', line_color='red')\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A random sample can be taken from this popuation. The sample mean can be calculated and serves as an estimate of the population mean. A random sample of $30$ individuals are taken from the population." ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "75.39338504047777" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Select a random sample of 30 values from the population and assign it to the variable sample\n", "sample = numpy.random.choice(population, 30)\n", "\n", "# Calculate the sample mean and assign it to the variable x_bar\n", "x_bar = sample.mean()\n", "x_bar" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Whereas the population mean is $\\mu = 74.87$, the sample mean is $\\bar{X} = 75.39$. The sample mean is an estimate of the population mean. The sample mean is not the same as the population mean. The sample mean is a random variable. If another sample of $30$ individuals is taken from the population, the sample mean will be different. The sample mean is a random variable because it is the result of a random process (taking a sample from a population)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Consider then repeating this experiment of taking a random sample of $30$ individuals from the population over and over again. The sample mean will be different each time. The distribution of the sample means is called the __sampling distribution of the sample mean__. The sampling distribution of the sample mean is a theoretical distribution. The sampling distribution of the sample mean is a theoretical distribution because it is not possible to take an infinite number of samples from a population, that is to say, the sampling distribution of the sample mean is a theoretical distribution because it is not possible to take an infinite number of samples from a population." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The code below, simulates taking a random set of $30$ individuals, calculating the mean, and repeating this random experiment $1000$ times." ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "# Use list comprehension to calculate the sample mean of 1000 samples of size 30 and assign it to the variable x_bar_vals\n", "x_bar_vals = [numpy.random.choice(population, 30).mean() for _ in range(1000)]" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [], "source": [ "# Sort the values in x_bar_vals and assign it to the variable x_bar_vals_sorted\n", "x_bar_vals_sorted = numpy.sort(x_bar_vals)" ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "69.54310782732712" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x_bar_vals_sorted[24]" ] }, { "cell_type": "code", "execution_count": 53, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "80.28681596822955" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x_bar_vals_sorted[974]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A histogram of the $1000$ sample means is shown below." ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "histnorm": "probability", "type": "histogram", "x": [ 69.84345662130204, 72.60187738769199, 76.59827929734878, 73.96990321477178, 74.89791072520772, 70.00209023364627, 75.46749756442831, 73.98692257083778, 76.60364774543952, 77.04941540845012, 70.7944778031303, 77.53817567829591, 77.35659224788218, 77.17232771627268, 72.58279050806787, 75.3222920532692, 72.1847550531239, 73.33894561670475, 75.90438324019603, 71.40538146964633, 76.63489818791163, 75.89079971425333, 71.49069911650137, 74.01007010113294, 77.21921670645513, 80.98175209863912, 74.8601398783346, 79.746069860667, 78.16108310677632, 77.05409025180536, 76.9418676436257, 71.65587205973392, 77.096470171809, 73.99967185688027, 71.5626692185752, 74.45490499154235, 75.5416927031429, 75.40751017507937, 73.77461418672631, 76.90801865120703, 70.23142292087506, 79.45783136197248, 70.5868836436783, 75.51655619101203, 78.02300221344753, 76.24412170976122, 77.61920052115332, 78.41449979064728, 73.35469280327861, 75.01611510061278, 68.74682268000691, 78.59855041186309, 76.41131947776832, 78.15811437114466, 75.18130517797569, 76.37480021230706, 71.11840879443307, 73.18429028793877, 70.55407637560272, 71.99910252078121, 73.10684596475784, 72.81188980349152, 74.85278332107934, 77.05704557821802, 74.11367891444279, 69.39300045479384, 68.25964939590261, 76.13151375845865, 76.23949755604067, 77.01705148967412, 73.81191343889414, 76.76087417715495, 77.30329315850182, 76.92819198377919, 74.65636829161222, 75.07784722521895, 77.85246027538237, 76.42564297045742, 78.64744374868269, 73.73142834394747, 77.02847924724033, 78.9800247222008, 73.7802111967388, 70.99174309204493, 72.29690456347659, 80.28681596822955, 73.30263913464134, 75.23477066716757, 68.23933669709787, 75.39378779192052, 76.48577375119929, 75.12035858543071, 73.66158167808474, 81.53336718904492, 78.12482301825746, 78.38312537291007, 70.6819902161066, 74.44930367121856, 75.55248221996703, 76.19071076826371, 69.07971330534187, 71.77438885853098, 72.89938993759831, 75.82779239168265, 76.4797275963658, 68.73719058161257, 74.49812961866273, 73.66877372774452, 76.92957316997182, 71.64390465488226, 78.23287081804538, 75.45839144356833, 81.07776286727395, 71.17302421976866, 73.87472025781172, 75.12353950451445, 77.64695511585846, 73.94505666440902, 74.73276831277235, 76.10620309214511, 69.27905448427856, 77.84287194595682, 74.05017732373034, 74.83134907092813, 77.2810062580993, 75.88353027813561, 80.23329936093862, 76.17259144431286, 73.09954501891511, 72.03744702092035, 78.64218383628591, 74.12374073700686, 77.51859831447157, 75.72028999295438, 72.82701172239787, 73.3152928460262, 77.85698979852786, 75.41117741079242, 75.24353167696862, 74.20583444886799, 74.04890222210135, 75.2314029268179, 72.09691291856849, 70.47368900909237, 74.75008087701177, 74.8415429467706, 73.35080384839779, 73.48628149106662, 71.70631293165978, 72.03704600277483, 72.40557843915342, 70.53718172823906, 80.30109111809226, 71.50354343879457, 71.28674585381542, 78.19623830203044, 77.59846527310125, 74.15856308414344, 74.62990365622984, 70.19630319437094, 75.86171893365447, 72.69828638763553, 76.72115566824014, 73.14588842174393, 72.428934550109, 69.54310782732712, 74.23622842813997, 71.6539679424635, 74.39971569812846, 79.50651021828729, 76.98320070511289, 72.44555825418466, 75.73625819732204, 78.77178797092147, 72.91967340529833, 75.33289827635527, 70.81857799364904, 73.31798384693914, 68.4744562150175, 70.6366656406895, 75.18421750546489, 76.53218972584833, 77.88037353403824, 81.86691982985613, 76.27149699100988, 74.69916923730058, 76.06211937266546, 73.76829726378847, 83.11112488972313, 75.41244397632038, 73.47803398792351, 75.47037695532117, 76.04881402753038, 71.80921038755585, 78.21777464638703, 70.13128572424134, 75.51948326727916, 69.60912675792977, 74.49939494761274, 71.46248318398632, 76.10381971970291, 77.07241697067163, 78.0121300344392, 74.56198797648855, 73.49424371645915, 70.11217531583772, 75.84601485237515, 72.37884974798195, 73.20325686545428, 73.53979565891892, 73.84909170691253, 77.27977652430803, 72.95161689097183, 76.39670694015646, 70.95545950034646, 74.12174372292927, 75.48586411415131, 75.24606616837679, 73.65667315602585, 76.21931200288674, 75.58849033956746, 76.07507724385827, 73.8611168458379, 74.72359342894427, 70.37551285952321, 78.09639450133675, 75.50849805324063, 78.09672064295272, 72.7303524604101, 80.57306891962025, 75.78654393769997, 75.62843211553039, 73.66839011828772, 71.47803960802844, 77.02901960055637, 74.36463916050083, 75.27227090677235, 76.64120960241695, 76.57390056568364, 74.6329071515247, 76.24877161162038, 73.41246264680129, 67.80772970790142, 72.51478154631059, 75.11098410261174, 75.46644015170939, 72.88598840683558, 77.74040485906865, 74.73894190528019, 75.53489507040392, 74.17594936825346, 77.52289881590134, 79.484806432571, 67.38692657374028, 73.86330126979037, 75.44147722896358, 73.22113555878194, 78.36424328202956, 77.24871150204226, 74.13804871261894, 74.7618170425231, 74.85153350179047, 73.53777475132789, 78.24450647101324, 70.68040692408698, 77.22407025028971, 73.67738806212672, 75.35568981572752, 72.60942743915942, 74.40444291142575, 75.52821844575554, 72.28630516162586, 79.1855054596909, 75.19336259160323, 71.77174156714158, 71.27558189789967, 74.59460497312308, 75.00135172018602, 76.17062500329712, 75.2329077869628, 75.9361385205425, 77.82638713699512, 78.70085832115947, 74.29714520037403, 72.06426392742789, 77.3480857823137, 73.90366486606437, 75.33639129033979, 74.6283116340801, 71.69359951604766, 70.29778598992468, 73.64660247823626, 76.17327657066748, 72.97282931080481, 76.41365019616826, 74.44645733910774, 75.44602996786837, 73.93412410991552, 78.10355403669905, 72.82739913239917, 77.57163144612896, 73.65892692115682, 74.92347743236677, 73.78882637765363, 75.82582665102113, 72.83802737167304, 73.98705154519362, 72.158308335018, 75.94953529460538, 77.44005804416761, 75.33343760421891, 70.9398928446259, 76.441684874168, 73.38315281565175, 72.1648400755073, 70.47949348319581, 76.02075060437402, 74.15938538654292, 75.41394531963678, 74.90036351721251, 70.40680087636579, 73.58118588179727, 79.76554426338389, 72.37899937961416, 72.66669525704674, 73.12476561178367, 75.12626962538053, 78.541984045948, 69.58838167938015, 75.79371895734336, 72.64050271153617, 71.41194455409457, 72.74682251856413, 69.86132368546029, 71.3751928165803, 72.86933338551171, 77.24803740534016, 73.14232296000382, 78.50724934956513, 75.287588898777, 71.7104664141256, 70.3833432298467, 74.64349158505209, 73.89324591225818, 76.2362943680182, 76.3787471606083, 77.05925940362081, 73.16018671189497, 74.41672862097566, 76.82583312381205, 72.47056892333612, 73.43565818543087, 78.79427040757167, 77.01806674815893, 71.98581055048072, 72.4985536480053, 71.59693812578612, 70.92910175181272, 71.70050469282793, 73.10587878927163, 72.20199810778108, 79.50858607930273, 71.17455568484566, 76.57286274271277, 77.92065649831387, 75.16578827414575, 74.05684171181178, 73.48442194356706, 74.42607453682356, 81.20706826347197, 74.94920220696709, 73.73615234553017, 78.57238801956737, 75.69870082084665, 77.54983440578484, 77.51763971375969, 70.57106758434786, 77.05585164062599, 80.72613799528162, 74.56409918743664, 71.90224421145338, 74.07655444038458, 74.4562654807239, 73.12728140290668, 76.83812747571032, 76.65546855353996, 71.04764512825383, 68.68217615892891, 76.29475131329473, 77.33303377700238, 76.3400157362896, 74.20479532582948, 78.5844517882963, 79.25641934928268, 78.10982372894568, 75.19095622946749, 74.79580159089811, 73.80202254648263, 75.82173334905741, 80.24670076379098, 81.00926875588894, 72.7174056603235, 73.1600931017046, 73.00903696508777, 78.04521278662261, 73.50853676714988, 71.19488106381853, 75.41979751067612, 78.83156619288165, 76.6652289946591, 71.8646379944775, 77.81083625119382, 74.63272319971078, 77.7451625835741, 77.16532474415199, 82.71143102361275, 75.97457910094029, 75.67532502586214, 70.78995307048912, 73.46440882460769, 79.56604710311852, 79.08487100737786, 72.47246279624643, 76.72144438243468, 75.18828987605424, 73.70027111736765, 72.67189550685569, 75.36307541038362, 72.12610175676072, 73.33123014758317, 77.33598747258002, 71.88790717279318, 71.9217387297994, 71.5951144778209, 74.05045983555391, 74.21126125268422, 78.79940783672286, 70.02092106052274, 73.30338616169396, 74.51851425252597, 76.43705855125185, 73.00925387754282, 76.87641051702184, 74.98513585558663, 75.94816798027223, 71.98336550014928, 72.1636579127857, 77.85462679074945, 74.66334210634592, 73.19181606249317, 74.68707198570544, 78.83118517329612, 76.93950532111148, 74.44892063245236, 74.12298406161386, 75.02897181691785, 78.23200014554683, 82.19222716901551, 74.18878921458624, 72.83870309958817, 69.63551155718345, 76.98330460150335, 79.04753985270146, 68.69460483617522, 72.055362196564, 75.17177195501122, 74.21491257218143, 70.93964745493479, 80.62327806057785, 71.60341650902178, 77.297470710328, 74.73001565206161, 74.84298642745487, 77.8422685753405, 76.44307337496681, 71.05616110186337, 74.73662746213964, 78.63759393966923, 79.04462361674948, 74.29861127874422, 72.7051048478613, 69.06248786317954, 74.65452778366779, 75.41800047923145, 75.59506684591126, 81.08011736349106, 73.2518670800341, 68.96747168655034, 78.3801890968118, 72.3439726946771, 77.83366397368877, 75.01596670630832, 77.25632576460356, 77.07904290106846, 76.74402891820407, 74.15786729153602, 75.58527373340131, 74.47685221696226, 74.90107280569966, 75.80532270242101, 80.32350579759277, 71.53900302558377, 74.6536280800969, 80.19277504534419, 74.27686817539481, 72.45290836147579, 75.67050655949734, 72.7075435863538, 79.50688614106231, 78.45149066235042, 73.88565814889073, 76.01255909718222, 76.5778799180766, 75.33813354672064, 72.75981893699876, 75.64295170295009, 77.45722086692243, 71.8485792436671, 71.28281080546964, 74.56504139774371, 76.08871358507623, 75.02186757896142, 73.18467292816187, 76.59322012072717, 70.50313116789566, 71.7228734281361, 79.1380233144523, 71.2782083581047, 79.59165326479844, 76.00797329882205, 69.11411910233821, 75.18098691713077, 71.9762194791528, 76.3133222622032, 71.01232960468818, 76.64314844479712, 75.54828786874619, 71.70299707498044, 75.76972266183647, 68.30139524599801, 74.88206580963242, 76.19889438683417, 76.06067952974362, 74.84333265715212, 73.52406094574043, 75.37250170422301, 75.38163186241493, 75.2588835353883, 72.06681126973021, 73.85856989112352, 73.8412314389921, 78.02481588195334, 71.19149414374078, 70.97352345581152, 74.6294568022363, 76.5113459725617, 73.82067324940067, 72.49651845586772, 82.21445122707362, 73.99684379116748, 74.1811142926465, 73.3877197743888, 78.0720235706935, 72.97975064107206, 75.50679327504582, 79.71153190920498, 76.27365633610835, 72.33840163558126, 79.73645785653666, 74.8818963856781, 76.69369355437797, 77.1127810433566, 73.51529281351682, 70.4099301849727, 78.53595550195092, 75.61298009742174, 76.9842365891255, 71.4575931099136, 75.84159348489779, 71.77290988176497, 77.58041418190109, 70.55144861928096, 75.02768933835604, 75.92413965892162, 77.34779440215762, 77.48685434047755, 71.50630641251125, 74.5549169881799, 72.81672057615785, 74.99626401339081, 77.91130944870719, 71.74168054132494, 79.5316069045533, 73.57777590164811, 72.89346542173618, 76.1240029983494, 74.52849215084923, 75.56917191829626, 72.01886253651088, 70.94503367687827, 76.17179730757768, 71.62087879053165, 76.51763069880238, 77.73139682814586, 75.39077258228167, 78.31880719185249, 75.84529395963136, 74.40115350500972, 77.55054598549368, 71.44279218739003, 76.71290016666298, 74.24019670996842, 79.29317681393282, 73.4822310675174, 79.83956756967004, 76.01988225413535, 70.29532178505488, 73.91471431816802, 73.5885978894696, 75.97267927497268, 80.15599205438114, 72.6005851941881, 78.42880955346008, 73.9092061612437, 74.94613655978895, 74.3782549384452, 74.98156660586334, 75.99311956682405, 71.75907423272591, 74.91104407893766, 72.56260483583611, 71.41319514247881, 72.3703902225251, 70.63941018245518, 77.08389071931767, 77.27530420873109, 71.63191611146696, 75.92456853986252, 70.90674178634355, 75.29974263086147, 75.96152338713215, 72.88739674328578, 72.95618604633349, 75.66739361566023, 78.2768890578431, 73.82921843235233, 72.2231083220925, 74.64304171833919, 76.67649697912614, 72.80415325218549, 77.10134400729436, 75.68640073377384, 75.54616134045008, 82.51180543531032, 71.81840973705715, 78.37335847285497, 80.56427657033001, 72.81347008618218, 71.31677089129859, 74.9474943431817, 79.49716581150724, 71.77113886378496, 77.59156562149059, 70.54809266804541, 75.23717812362923, 75.118228944381, 70.49264537997696, 76.11396200959254, 74.34912775178715, 74.60187880883787, 77.97307661999382, 70.42676682813048, 77.57814362892847, 75.61678224714912, 70.70695448875864, 81.04236909298126, 72.09284115818276, 77.55501609163487, 77.85342964474103, 72.67708866238462, 73.20880671775262, 75.68374389581889, 75.78898214455691, 69.31653105956974, 74.20615389725893, 69.8187212637851, 76.48778236053002, 70.17390323845783, 76.38732244201765, 75.90099101184106, 71.06510663551857, 75.27665866213849, 71.82787540420932, 76.86306563904053, 77.04648810710883, 74.32036811369022, 76.3250888282241, 73.68382169358144, 73.62906492886587, 78.67379494146026, 70.59742182334013, 72.08697082991895, 69.54165428583036, 75.48210452627187, 73.04933799724083, 73.69141112814913, 73.88169158465112, 75.66778402240226, 71.45937995589166, 72.92086124075541, 76.11498177676916, 79.01974628315618, 71.65705887656158, 69.97151920375144, 77.57907658566862, 73.93338242817995, 75.0716428975323, 74.4886715442226, 75.7097234426753, 73.94709487792312, 74.41453766557079, 77.80518254815827, 74.85847556698182, 75.8590285368021, 71.1767976306855, 72.7261826825286, 77.12599135600217, 74.64821333728383, 73.28398921377446, 76.68692087389078, 73.70092508545355, 78.91245465986103, 73.03302259194366, 77.65667326434406, 76.98687178365837, 79.78222595102325, 75.55643448207266, 74.88993528000738, 73.71244802425734, 77.85041159638878, 74.49191950900331, 72.59868541878956, 72.37712755060805, 78.03401258098258, 77.50565264963744, 75.43377406706632, 77.59368420824697, 74.73359389716524, 72.36677900059406, 70.71732693494927, 73.99740391509589, 75.62832528938368, 77.26366641903027, 76.20709296800653, 72.21471824173743, 71.75119406758573, 72.5477875809035, 72.41241685313977, 74.41105848839675, 76.75070026198044, 75.27139176505686, 70.60888850713796, 71.04991627476734, 69.82357113452107, 73.22619216076572, 79.11950782609077, 78.07736064745231, 73.33183665555867, 76.36207385506353, 73.80348157384181, 76.23506504523958, 73.6394873053848, 75.36340668162946, 73.26173295824105, 73.99213891241526, 69.22461572458778, 79.01574580514574, 76.94770142220186, 75.44865435112314, 74.01437655032649, 78.39024933387046, 72.30932837785848, 78.01805523281703, 76.73566539676895, 75.65887246910138, 76.67656310103203, 78.88835130215031, 69.97539216053369, 76.25650628197845, 74.030492580791, 74.19087313445569, 78.1421201953041, 73.70543007040366, 72.47834763837326, 79.39512635195776, 73.82560955073859, 72.34783722654298, 73.82522937894075, 74.24835909414016, 73.59975371640299, 73.31610695684068, 76.34892852542144, 76.1712876757262, 76.69831351196717, 75.20824019990087, 72.67438420781887, 71.55022938931145, 75.80241319236994, 77.58229240936014, 74.2171959581247, 74.51698779774641, 68.07679820448574, 68.82961217371789, 80.29617402327499, 74.20430732855029, 71.78285041073313, 69.99323065494485, 77.94753325144866, 76.34771553807435, 76.58457196238174, 73.40081544583359, 74.82129185560127, 73.83606224902591, 76.07994261392523, 71.45814659965052, 71.41783261095043, 71.43534707898691, 75.67298459884245, 74.23860456459622, 74.20256668993824, 74.97801071413124, 70.96914853546794, 72.12553917287273, 74.21425431212755, 72.62124933266817, 73.12167388769541, 74.16023863298233, 71.06934107373858, 76.35671049442313, 76.72850821862997, 75.54811873918707, 78.56570527122673, 74.71048758761613, 75.37391055428277, 72.07563271480656, 74.98647153458629, 73.20570433208778, 70.00601950362739, 74.28873471038197, 73.33441796444009, 75.34253002216037, 76.32919214935394, 73.17675868215018, 74.10982127637708, 77.54617994057, 72.57123447090625, 74.42571350476696, 72.49227698969459, 72.84569595802641, 72.90470900155911, 74.12242116860803, 73.98184878056561, 72.68705102446589, 75.04011501239508, 76.86998193639995, 76.4870647178798, 78.94446475846357, 75.97553995918555, 76.49723931304665, 75.97350943392715, 77.9987310055296, 74.87819248078269, 80.38266954174588, 73.52418485754085, 74.6994752670715, 72.93436676529458, 73.71748315243464, 77.10232337188177, 73.50133722315242, 77.30288451799781, 68.5190107483143, 73.07950883472253, 73.23016148615712, 77.74309603447384, 78.39742413936276, 75.46610372178301, 71.22369054536672, 68.8218639846388, 76.08430098169634, 73.38227445877621, 71.01861741685985, 70.39581734454978, 72.35833038740887, 76.31427051774898, 74.13323639906658, 76.99729804244835, 76.7928548394012, 76.10855294848184, 74.56641262729366, 73.88212279840718, 70.05130207705699, 77.76280710351097, 79.02056501389458, 69.67164893014078, 71.35937774500626, 77.12642573895732, 70.64233854175964, 71.05360336828706, 80.19544752769417, 76.82894680590537, 77.83854985444168, 73.25523469014915, 80.19922088305643, 73.32631837272424, 74.44311734137737, 73.10625837218544, 75.52016385852512, 77.32328029093779, 77.18598354749724, 74.05343838391994, 81.1427748677776, 74.61813582787043, 74.9335520693995, 71.52157125698614, 78.41931214436289, 79.48308385979544, 80.84340173853711, 73.55891194877537, 73.51977830493624, 72.5588300011853, 69.68581722037803, 73.1092102056616, 73.07682413364766, 73.59438786700625, 77.49172050186844, 78.05999652140659, 78.4257243644473, 72.8283999618712, 73.69967384141286, 77.45941267218365, 77.7441309324657, 81.97088080851846, 75.05171662683671, 74.61259947914141, 78.27123239524218, 76.7648324798484, 75.46389960408088, 78.06129906610175, 71.0578342037717, 73.37232351276484, 73.7188857762461, 72.52246101670389, 73.13934520470659, 72.47452254562987, 75.56339852821101, 76.09424494156534, 70.25337806275448, 80.6444431773905, 71.3314169600762, 76.93939413822119, 66.61007153780568, 73.28716498578225, 71.1643896757562, 79.8945484728696, 72.84550025460157, 70.92347957512087, 76.36532565040122, 76.75908858626778, 73.2751595724024, 75.51713828548753, 72.11898193434354, 75.59863479435052, 74.73363179868922, 78.0349501353502, 75.30106406550094, 71.29872200963624, 75.57848762389595, 75.48533878058416, 72.80903570522779, 75.61601503309768, 74.38751668394228, 74.7839759104356, 74.30672100819321, 74.73377891599678, 78.54546974287474, 72.62469400753803, 74.1327547739761, 74.21661357300881, 76.96004124115011, 71.49058183925185, 74.50770163907667, 74.28913818122064, 72.88791288875551, 79.27225756598303, 75.13296055224868, 72.3737957269433, 73.9396490240843, 74.39880184018456, 78.17042017358722, 77.76426016760466 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Histogram of sample means" }, "width": 700, "xaxis": { "title": { "text": "Sample means" } }, "yaxis": { "title": { "text": "Probability" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create a histogram of the sample means\n", "fig = graph_objects.Figure(\n", " graph_objects.Histogram(\n", " x=x_bar_vals,\n", " histnorm='probability'\n", " )\n", ")\n", "\n", "fig.update_layout(\n", " title='Histogram of sample means',\n", " xaxis_title='Sample means',\n", " yaxis_title='Probability',\n", " width=700\n", ")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Although the variable does not follow a normal distribution in the population, by repeatedly selecting at least $30$ individuals from the population, the sampling distribution of the sample mean is approximately normal. This is called the __central limit theorem__." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since it is not possible to repeat a study many times over, there is uncertainty of how well the sample mean (of a single experiment) estimates the population mean. The code below simulates a single study, taking a random $30$ individuals from the initial population and calculates the sample mean." ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "75.39338504047777" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Selected a random sample of 30 values from the population and assign it to the variable sample\n", "sample = numpy.random.choice(population, 30)\n", "\n", "# Calculate the sample mean and assign it to the variable x_bar\n", "x_bar = sample.mean()\n", "x_bar" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "By the method of __bootstrapping__ a repeated sample of $30$ values can be taken from the sample of $30$ values. This is done by sampling with replacement (which means after each selection of an individual random value, it is returned to the pool for possible random reselection). The code below takes a sample of $30$ values from the sample of $30$ values and calculates the sample mean. This is repeated $1000$ times." ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Randomly selected 30 values from sample with replacement 1000 times and calculate the mean of each sample and assign it to the variable x_bar_bootstrap_vals\n", "x_bar_bootstrap_vals = [numpy.random.choice(sample, 30, replace=True).mean() for _ in range(1000)]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A histogram of the bootstrapped sampling distribution is shown below." ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "histnorm": "probability", "type": "histogram", "x": [ 77.5861881883197, 77.83153363410538, 79.08478275356897, 79.67406311321193, 77.86986822354831, 79.97969629411705, 74.35095133304392, 77.74571791171742, 80.1344974946358, 77.18067556961199, 76.70679765276203, 74.24692376716466, 75.98008499006976, 72.81256736469231, 77.64791058547945, 80.36720055257076, 73.68022574713714, 77.4878347626918, 78.55715459607669, 75.12027175070641, 77.62096008602087, 77.85011694342302, 74.43861253841445, 73.79387906299475, 73.35510610061367, 77.95096171991885, 72.61183028525923, 73.18658754865444, 75.39433725946166, 72.80383646394512, 75.4811410636699, 76.81970165317934, 74.56860336441038, 74.07812454229578, 74.00899157015397, 72.8052923067643, 71.2350038826191, 79.41698124158098, 79.47021078677153, 76.39295246451208, 76.72022876883824, 72.89739759750942, 71.05594585693702, 72.00804358340811, 74.64950933124216, 71.75597004073593, 75.92032167336896, 75.85847797048491, 75.41137703897544, 75.78522394561232, 77.69672283202891, 77.28989856809311, 75.4481367777642, 75.02114378154232, 75.17787534648049, 77.66071619381881, 77.48784371734219, 76.19111749695374, 72.03027320773418, 70.90301806845582, 77.92094590286582, 78.47525391495184, 75.62690851506008, 73.5060881510075, 78.92374170264681, 76.84978764157611, 71.21219866185066, 75.6704164316546, 70.00982989190963, 76.16882172906534, 74.34508297887517, 78.55131723115964, 76.21509608749531, 74.3431838053281, 76.58955663390415, 79.5817730655714, 75.59269835719215, 73.31385946144668, 78.37457263954396, 74.45509414108717, 73.39773707350307, 77.15450644942123, 74.53296736431068, 73.58729376701564, 75.4367595077543, 77.06112807000144, 78.18279552715093, 74.36437446984023, 75.74851869567998, 75.62330094195607, 75.33378543673439, 80.67502984054934, 75.00269932964834, 76.08176853223038, 75.0362797980456, 79.2242570517984, 72.36568499081486, 73.41619035722138, 80.15993813310918, 77.76253669897946, 77.67142456019891, 74.49649448087612, 72.58813931902178, 76.0054088434875, 72.05642979832945, 72.91679157451951, 76.07796828734179, 75.84513286304653, 76.7559997362666, 73.8527805402221, 75.59979105499691, 77.72542557577631, 76.25242782588461, 82.03995351791873, 69.08161214186545, 69.91051670875689, 77.82780278255089, 75.43644657574144, 75.73107646860784, 76.5810522609117, 69.44958735246018, 78.12533923698548, 76.74792584967902, 77.25625062731272, 77.45867245885925, 74.03513919272557, 80.89801482621156, 75.91805542035976, 78.08491771188581, 76.09155151246827, 71.72387762500878, 74.03825539992427, 77.82349800809898, 75.20194873374983, 75.85388790708375, 78.36453381915086, 79.09268767851879, 70.69505612833909, 72.99781783050047, 75.97859090387146, 76.9354760638474, 77.84459730578735, 76.04095481223209, 79.21780200049639, 73.44579487407951, 76.10167154522199, 78.36341201898146, 79.54098900422309, 75.3541917523931, 75.53607003657271, 75.48421529547777, 77.81104484327615, 72.90769683976525, 72.343968194298, 77.10044054115748, 77.26880266861279, 77.56962820220787, 79.41256287356983, 77.35122613086178, 74.44601613788623, 74.71260521510946, 77.6903236780036, 70.5582174160339, 73.95013484629474, 74.46741045874198, 75.65777243752613, 71.83747942625273, 77.62565033755575, 72.8104701758914, 74.83239085060478, 75.3881307683704, 77.17284322465244, 74.98853564372062, 73.10116848432808, 75.52501914666495, 72.23672853643033, 75.98230592358485, 71.47834726795645, 76.66055312917155, 76.42156329991627, 74.90732847022501, 71.79794814012878, 73.66707136349946, 74.08613833888218, 75.62619381660242, 78.10243300245205, 74.7718402093623, 77.50924028535482, 67.85134718064475, 73.67766110223425, 73.79261910057696, 73.39277848725338, 70.25862973671474, 78.81174359468976, 74.19294906668787, 74.81510729272709, 73.92943599553581, 79.63052454868453, 78.7404218458052, 76.47800491211738, 74.23323214577444, 69.97787959899979, 77.52795247958356, 79.98168111773974, 76.26538038193252, 74.96179319824584, 69.72820862041024, 72.08031904333106, 74.62318256424986, 72.89273481571617, 79.71412228994289, 82.50802979716028, 77.79772259225828, 75.00857993562853, 72.32587426488912, 77.64614361785075, 72.56318249469996, 75.16542269676675, 76.59720677710665, 74.3168896417215, 77.4029487970513, 80.72620810333021, 76.49477515338066, 79.972961566482, 73.97545655992909, 75.1238121506977, 72.32802759770145, 76.062895398494, 80.26180596376905, 79.77327782649644, 75.62448083318365, 77.20167773947924, 74.07093574117536, 71.92892337352082, 74.11486540038527, 78.21380400327389, 75.67440818121159, 74.62780633903147, 71.08052779825702, 78.03019539706287, 76.03661460144855, 75.34904572232502, 74.99359311005217, 75.64999552605131, 74.10945528222969, 77.20824018839554, 70.59498228757448, 72.9490985249863, 74.25434117660475, 75.783176470919, 71.47838071974712, 75.65169525102175, 73.23291701068636, 80.22821097799552, 74.63399373376599, 78.54773453956099, 73.9036446927567, 74.70923855163478, 73.05354228816131, 75.44785467588771, 73.05085276902052, 80.3671188638209, 75.48689541417916, 73.83102909038513, 78.63532666828625, 72.09947707258304, 78.11631457889682, 77.23545871102696, 78.86459599888494, 77.45487305452161, 73.2967401656597, 72.0075301118192, 75.47438864650056, 69.28653898026555, 76.59912993844326, 73.92136974587598, 74.55026212764574, 74.91749816938632, 75.44092980119281, 80.3384884768035, 74.60905309760366, 73.50011971917216, 71.80857067595937, 74.95286235315477, 76.65991078006078, 75.37054891750807, 78.37964211303145, 78.4611954704783, 74.04450194128906, 73.81046998183692, 76.96892064165544, 75.4822059039136, 67.758077176622, 76.11066854634969, 73.14228105975327, 73.12511631031157, 77.14654831539238, 79.81772152219224, 71.2253382857008, 75.33700428693875, 74.0683860569276, 79.90221775765654, 71.68381943732632, 73.73628943801471, 71.88434125686037, 74.32769247503259, 77.63218670770294, 72.87259358491133, 75.58024320477406, 75.45593998529543, 78.88338673851698, 80.85994951614934, 80.52956737389455, 70.7943717813862, 76.09573418618466, 74.23821346689448, 71.24062555407161, 79.73361286300113, 73.12673022170473, 75.56702610637505, 73.42547339405628, 78.63004615231507, 74.60615345725233, 71.32808697208465, 73.67692351708448, 74.1090796160783, 66.83249903571044, 74.4965610112358, 76.84963552915511, 79.32782231614584, 77.1461555447294, 81.06483926370676, 75.69936721355398, 77.04702648114389, 78.73468477627245, 74.31661229283569, 78.51676974622323, 78.2687181896325, 76.52002176972812, 78.0906036158032, 73.98265001066234, 69.93798324035919, 79.78165721663562, 75.43897354773704, 78.21224092636838, 74.74926988962768, 74.47180333757201, 75.96962095974378, 75.23841919822836, 73.4542773990623, 80.09131818263153, 69.79313046104683, 75.65731537947231, 73.9996362888508, 73.85377011935476, 74.09244629254073, 77.85353832560845, 76.8107735082579, 75.34547263765451, 74.54077189221242, 76.86586807046903, 75.44364662461157, 71.94951993048082, 75.5862119120936, 74.9589030432856, 72.60697804256704, 73.02581409731711, 73.7200424164051, 78.87365739838104, 73.00978724573744, 77.0450004048302, 77.82766209075426, 80.869656693903, 77.32897227927269, 77.12856577397388, 74.19544136753312, 75.44970170116147, 77.20091104096147, 70.58351895180085, 79.12251428098698, 74.32171660632761, 74.63011687604471, 73.95077408442545, 69.80456287928334, 79.29859691792942, 75.95936961345038, 73.32298773524306, 77.3223052445055, 75.28904177580236, 78.6353549350198, 73.45925744908922, 74.59722333176263, 74.11673678221489, 74.45431398550161, 71.50598631268043, 77.608063496665, 76.22170228438476, 75.14707098026885, 76.44527023435535, 77.79328437652903, 73.82822027027537, 75.1603088386237, 76.11609290347467, 75.82916130188791, 72.50145042159605, 75.39330504035452, 78.08093669673836, 77.76823685933972, 72.50176164043144, 70.6020031307893, 77.6546934790273, 73.73632044304682, 75.60782454563763, 72.03734457648326, 73.37117648768903, 75.42123818741453, 77.20309776526504, 73.66795784053662, 76.42826621568283, 77.23892812568592, 73.58281962386202, 75.89216660833897, 77.32113446440798, 78.06085496519736, 75.07902539760815, 75.0459823997473, 79.16844365211091, 74.90848239751303, 71.82925506348865, 73.04399219826388, 75.09665833332348, 76.2666885718999, 75.62456040654777, 79.15844199768019, 79.57315174864512, 78.01734021365223, 77.87449846672838, 73.61996752627041, 75.56339951902989, 70.27021706414786, 73.13016958797535, 76.73287496750982, 76.49083726617864, 76.67177228121841, 73.779042969995, 78.46086459848783, 79.42711187309214, 76.15014103287893, 73.80661132612774, 70.70753412059648, 75.42214035584357, 75.63154280812344, 75.63936433149685, 73.8926732255155, 76.97369109579914, 74.3087351758498, 75.07949429953368, 75.27876279894514, 75.35794863417374, 71.85881153538914, 79.54117609193577, 77.71042971147371, 73.17068698430803, 77.1902619050726, 74.1289739102971, 70.59002330007773, 79.46923539535452, 70.33917465102128, 73.8216641904943, 74.88279192642285, 72.71688754355198, 69.15778614490567, 74.44430286061775, 74.94829301409708, 69.78106476782483, 77.90717645680719, 76.9330044577088, 75.78982799445939, 74.04019148931235, 77.81430625108152, 77.39656490509293, 79.05556328154961, 77.84210014460767, 71.51683037980496, 76.74753591501822, 75.44620498267005, 74.50109912227099, 74.23577306731481, 79.73981340661301, 74.72185672586106, 75.68222296202437, 70.68466090943856, 73.41984314868074, 73.76653540564679, 73.67328067159227, 75.63720287907637, 80.10319918372198, 76.51841626052392, 80.49229551182898, 74.03319468907844, 74.7435948438735, 74.15090645820452, 79.17482956324186, 77.40416683030108, 81.40509100963912, 74.55118182421394, 77.82729550786753, 74.30842340559232, 73.58980458620327, 76.10627954813718, 77.13621893851177, 70.97813091144879, 71.44531932486488, 74.77363167412535, 75.47488091913192, 75.63534506188101, 78.66620742060094, 74.32338844654376, 70.6693761716706, 76.4267206616327, 72.55660443008006, 75.4512628808577, 74.73488733174351, 73.7045462863611, 70.25967448381608, 74.73069048794173, 72.63186193879908, 76.68545905743092, 72.67817160628219, 72.25279459880296, 73.62651859969758, 76.01591010604058, 74.5109453314585, 70.13542084620181, 81.21011666186047, 76.75125386669902, 75.0147713616906, 73.19932236139987, 76.35105050245933, 73.57410329582689, 73.86139007581372, 75.53445497919715, 67.64529211324445, 75.88824146694536, 74.35161789358128, 77.0522588707368, 74.99679368158873, 72.95111055077442, 75.39211927263017, 72.52343345752767, 78.54413626260137, 71.7522453496177, 77.37440679264824, 73.48381592339918, 74.78608795579825, 73.98706248746801, 77.52114997657162, 68.22650228306544, 73.70802800148029, 72.75125878056323, 72.04022823966872, 76.5029889729057, 73.18776025271289, 76.34876943677278, 74.99190078814476, 74.44970892969204, 74.32224151455782, 74.74778263389271, 75.52982617115501, 79.31588140784744, 76.95813050060138, 74.3706972024563, 74.98003904270053, 76.52113221468416, 77.08162134125425, 71.7427784225345, 75.7516923388442, 74.10019089644996, 73.8920991453795, 79.11719100858915, 76.66213968079938, 76.13916539208773, 78.2733865885548, 81.0347133421587, 76.71673989084317, 77.09150776053613, 76.92586386471227, 77.18872355788811, 75.35935323782851, 76.65688503357919, 74.0067592092289, 75.70065670713183, 72.83352674104039, 76.7805970591804, 73.88397607494896, 74.0622188921843, 74.95339350718162, 77.94773364370711, 76.85985489884327, 78.503021822483, 72.7093862372893, 74.37095476197264, 76.00080544501434, 75.33878219495155, 72.61139979592328, 75.55099295300951, 75.488009929027, 79.86128740614272, 79.52592102063346, 76.75803789216654, 67.75030420997876, 77.99256625829817, 77.77352222228127, 74.36921792244082, 75.21416406999968, 73.16908262763376, 80.7476463183016, 78.15755155814186, 80.34662812824452, 74.24094549649683, 79.51959102641224, 73.67033209936115, 78.63001038392024, 71.77664874649982, 73.5191990762833, 75.24982680963512, 78.59122673237526, 73.80853346778123, 77.80114204970866, 77.53986238239212, 73.43593253088177, 76.55817104282292, 73.41803965014255, 70.6058052202624, 78.38506614472446, 74.68040172362541, 79.302774703157, 72.77940523641662, 71.69864495827359, 76.81488253802958, 77.07603052254481, 75.93254887709864, 76.01902605693923, 73.43233364730457, 73.40259322714556, 74.31722279132472, 72.66512478034747, 74.23574862779768, 77.65151974486535, 77.53054782324942, 72.14969465745088, 73.27963509243502, 72.34279145727764, 74.1271118242354, 72.9507159136359, 70.4715056766001, 74.24173166505093, 73.82115466330761, 69.0633614064927, 71.19401359928946, 75.97939682710765, 76.94940041741408, 76.22645797156288, 79.86008661655848, 71.15373197876973, 77.83500002652232, 74.68802119871768, 77.98230542228686, 75.54364847294622, 72.975189031594, 72.60506582171567, 74.73532680118339, 77.64977366419325, 75.80415262750797, 75.26048330011714, 74.91595017836882, 77.15289417375949, 78.33909589179532, 73.16678663885337, 71.04535876981309, 76.04140181432534, 69.76433359699135, 70.84419170571879, 68.38929902022359, 73.7836027248241, 75.53276176226112, 75.63370890849879, 73.74755822101852, 76.18357463285975, 72.35500792871886, 75.14815816666949, 77.28114049157688, 74.61510204589877, 74.52621324739808, 81.05174594863048, 77.08294084193095, 75.71792136806101, 73.20424278909634, 75.49964115300364, 68.46088158155541, 72.49258743927034, 71.5741725753773, 77.92947908133705, 75.07575268522695, 73.76826322230137, 73.15543769207845, 78.09800609740162, 73.89175215975521, 75.84633311564643, 73.73340339970197, 75.89073206268588, 77.70340105853262, 79.15583549249023, 75.52160078883576, 73.59857607070866, 75.09617644804659, 78.8860184963926, 77.49726392956545, 76.09308032388996, 79.97458920166262, 75.55311199640087, 79.56499734056734, 74.57988554903136, 71.70633443385037, 74.01607625629755, 70.50368943057234, 75.85270673606436, 74.55628146553572, 77.38573085847635, 73.77721616705477, 73.2351541973008, 72.23999937775802, 76.4862919823415, 74.43130603496797, 73.5496957970726, 71.48928342293702, 75.22817037284484, 76.16176533817925, 74.1504577077238, 76.04557826358773, 75.24912768690565, 76.34797611399173, 74.24537666301556, 71.79191817831688, 73.72608907678475, 77.12110341065024, 72.8162217961873, 72.75274628483794, 76.19297923355226, 79.52491648407974, 71.94186338309642, 73.7394592365269, 73.299661995181, 75.77261123952636, 76.93011227654367, 75.14443608084144, 80.58688129916638, 74.38302638889834, 73.3254222681417, 73.47182844818302, 78.48661643032405, 73.58928568886758, 78.24706841999516, 76.5629006917154, 76.67387653309804, 76.94103155606739, 71.50871234305345, 78.65803959237324, 78.14477912820642, 74.69604179684488, 74.79190145983539, 73.4080504185743, 74.77982778877838, 79.8185218888446, 74.03885186153992, 81.46870079481964, 79.43151562311692, 73.84943549331064, 81.73906616176262, 73.23784462961883, 72.02957473939799, 76.47198525390962, 75.2142358210245, 77.41822220187227, 76.52460983760534, 77.1289888153999, 79.09945475111324, 77.54374264010886, 74.19337232674835, 75.53124716248593, 76.19632698585964, 71.56267715107302, 78.64361788523937, 75.11518843255885, 78.76791359702649, 75.50160529878015, 75.95699677952652, 73.33600457149078, 76.86656793289337, 77.81851901256371, 73.66708620382131, 75.68791901143274, 80.92386274240981, 78.96659839862983, 72.9835472535739, 74.65592284446095, 75.0305863382785, 76.52980622372476, 76.73596452808071, 82.99568672228834, 78.19150891141446, 78.10436118368092, 79.76899288887788, 77.08824196070405, 77.47818262100876, 77.54741250032298, 77.30775859402092, 74.56245379286922, 75.60963396542589, 82.25856920336051, 74.71201906682626, 74.80912616672946, 75.52772645378123, 72.65722357587259, 79.3682410505572, 76.60948819096515, 72.25841515326597, 72.40726749850674, 79.62455358193705, 76.05652575918415, 74.25888032120416, 76.70671410899482, 76.50250014529557, 75.4970788478112, 72.84523988135956, 81.23730075641352, 76.27488682693551, 74.5048828571009, 77.14996053424265, 72.00250896567624, 78.16284681669278, 74.40244862622028, 79.23581372571682, 74.77439332581108, 78.88865857493475, 77.96517777701966, 75.7453929702734, 74.83986563765966, 78.39385921677793, 74.80934672366784, 72.82836628783225, 75.78535830747632, 74.02037462794353, 72.71722211508492, 73.58786222161957, 77.37494134411983, 74.36016067213056, 78.09943326168943, 67.67693669332142, 79.15942682370111, 77.57757848788131, 75.90162019315711, 72.67535653262593, 75.57206609815859, 77.38676651071594, 77.7720889661669, 80.97747398888983, 74.45536952913999, 79.07100431445492, 78.74487653272023, 74.67473895234095, 78.42248501936575, 75.32793544136636, 77.4761177220061, 75.67834345474327, 70.76452857029349, 73.63214640001242, 72.31760684522197, 75.8137261515456, 73.7604983191196, 77.89773578493288, 79.26788217112382, 73.49911189688238, 72.60330268480523, 78.34717767567994, 76.2104825238614, 75.87084032060905, 73.08495751715995, 77.28136680193938, 77.56073791944559, 72.40934368508054, 76.69016772637707, 79.20494858404142, 79.05322673374884, 73.51110778400742, 74.8954938297977, 75.6775544339009, 77.72513595001016, 77.39544710012542, 72.29961925457272, 74.57691601889813, 75.18483838460521, 75.8541809235761, 73.90786886134747, 79.93413739825256, 75.8700916748916, 72.89823668472897, 74.52719036957959, 74.2868684367425, 77.88978758619437, 79.13866639910468, 75.07164986058874, 75.50079371576771, 76.28850951773502, 74.7172194033844, 72.8074799845521, 73.03534186048664, 76.92741806164626, 79.75237453892005, 70.57531831540008, 75.49081014987885, 76.41924241460045, 73.23801172571166, 77.93408631182689, 77.52428473840847, 73.75638532720767, 75.77510725667841, 76.94506719791192, 79.05044101595503, 75.14191366007293, 78.00124190394236, 76.16797264041324, 74.91473953603548, 74.95877314944731, 73.52307730612918, 76.44578273782547, 76.81623359593989, 73.8072461581426, 68.736347858382, 76.73267128366135, 77.0801380114609, 74.83075380981633, 72.04794431501335, 78.78052476748809, 74.85434423732218, 74.6265107801431, 77.71504834915991, 73.33747726619244, 80.62177276288834, 71.89457713755328, 78.01000142472552, 74.11702417817179, 74.32041261741638, 76.98050325830339, 78.92269533925143, 72.38541559698098, 73.35679551371213, 75.26240037689874, 77.4112388110955, 74.92421665808284, 76.14171217386368, 74.86872342828669, 76.2056726645953, 68.96376315613803, 75.14235132487153, 76.7534506527009, 73.80800794649188, 72.27366909215992, 73.7187211476483, 77.11324485055964, 78.37432735094914, 72.47720168706901, 75.67480470382237, 75.55750775271532, 78.86804787678108, 69.6489139578419, 80.35123954052347, 74.39193764398458, 79.68499648206279, 80.38153467025676, 76.6364814689475, 69.12208491482207, 72.87915191545184, 75.75413818365317, 75.32620942751932, 71.1502131296823, 73.91549786641303, 73.59089753507958, 74.7876886561456, 74.52849971159502, 75.29684843794408, 77.2278243761581, 75.05504542675506, 73.96676136884307, 70.18138771549698, 72.85457655376426, 77.4648463657718, 69.54484748670484, 74.90374464513927, 70.89653745671544 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Histogram of bootstrap sample means" }, "width": 700, "xaxis": { "title": { "text": "Bootstrap sample means" } }, "yaxis": { "title": { "text": "Probability" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create a histogram of the bootstrap sample means\n", "fig = graph_objects.Figure(\n", " graph_objects.Histogram(\n", " x=x_bar_bootstrap_vals,\n", " histnorm='probability'\n", " )\n", ")\n", "\n", "fig.update_layout(\n", " title='Histogram of bootstrap sample means',\n", " xaxis_title='Bootstrap sample means',\n", " yaxis_title='Probability',\n", " width=700\n", ")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The mean of the bootstrapped sample mean is calculated below." ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "75.41865764207148" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the mean of the bootstrap sample means and assign it to the variable x_bar_bootstrap\n", "x_bar_bootstrap = numpy.mean(x_bar_bootstrap_vals)\n", "x_bar_bootstrap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since there is uncertainty in the sample mean, this uncertainty must be expressed. The code below considers what bootstrapped value that represents a cutoff for the lowest $2.5\\%$ of all the values. There are $1000$ values in total, therefor the $2.5\\%$ cutoff is the $25^{\\text{th}}$ value in the sorted list of values." ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "# Sort the values in x_bar_bootstrap_vals and show the 25th value\n", "x_bar_bootstrap_vals.sort()" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "69.91051670875689" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Dispaly the 25th value\n", "x_bar_bootstrap_vals[24]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The cutoff value for the upper $2.5\\%$ of bootstrapped values is calculated below." ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "80.36720055257076" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Display the 975th value\n", "x_bar_bootstrap_vals[974]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "With cutoff values for the bottom and the top $2.5\\%$ of bootstrapped means, the middle $95\\%$ remains. This is reffered to as a __confidence level__ and the bounds are referred to as the __confidence interval__. With the single experiment mean of $\\bar{X}=75.39$, a confidence interval can now be stated as $69.91$ to $80.37$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The theoretical sampling distribution of the sample mean can also be used to express this uncertainty in the single sample mean that stands as estimate for the population mean. The theoretical sampling distribution of the sample mean is a normal distribution (given the assumptions for the use of the Central Limit Theorem, which are that the sample size is at least $30$ or that the random variable is indeed normally distributed in the population). As with any distribution, it has a standard deviation. The standard deviation of the sampling distribution of the sampling mean is scaled by the sample size, shown in (6). The standard deviation of a sampling distribution is termed the __standard error__ (SE)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\text{SE} = \\frac{s}{\\sqrt{n}}\\tag{6}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In a biostatistics course the SE is shown to be used in the calculation of the confidence interval for a given confidence level. The calculation is shown in (7), where $c$ is the confidence coefficient." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\bar{X} \\pm c \\times \\text{SE}\\tag{7}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For a sample (given that the population standard deviation is not known), the mean in this example would be described by a _t_ distribution with $n-1$ degrees of freedom. The confidence coefficient is calculated below using the `ppf` function." ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2.0452296421327034" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the confidence coeffient for a confidence level of 95% using the percentile method for the t distribution given a sample size of 30 and assign and assign it to the variable c\n", "c = stats.t.ppf(0.975, 29)\n", "c" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The standard deviation for the sample is calculated below." ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "15.102331011505678" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the standard deviation of the sample below and assign it to the variable sample_std\n", "sample_std = sample.std(ddof=1)\n", "sample_std" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "From this, the SE is calculated." ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2.7572957886371574" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the standard error of the sample mean and assign it to the variable standard_error\n", "standard_error = sample_std / numpy.sqrt(30)\n", "standard_error" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The confidence interval is calculated below." ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "69.75408196142938" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the lower bound of the confidence interval and assign it to the variable lower_bound\n", "lower_bound = x_bar - c * standard_error\n", "lower_bound" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "81.03268811952616" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Caluculate the upper bound of the confidence interval and assign it to the variable upper_bound\n", "upper_bound = x_bar + c * standard_error\n", "upper_bound" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notice how close these theoretical values are to the bootstrapped values." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Understanding distributions, the proportions of areas under the probability density curve, and uncertainty in how well a sample statistic estimates a population parameter all form the basis of confidence intervals, making inferences about a population from a sample. With an undersdtanding of confidence intervals developed above, the rest of this chapter examines hypothesis testing." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Hypothesis testing" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Another set of example data is used in this section to develop an intuition for hypothesis testing. Below, values for two identical populations of $3000$ individuals are generated from a continuous uniform distribution on the interval $[50,100]$. The two sets of values are assigned to the variable `townA` and `townB`, to simulate individuals from two towns." ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Create two numpy arrays, selecting from a continuous uniform distribution with a range of 50 to 100, both with 3000 values and assign them to the variables townA and townB\n", "townA = numpy.random.uniform(50, 100, 3000)\n", "townB = numpy.random.uniform(50, 100, 3000)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The difference in the mean of the simulated variable is calculated for the two towns below. Note that since there is no natural order for the two towns, two differences are possible." ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.6250351191522583" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the difference in means between the two towns (town A - town B)\n", "diffAB = townA.mean() - townB.mean()\n", "diffAB" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-0.6250351191522583" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the difference in means between the two towns (town B - town A)\n", "diffBA = townB.mean() - townA.mean()\n", "diffBA" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The two value represent the true difference in mean for this simulated continuous numerical variable for the two towns. In _real-life_, researchers will not ne aware of this true difference. Instead, they can take a random sample of individuals from each town and calculate the sample mean for each town. The difference in the sample means is an estimate of the true difference in means. The code below takes a random sample of $30$ individuals from each town and calculates the sample mean for each town." ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Create a numpy array of 30 random values from townA and assign it to the variable sampleA\n", "sampleA = numpy.random.choice(townA, 30)\n", "\n", "# Create a numpy array of 30 random values from townB and assign it to the variable sampleB\n", "sampleB = numpy.random.choice(townB, 30)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The two sample means and their differences are calculated below." ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.7692322524601138" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the difference in sample means between the two samples (sampleA - sampleB) and assign the difference to the variable sample_diffAB\n", "sample_diffAB = sampleA.mean() - sampleB.mean()\n", "sample_diffAB" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-1.7692322524601138" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the difference in sample means between the two samples (sampleB - sampleA) and assign the difference to the variable sample_diffBA\n", "sample_diffBA = sampleB.mean() - sampleA.mean()\n", "sample_diffBA" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These sample difference estimates are quite different from the actual differences. How can researchers investigate this difference? The answers are _interval estimation_ (confidence intervals) and _hypothesis testing_." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As a review of hypothesis testing, the code below uses bootstrap resampling from the sample data. This is repeated $1000$ times. The difference in the sample means is calculated for each bootstrap sample. The differences are ordered in ascending order and the $25^{\\text{th}}$ and $975^{\\text{th}}$ values are selected. These values represent the $2.5\\%$ cutoffs for the lower and upper $2.5\\%$ of the distribution of the differences in the sample means. The middle $95\\%$ of the differences in the sample means is the confidence interval for the difference in the sample means." ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-5.606524366536519" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Generate 10000 differences in means using resampling with replacement and list comprehension and assign it to the variable bootstrap_diffAB\n", "bootstrap_diffAB = [numpy.random.choice(sampleA, 30, replace=True).mean() - numpy.random.choice(sampleB, 30, replace=True).mean() for _ in range(1000)]\n", "\n", "# Sort the values in bootstrap_diffAB\n", "bootstrap_diffAB.sort()\n", "\n", "# Display the 25th value\n", "bootstrap_diffAB[24]" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "9.043483736816839" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Dispaly the 975th value\n", "bootstrap_diffAB[974]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using bootsrap resampling, the confidence interval for the difference in the sample means (with the order, town A minus town B) is between $-1.77$ and $9.04$. Note that the true difference is in this interval. Note also, that $0$ (indicating no difference) is in this interval." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In hypothesis testing, researchers consider if there is a difference between the mean for the variable between the two towns. This is a __research question__." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In hypothesis testing there are two views of the research question. The two views are termed __hypotheses__, the __null hypothesis__ and the __alternative hypothesis__." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The null hypothesis takes on a conservative approach. In the case of the example above, the null hypothesis is that there is no difference between the mean for the variable between the two towns. The alternative hypothesis is that there is a difference between the mean for the variable between the two towns. The null, $H_{0}$, and alternative, $H_{\\alpha}$, hypotheses are written in (8), where $\\mu_{1}$ is the mean of the variable in town A and $\\mu_{2}$ os the mean of the variable in twon B. Note that these refer to the population parameters and not the sample statistics." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\begin{align*}\n", "&H_{0}: \\, \\mu_{1} - \\mu_{2} = 0 \\\\ \\\\\n", "&H_{\\alpha}: \\, \\mu_{1} - \\mu_{2} \\neq 0\n", "\\end{align*}\n", "\\tag{8}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Until data values are collected and analyzed from random samples, the null hypothesis (about the distribution of the data in the populations from which the sampe was taken) stands. To _choose between_ the two hypotheses, a statistic is required, termed the __test statistic__. In the example above, it is the difference in means." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The null hypothesis could then be stated as :_There is no difference in the means of the variable between the two towns_. The alternative hypothesis would then be: _There is a difference in the mean between the two towns_. This is referred to as a __two-tailed alternative hypothesis__." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If the null hypothesis is true, then it does not matter if a value is from town A or town B. This can be simulated by combining the two sets of sample values into a single set of values. The code below combines the two sets of values into a single set of values." ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [], "source": [ "# Merge the two samples into a single numpy array and assign it to the variable samples\n", "samples = numpy.concatenate((sampleA, sampleB))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `shuffle` function randomly reorders the order of values in the combined array." ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Randomly reorder the 60 values in the samples array\n", "numpy.random.shuffle(samples)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This reordering can be done repeatedly. The code below shuffles the combined array $1000$ times and calculates the difference in the means between the first $30$ and last $30$ values at each repeat, simulating the null hypothesis." ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Create an empty numpy array to hold the differences in means and assign it to the variable shuffle_diffAB\n", "shuffle_diffAB = numpy.empty(1000)\n", "\n", "# Reshuffle the values in samples 1000 times and calculate the difference in the means of the first 30 values and the last 30 values each time, and assign it to the variable shuffle_diffAB\n", "for i in range(1000):\n", " numpy.random.shuffle(samples)\n", " shuffle_diffAB[i] = samples[:30].mean() - samples[30:].mean()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A histogram of the resampled differences in the means is shown below." ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "histnorm": "probability", "type": "histogram", "x": [ 5.30282473317078, -0.05546621294044485, 1.1326167632025061, -1.3611790565146151, -1.674479448194461, -7.535691030531936, -0.872338368072576, -1.6637542945192791, -1.786367705277769, 7.553232681680953, 0.8039523072299346, 0.975150574878171, -2.3139488489503464, 1.4457908137896993, -0.13324598303110236, 0.8450630267875283, 0.3448659058171444, 5.1956612759045555, -10.163231381445968, -3.0451772353527247, 1.654395247015529, 3.988155606707309, 5.618210796821472, -0.270769522518421, -0.7761874861229643, 0.9890019114194928, -2.33119121420566, 1.5347012713330344, 4.040905282758644, -2.542298618207951, -2.297382694613731, -7.203491520396057, 5.754619939872754, -1.205545265225041, 0.8112575659934294, -2.40272484066692, -2.6529458582859604, -1.11157829324371, -0.3327875933616724, -1.764697027064841, -4.568853932784023, 4.394180772311003, 4.838166345811473, 6.016346688455698, 0.2873473898947765, 5.698152800334782, 1.4826354179300978, -3.2918213669910728, 2.7867312666256083, -3.200202216211636, 2.964558167109061, 3.6305507153878835, -6.4867329863403, 2.7480790492797382, -0.8366760583159731, -1.9829813208244076, 1.0656287123608905, -0.9037186290596964, -7.272071454644831, -3.1931337494537217, 3.622422711883374, -0.5943044411049954, 1.598526174772502, 1.9098521229467025, -1.5229019232716325, -2.7513212107338347, 2.0094183073672838, 2.0018698072159538, 3.0740255387066355, -3.339156613287912, -2.3784689790974767, 6.457732974454132, 1.0142771482851884, 0.35019413239136554, 1.4803095962016215, 0.8085511144217179, -4.500338250194275, 2.5894190762630984, 4.381007661760805, -8.639600864583826, 0.7261694873001545, -5.412890664838244, 2.468130265031405, 7.136495004166562, 4.006048108800343, -0.9412753143389523, 3.507183745763186, -1.7005076193480164, -3.593355219834379, -3.1194639860176068, 1.2795856956038847, -2.548332315218687, 6.03229946849433, 0.09463919750160699, -1.786006111175169, -0.8989908887975986, -3.267685326898075, 1.0890491141915533, -5.957217502443953, 4.022038635556427, -3.365304680612283, 7.792211219897055, 1.2184495463929466, 4.967181211664538, 0.3492157368443145, -4.287374935155512, -0.40708040393948863, -0.048095678384115104, -2.880090087159033, 0.13103895634961304, 1.1869708292000354, -1.7195206041092206, -1.7903787238750652, 5.716216682515679, -4.56317474808769, 3.3790239405916793, -2.207743024578349, 0.7528295177955187, -3.3705762162160937, -1.0125176402589346, -2.4572622941601026, 0.930352577420706, 6.309748640867596, -1.3893245084512813, -0.8327569440609324, -1.1493564184528537, -4.002140751883914, -4.4591181682135925, 4.819671528473236, 7.492298205071904, 2.998257321904987, 5.673830349217397, -0.09369440906040438, -0.2034259588789098, 2.3511565682507864, 4.142618827669324, 1.9491139217385438, 1.6107336713983074, -0.008135560368714323, -4.339450077729765, 1.6556438710709642, -7.260206153188335, 1.285643117910837, 4.709069168387288, 2.904704687376551, 0.17263783458663795, 5.840576250718854, 1.1109473273434816, 5.925017411772714, -4.8558551479909084, 6.153327554102091, 1.8316662001234079, 2.8255950241223786, -1.1977996126653778, -6.183039600179143, -3.17023800873946, -0.9737986868179291, 0.40647593872468235, -2.4941014054255817, -2.630960364329752, -7.933245428964156, -6.561207611838029, -7.075301618759099, -2.4162563428741635, 1.473146754241668, 1.35134817739349, -1.251888960448042, 0.7913545186030007, 0.33909866362155583, 2.5334865545777916, 8.701714361154572, 0.7602074511757166, -5.028905970935824, -4.0227796661064446, -0.2066872469341945, -1.4796595638012633, 4.017676254902, -5.411560739281114, 5.769938426842231, -1.4034567948065728, 6.8634499365555115, -1.8104000300461536, -1.8688793615289825, 4.516399973300196, -6.6863132470744375, -1.1466261836410467, -1.9000436164431989, 4.753456900304371, -1.7578226285333756, -1.2300870776651749, -3.427236351122616, -1.7490383943913344, -3.2474954796180526, -4.135843764818958, 1.7184666643667583, -4.314539433291557, 2.328133125727888, 3.1134916236467802, 2.7885004073859534, 0.3124055422109535, 4.8532875678330925, -5.602032150199463, 4.643099579369064, 4.180695432995137, -4.847567948546384, -0.7974460507316508, 0.02880871306800259, -3.750690999424606, 1.1145331925761042, -1.895893756478145, 2.728267090831281, -1.7315323385996777, 4.704890189366196, 3.9922166388400484, 3.2877534266077078, -0.7490540941397228, 5.134229849947786, -4.498442593427427, 6.103990263829687, -4.259468161305676, 0.4043364178935889, -3.9602357006464075, -6.130747303945029, -2.4606470170834456, -5.942914398470023, 3.530265185920811, -10.62478733947863, 0.34761772917048006, 2.8251057593401896, -1.837404622044744, 5.152850032415728, 2.313271314572603, 0.6121437032246035, -2.002737322441206, -4.104173359138855, 1.5476728974766587, -1.1815665981228278, -0.6016645827638598, 3.4123984560442153, -4.251422461968346, 1.0313211779030382, -3.092889015823417, 7.566179653073505, 0.34697648945918047, 4.630116699836762, -1.680804706603709, 1.3868514298018937, -1.5212957161611627, -5.535977704800189, 5.329409928462525, -5.094226347468776, -1.027359203580346, 3.4732090538665688, 1.1665108031350826, -5.045075868560204, 3.337375439801818, 3.2198282758768215, 0.00472497811082917, -5.464222477514497, -5.6106519845229315, 0.1042619346564635, -3.1266664440949796, 3.174211367269308, 1.3897173971771082, 1.481516399897444, -3.422279058961209, 1.6040213752926036, -1.6236722392110892, 0.7537142850896856, 1.1988857365270889, -0.4158277653869078, -5.232774937095428, 2.8417696251871405, 8.406412705615807, -4.1285906603182525, -9.862962838949343, 4.040061915471696, -1.8724296312900037, 0.5450093705512415, -5.614933834029372, 2.9208117399236926, -10.86888947781793, 3.9605721516926877, 3.912340284210117, 1.1069594706088282, 2.443771811715763, -2.554366687598261, 0.12453827496135261, 2.3075466543072736, 3.444271730181768, 0.2797671383345772, 7.513480389864313, 3.1337549007008647, 3.1324388454214187, -2.5113492064654395, 4.304199012926816, 5.52700214837995, -2.0178694840715394, 3.1036000357390634, 5.947403916134149, -0.9435786394567884, -2.1329364146652665, -0.8984510747601888, -0.7431831445507697, 0.5290470544805856, 3.183366367999483, -3.802220354883346, -2.0095691867212224, 1.6570412957090213, 0.5597155406478578, 3.809470492632798, -1.013064638687169, -0.486382050746073, 1.090732845499545, -1.1456052443616613, 3.1496075135420085, 2.238215148983258, 0.3198282420691214, -0.3822505380430812, -1.8420392355009625, 1.9430024010560487, -0.8847048975166558, -1.1185656449397925, 0.45144062797675133, 1.04908688942227, 5.610766505473464, 0.30599365484172836, -4.633042162091812, 1.3724860092276572, 7.045511669532871, -1.9354974196132275, -2.037794034474743, 8.574930679082215, 0.7633848865126822, 1.9129348023804624, -1.9165506355286226, 0.5349261736918862, 2.9551922415427896, -5.648962573452252, 3.036829831044642, -2.3768414126075044, 3.4960601974650416, -3.693827120437433, 0.2586182487817581, 5.294989050419417, -5.095922961212267, 8.346955567293904, 1.583535660679388, -3.5658853287759626, -3.185518540344148, 1.433256930302349, 0.7236012293240748, -0.0955525500241805, -1.9818785649470527, 5.682848586588037, 1.6242589927537807, -0.2667931101978098, 8.714676272982416, -2.497120749202338, -0.5004774351261716, 1.4946076052475945, -2.344579561593804, 0.8753110451139605, -0.6178031025932995, 0.1700719766378569, 0.06544871474585534, 5.325306063430759, -1.9916036294343087, 1.1641355094817243, -7.307866099219112, -3.2617911136938886, -7.507561088126522, -0.151303474017368, -5.218009923690744, -0.26825649478219304, -6.10442673876851, 8.436790653328075, 4.160595370454871, 0.25197562784200045, 0.38683723465871367, 2.6693441208442295, -1.140055785428018, -4.18062494766113, 0.9419283009872856, -7.709296041014383, 5.97648871894809, 0.3188240245223568, 0.6545170530009585, 0.24369719882054142, -8.086710166372484, -0.7286359784635295, 0.3324815113058577, -0.44469272810243865, 0.8522681090075821, 3.9870402259954147, -3.2388920115530624, -0.4569132538135676, 8.4940050502843, -4.473327231609403, 5.284256950395886, -3.3696050656875087, 0.5817329402395046, 2.300368021184056, 6.964401326938258, 1.3669552416531445, -7.176541253702453, -2.969493309804946, 6.51555662191079, -2.549972468798245, -5.161957901535089, -0.46923125213653805, 5.388919635443969, -5.058602311454123, -5.798268191822899, -1.6657443372734662, -0.39319514322011173, -5.1394523759150275, 0.8374160482153172, 0.8535940234754378, 1.2162625145937653, -6.214806082518081, 2.9968124114092234, 2.5048014301450507, -2.419671523529459, 2.363060557318974, 3.5685015121291883, 1.5851612596260765, -1.5536916352544523, 3.2345979620553322, -5.374712512594229, 5.140258349197467, 0.5591753611036552, -0.48196133324854884, 0.0810038607861685, -1.96433448966296, -0.4369428306918479, -3.0435588115157373, -2.2619784627524098, 2.6343313507573356, -2.264468819978461, 1.0646896010241278, -1.814742291417275, 0.7662396523553241, 1.8797290698167615, -0.06601190472758844, -1.0903538470691245, 2.0453035114653204, 2.485742837788436, 0.09702554519635953, -1.5295252462181281, -1.3802511666790451, 2.714419123294334, 4.20650089415679, -2.5299420874255816, 1.465129035764818, -0.876298420058589, 3.846384700143318, 1.2983628448785822, -3.7350843910692646, -2.4636847401178983, -1.34431088949853, 7.12427252313465, -0.21939903165058183, -4.46409237580778, -3.774955386960272, -1.3084806353428462, 5.693464392065465, -4.110362498315922, 7.098186569871217, -5.174908593415623, 2.1790466586492414, 1.3125806135448244, -0.7159490107339224, -1.4095716313603646, 2.1540008565638544, -2.3411361960494617, -9.157688576883388, 1.5290241097304857, -4.227394371426897, -8.4154330647862, -2.2935968107934315, 3.7295961154389516, -4.248725741540312, -3.518693342653819, 0.6857107474225472, 0.6280701271967217, -1.3349507688496516, -2.0745925472037783, 5.982469146170601, -8.997328253811531, 4.249714169138954, -3.204273041244818, 2.621941905242423, -1.0560646287268867, -0.7773169039875114, 2.9095940307488632, -1.5139621448361282, -5.5199214114364, -1.6360865444395785, -5.41733561774187, 3.743630318234608, -5.0149454189412666, -1.8313227910117291, -4.358363211877446, -1.4613343095790157, -2.4112947425473266, 3.5294133774785337, -4.563729885720733, 7.805586589202349, -1.9594380343741733, -4.847067588592921, -5.628707166686766, 2.0327012641594138, -0.3410350904004389, 1.0960859964464902, 3.7959046911997945, -0.2407437757308628, 3.1917474757130435, 2.2093306634011896, 0.3766960563976056, -0.08144702214131883, 4.381273391867666, -0.6070737519600584, -3.8071251848153054, 3.3259175196601944, -4.199983834804982, 3.049863133806909, 3.3243814367153277, 4.207276228300145, 3.7242321992460177, -3.9966333199554356, 1.0226054931642068, 4.706187052783363, -4.18247722161496, -8.310778205555621, -3.782299140346794, 2.4634917394128735, 2.303022075560577, 2.3516599956863473, 0.6381496388314503, -7.18320916777806, 5.46404604612232, 3.3805971776246224, 1.2731652091072618, 0.27054010758499203, 4.093212402690355, -4.6207769658056606, 4.982082233971525, 1.981475392473513, -0.6314624270563485, -1.1486712127530865, -1.310630553332885, -0.9905994091380848, 0.1324629340376049, -2.1558450652885313, -1.9872757960810787, -1.9323199968745683, 0.5733144812362383, -0.7745885968771944, 1.0645146368696885, -0.4219084774394304, 2.1269590178699787, -4.601427433447014, -0.5479261600084584, 1.0037620794069966, 6.214595032599675, 0.4665953760925987, -2.2802288117910052, -5.248319976816191, 3.0883069307003836, 2.735165120233873, -2.789904335575713, -2.6374952640556444, -2.218981865332225, 8.087609517746529, 4.583689196288077, -3.450163936533329, -1.4601146748830303, 0.7512204809780911, 1.9747457855190902, -0.7610274192859237, -0.13822167225021076, -1.2794310058028344, 0.2983092389018225, -1.8963832442567679, 1.8832855695905693, 1.576885432511105, 3.0107550112378334, -1.007103984722292, 2.490797889375159, -2.7933169719337485, 0.4025254369938267, 4.98177545797725, 0.0628897290618795, -4.152303183246062, 0.5837117720416103, 0.7158383370781962, 3.99607718294331, 3.4894714870359707, 3.841929080138897, 3.648140732230843, 2.1652258164955356, -0.45379811444064444, 1.208527921896433, -0.6567313727606603, -2.6189385880198444, -1.6087399710729073, 2.8918337533536516, 2.1094694503657507, 5.130530706012422, 2.2912849519071017, -3.6021777111978253, 0.9546153301566278, 3.85650513863375, -3.8654150044344817, -0.6510602176912528, 1.0329425941743864, 8.396888604166037, -4.294049465112678, -0.21896162202885705, -2.760329286242353, -4.278996021338784, 1.9839897489379865, 4.150175506983899, -0.6294832457400474, -7.826327082982374, 5.41667949355822, -0.01532509461762288, 0.6186167541679026, -5.1468031527516445, -1.66495207531851, 5.789841753481397, 2.3041047193595574, 2.8542189306795223, 5.4741844663798815, 4.484632832826932, 3.7388331381163056, 2.372979803881492, 8.038820804580439, -0.12459589307552221, 2.4672713158980315, -3.68969973171032, 3.2725848286556527, -1.2211691674587541, 8.183068653955615, -2.3341698156062165, 3.934873043863334, 4.495749440632125, 2.006178166440904, -7.838363395843089, 4.2809513554882415, -2.9740285970587053, 1.3163539084190603, -6.035397553591963, -5.167816532524768, -2.2296308257616175, -1.681713389089083, 3.340678222046165, -6.505951546465397, 0.07934058659965615, -2.4323243246807635, 2.9222544411924787, 0.09947909501833863, -0.263322963312703, -2.6019976118514307, 2.516415978676079, -1.286843284005542, 3.864864367965126, 5.188544379666837, 4.665507873973326, 1.39376806710942, -5.588438960618788, 4.7347575882376844, -0.920356696782946, -0.5598158697427493, 0.07663456598204732, -0.04115042385571144, -3.9435212538231212, -1.791326423040985, -0.3382155244707974, -3.7106237790245444, 0.4769565832716438, -1.8547528361674779, -1.1664621112545461, 0.11169115699814824, -0.829224855455081, 4.057859922402912, 4.491344746528668, -1.398723595121794, 2.561526303559063, 2.0490890779182678, 0.7757525173106643, 0.6866271100547721, -1.7334044105547122, -4.6633586972476735, 4.292338476554022, 5.024064545661986, -2.6522668708692976, -9.888870632617241, 2.174956930716931, 1.3034445594943236, -6.646584992975761, 1.4542575131355449, -4.378126792852953, -1.0183359496833333, 2.296070343841876, 0.4143847368785458, -3.3520030457902408, -3.7062120136980923, -0.9452429501859143, -0.5700427793106968, -1.8251295221035377, -0.0642817028229814, 1.4496094541480886, 4.852930892133628, 1.5809577645373167, 1.2608478342156388, 4.122113580734833, -1.2405862452262824, 0.2629410517239137, 5.1547212400034255, -1.2818550397250732, 1.7552545777963502, 3.376553372350969, -0.5670683771673026, 5.025988212961366, -0.009780820395221212, -2.66086447526628, 5.8683678914907915, -1.5067493138265036, 1.5444494006105174, 1.5398225105410006, 1.5893155310496212, -3.89072900510277, 1.3296501368559177, -5.022402311307161, -1.7976235431176093, -2.468993782507553, -1.5487920568342588, -4.570230193727667, -0.7657172367765384, 0.8848404185189338, -2.6497937438424373, 2.7814577344922924, -3.6641291655985953, 0.22191320950422266, -3.531813106947581, -6.169153292039539, -4.662701410568943, 0.4892210899511724, 0.20112284102556544, -2.998953270920154, 3.490098347508294, -4.048700357461556, -4.5275275868796285, -3.4096664989195204, 2.6471110252497994, -0.39884665700479616, 1.6220462262382398, -9.997622455524777, 3.663779520132181, -4.061717904590282, 2.0991414158705055, -3.6052916132806416, -1.482200205320197, 4.326074384246752, -3.142915234575497, -3.51155926425038, 2.5246531415542393, 1.4062233244787734, -2.582925487554789, -3.6111587004722594, -4.0912842433449725, -2.286383631888839, 0.7037685149365274, -1.1617787279379712, -1.1520789341672923, 4.190982533827821, -7.974476287328571, -2.252764945996418, 0.5091457869430087, 1.17039020690666, 6.434016823749673, -5.9840286931600275, 2.318973372978377, -1.378927868581286, -2.9270702360511933, 3.0805498436227055, -3.1177332016018084, -5.004286062328447, -3.409403275012295, 6.367105772115906, -0.1442301138872608, -5.810478665497442, -2.6974723143146377, 0.9851045587976017, 2.030112432835466, -7.296136354103027, 1.1205533302170636, -2.2891105162988765, -1.3764735516852795, -0.16746544753031856, -1.2408811592159026, -5.2153217121768165, -0.26462173970732294, -0.5936059740386668, -3.805961676715526, 3.197739943285569, 0.5187752739969511, -8.88284953021288, 1.7295917707209156, -1.6854066034299393, -5.064374015163409, 4.918501127502097, -1.4976699980519044, -4.439240952439789, 4.879532436028583, 0.2549353480359855, -1.765451821733393, -6.931263778179485, -4.459418051359663, -1.843912587502416, -1.8524415960672087, 1.9451649843114893, -4.288245385830763, -5.962104620835149, -3.930828739811872, -4.870635643590674, -0.8220034062063064, -6.005861402802282, -0.3216581898305577, -3.249829730794602, -1.8759052887442493, 7.4606318709968775, -2.2332322984574375, -1.308564409401285, -0.06631415477127689, -0.12631943975335957, 5.2943558093541725, -0.7718052798254149, 1.086275490373552, 1.700531478607516, -2.3017287347415447, 1.1319859771041934, -0.3160976000753237, 2.0034423890835455, -3.559396980027998, -5.278002598709961, 1.92855961772851, -5.924758059549802, 4.833871441505849, -6.918566011161801, 0.329713211077447, 1.700841663449438, 0.7624991353965811, 0.0069053520977178096, -2.577352892652044, -1.7095970924594894, -4.196773974034016, 2.220578503810003, 1.8254014714298847, -2.760412314413088, 1.0884653704487306, -1.9989750292166804, -3.419364567275437, -4.435737292775443, -5.631650438967185, -2.53425342512746, 1.0671217578003507, -4.267737100082186, 6.091431987804, -0.8082175005039574, 1.7163003321528407, 3.1708622344285686, 3.2737649452024584, 0.9189439431543462, -1.262010673605758, 1.9257021892679802, 0.15379924348638951, -4.2221262116814415, 6.4835956301269135, 0.16558807267860232, 2.5472843348023986, -2.245834824381987, 2.8539546518852603, -1.5104360190480577, 1.3895040397561047, 6.966033694559599, 0.2625106524908034, -0.8613954809223259, 2.0581420894657327, -4.234821215131433, 6.526403245025222, -4.485627565243448, -3.452170408217313, -1.8196477616745028, -0.35555847489588643, -1.108082913186152, -2.460141355118182, 0.08686988731706435, -0.5634594848997949, -6.8800519853546405, -4.34680015604512, -1.3626265994320477, 3.9939357785910943, 8.042992046043253, 3.1305175487245123, -2.462037444301174, 2.2645702791449622, 4.327424778906362, -0.6055655554291803, 1.1030360293118804, -2.7668834810847756, -0.1665247501223206, -2.056526204132652, -2.7024287150264428, 5.715891447332325, 0.023915701012370505, -1.7937270461023047, -1.735281290499202, -1.8034045974093544, -5.520446578688222, 1.7624936599487455, -0.8500907554569039, -1.0558328476812733, -0.06836180785219881, -10.358685232186588, -0.24086429147156707, -3.884165538230306, -3.017827091540113, 2.5225977418611336, -2.3007575986124067, -1.2210938769831756, -6.289308738509973, 6.136841662388505, 3.382086256912231, 0.11982738388728364, 5.154686744605613, -6.416237733857159, 4.672863143249074, 0.24999074108626473, 4.532785788019112, -0.4009200216043354, 1.986634311095301, 5.129034170979764, -0.9151412570203803, 0.8524439538331592, -4.133736470305692, 2.3684891211121624, 0.20932023893396945, 1.7449979542712981, 3.018945816398883, -1.5713057850590815, -1.6644142785511917, 7.4758745259857875, 1.3313533271042388, 1.4826352862652215, -0.4124029739914761, -1.7185928506735024, -1.4061043429058486, -5.0485816653138045, -1.7681050425521647, 8.121554918248236, 10.043696741592228, 5.868962425502488, -2.4973947706623676, -2.7609575992376847, -2.6905268727996656, -5.891602857159256, 4.4842327609981965, 1.0665708298190424, 1.7640292475248032, -0.34412023194936125, 6.251835282798922, -1.0344326258947518, -5.455109604421196, 7.851093043698185, -2.03644056012908, -3.109130542741113, 0.4963205729841462, -1.2191513363430033, 4.86028057338099, 5.659497866078581, -3.333343846032207, -1.076536947968421, 2.070463697734766, 0.2901390610460197, -4.081165703890932, 4.475598056578292, -0.5624346537156697, -4.47751133184849, -1.3465694120996687, 5.748859003218584, 6.440485484094381, 3.0671862892430966, -4.072310834256271, 0.5758039574918143, 1.1840731638043138, -3.0222293274080556, -2.1075286609516724 ] } ], "layout": { "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Histogram of shuffle differences in means" }, "width": 700, "xaxis": { "title": { "text": "Shuffle differences in means" } }, "yaxis": { "title": { "text": "Probability" } } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create a histogram of the shuffle_diffAB values\n", "fig = graph_objects.Figure(\n", " graph_objects.Histogram(\n", " x=shuffle_diffAB,\n", " histnorm='probability'\n", " )\n", ")\n", "\n", "fig.update_layout(\n", " title='Histogram of shuffle differences in means',\n", " xaxis_title='Shuffle differences in means',\n", " yaxis_title='Probability',\n", " width=700\n", ")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The proportion of values less than $-1.7692322524601138$ and more than $1.7692322524601138$ is calculated below." ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.613" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the proportion of values in shuffle_diffAB that are less than -1.7692322524601138 and more than 1.7692322524601138\n", "(shuffle_diffAB < -1.7692322524601138).sum() / 1000 + (shuffle_diffAB > 1.7692322524601138).sum() / 1000" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is the probability of finding the difference in means from the two samples or more extreme. Note that the sampling distribution of the difference in the means was created given that the null hypothesis is true. An arbitraray value can be set indicating the willingness of the researchers to falsely reject the null hypothesis. Rejecting the null hypothesis requires accepting the alternative hypothesis. This value, termed the $\\alpha$ value, is typically set to $0.05$. For a two-tailed alternative hypothesis, this indicates a value in the lower $2.5\\%$ of bootsrapped values or in the upper $2.5\\%$ of values." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this case, the _p_ value was $0.613$. This is larger than the $\\alpha$ value, leading to a failure to reject the null hypothesis." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As with intreval estimates, a theoretical distribution of the sampling differences in means can also be used. One such test, known as the equal variance _t_ test (or Student's _t_ test), determines the _p_ value. The `ttest_ind` function from the stats module of the scipy package can calculate the _p_ value." ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "TtestResult(statistic=0.46467545416265077, pvalue=0.6439036104859195, df=58.0)" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Use the ttest.ind function to calculate the t statistic and p-value for the two samples\n", "stats.ttest_ind(sampleA, sampleB)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The _p_ value is very close to the _p_ value calculated from the bootstrapped sampling distribution of the difference in the means. In both cases, the value is larger than the chosen $\\alpha$ value, leading to a failure to reject the null hypothesis. The null hypothesis is that there is no difference in the means of the variable between the two towns. The same conclusion could have been taken from the confidence interval that contained the value $0$, indicating no difference in the means of the variable between the two towns." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Quiz questions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Questions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Consider the array below, representing diastolic blood pressure of a given simulated population of $100000$ people." ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [], "source": [ "# Seed the pseudo-random number generator\n", "numpy.random.seed(28)\n", "\n", "# Create an array of random values from a normal distribution with a mean of 85 and a standard deviation of 10 and assign it to the variable dBP\n", "dBP = numpy.random.normal(85, 10, 100000)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The population mean is calculated below." ] }, { "cell_type": "code", "execution_count": 48, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "84.95549142317857" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Calculate the population mean\n", "dBP.mean()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Use the random seed value of $12$ through to answer the following questions or perform the indicated tasks." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1. Select a random sample of $40$ individuals from the population and assign the created numpy array to the variable `sample`.\n", "\n", "2. Calculate the sample mean and assign the value to the variable `sample_mean`.\n", "\n", "3. Calculate the standard deviation of the sample and assign the value to the variable `sample_std`.\n", "\n", "4. Calculate the standard error of the sample and assign the value to the variable `standard_error`.\n", "\n", "5. Calculate the confidence coefficient for a $95\\%$ confidence level, given the sample size and degrees of freedom, and assign the value to the variable `c`.\n", "\n", "6. Calculate the lower bound of the confidence interval for the sample mean and assign the result to the variable `lower_bound`.\n", "\n", "7. Calculate the upper bound of the confidence interval for the sample mean and assign the result to the variable `upper_bound`.\n", "\n", "8. Create an array of $1000$ bootstrapped sample means (using the sample size of $40$) and assign the array to the variable `bootstrapped_means` and sort the values in the array in ascending order.\n", "\n", "9. Show the bootstrapped value representing the $2.5^{\\text{th}}$ percentile.\n", "\n", "10. Show the value bootstrapped representing the $97.5^{\\text{th}}$ percentile." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "datascience", "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.10.5" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }