

- EXPLAIN AT LEAST TWO ORIGINAL STATISTICAL CALCULATIONS. CODE
- EXPLAIN AT LEAST TWO ORIGINAL STATISTICAL CALCULATIONS. TRIAL
Then, simulate repeats these trials depending on how many times you’d like, returning the average number of heads across all of the trials. It uses the random() function to generate a float between 0 and 1, and increments our heads count if it’s within half of that range. The coin_trial function is what represents a simulation of 10 coin tosses. Our process is summarized in the image below as well.
EXPLAIN AT LEAST TWO ORIGINAL STATISTICAL CALCULATIONS. CODE
The code below simulates 10, 100, 1000, and 1000000 trials, and then calculates the average proportion of heads observed. If we perform many, many trials, we expect the average number of heads over all of our trials to approach the 50%.
EXPLAIN AT LEAST TWO ORIGINAL STATISTICAL CALCULATIONS. TRIAL
We may not get the “ideal” 5 heads, but we won’t worry too much since one trial is only one data point. Our data point will be the number of heads we observe. We will call a set of 10 coin tosses a trial. Our data will be generated by flipping a coin 10 times and counting how many times we get heads. If we don’t want to make the assumption that the coin is fair, what can we do? We can gather data! We can use statistics to calculate probabilities based on observations from the real world and check how it compares to the ideal. However, even though it seems obvious, if we actually try to toss some coins, we’re likely to get an abnormally high or low counts of heads every once in a while. By looking at the events that can occur, probability gives us a framework for making predictions about how often events will happen. Thus, probability will tell us that an ideal coin will have a 1-in-2 chance of being heads or tails. To calculate the probability of an event occurring, we count how many times are event of interest can occur (say flipping heads) and dividing it by the sample space. These two events form the sample space, the set of all possible events that can happen. In a coin toss the only events that can happen are: The quintessential representation of probability is the humble coin toss. To calculate the chance of an event happening, we also need to consider all the other events that can occur. What is probability?Īt the most basic level, probability seeks to answer the question, “What is the chance of an event happening?” An event is some outcome of interest. If you are uncomfortable with for loops and lists, I recommend covering them briefly in our introductory Python course before progressing. Similar to the previous post, this article assumes no prior knowledge of statistics, but does require at least a general knowledge of Python and general data science worflows. We’ve previously discussed some basic concepts in descriptive statistics now we’ll explore how statistics relates to probability. It is easy lose yourself in the formulas and theory behind probability, but it has essential uses in both working and daily life. When studying statistics for data science, you will inevitably have to learn about probability. JTutorial: Basic Statistics in Python - Probability
