Video Transcript: Review of Data - Part 1
Welcome in this section of the course. What we're going to do is wrap it all up and bring it all together. In this first lecture, we're going to talk about all the concepts that we've covered throughout this course, so we can see how they all fit together. Then, over the course of the next two lectures, we'll look at an actual real-world example work from beginning to end. So, let's jump in and remind ourselves of pretty much everything we've been learning throughout this course. Remember all the way back to the beginning, we talked about the idea of really what is data, and data, if you remember, is just the idea that we have factual information used as a basis for reasoning, discussion, or calculation, or that information was just the idea of a measurement or a value that describes something, whether it's an object, a person, a place, or a thing. From that information, we wanted to be able to gain inference, where we use that information to come to some kind of conclusion. And the goal of drawing those conclusions is really to make better decisions in the context of our problem. Right, a lot of times we were asking questions about who, what, where, when, why, how, and so we're trying to use data to inform us about better conclusions and decisions we can make about whatever problem we're running into. From there, we learned about the idea of a data table, we looked at how data was structured when looking at individual observations of data all the way to different variables inside of data. With those variables, we looked at two different types of variables. We looked at categorical or qualitative variables that summarize things as categories like month of year or season or day of week or type of weather, then we also looked at quantitative or numerical variables that really used a numerical value to be able to summarize things like number of casual users, number of registered users, or temperature or humidity. Remember, you know something is numerical in nature if you can do some basic arithmetic on it. For example, what is the average temperature? Well, that makes sense. However, when we have a categorical variable, what's the average day of week? That doesn't make any sense. So, we have all this data, and we learned that data is pretty much everywhere, it's being gathered all the time. In fact, you're producing a lot of data yourself, and so a lot of times what we do is we need to think about how to be able to gather this data, so we can make correct inference. And so we talked about this idea of gathering data, and it involved four main pieces: the population, the sample, the statistic, and the parameter. The population, remember, was a set of all objects or all individuals that you were interested in finding something out about. Of course, you couldn't talk to the entire population, so instead you took a sample, which is really just a subset of the population that information was actually obtained about. Now, what is that information you obtain about a sample? Some measure you compute from it. Well, that's what we refer to as a statistic. A statistic is just a calculation from our sample. That statistic, if you remember, is what we use to estimate a parameter. The parameter is some measure calculated from a population, but just like the
population is unknown, the parameter is unknown. So we're using the sample to give us an idea about the population, and from that sample we get a statistic to estimate the parameter from that population, and so we talked about this idea of taking samples, because the better the sampling that we had, the more believable it's going to be when it comes to that statistic estimating that parameter, and we talked about the idea of randomness and having randomness helping us make the sample representative of the population. This again protects us from having certain pieces of information overly influence our sample, with again the goal of sampling being that we can make good inference from the statistic to the parameter. That's the main idea of what we're trying to do, right. We're trying to estimate something about a group of people we cannot see in totality, so we can see a small subset of them, and if we take that subset really, really well, then what we can do is we can rely on what that subset is telling us about the population. Of course, there are incorrect ways of doing this, as well. Bad sampling methods lead to bias, sort of that garbage in, garbage out kind of scenario. Good sampling methods wouldn't lead to this kind of situation. Now, remember, bias means that we're basically favoring certain outcomes over other outcomes in a sample. There are very common types of bias that are out there. They're typically broken into two groups: selection bias and sampling bias. And we talked about a couple examples from each. For selection bias, we talked about under coverage and nonresponse. For sampling bias, we moved into the world of convenience sampling, or voluntary sampling. Either way, none of these techniques were good ways of being able to ensure that we had a reasonable and reliable sample. So, of course, we talked about good sampling methods as well. We talked about four common ones: the simple random sampling technique, where every single observation, and really set of observations, has an equal chance of being selected, a stratified random sampling technique, or we learned about breaking our sample into groups ahead of time, and then taking a piece of each one of those groups to make our sample. We talk also about cluster sampling, where again we take the population and break them into groups ahead of time, but instead of looking at all of the groups, like we did in stratified sampling, we look at only some of the groups, sort of a sample of the groups of the population, and from each one of those sampled groups we take another sample, and then we have the idea of systematic sampling, sort of a quick and dirty way of being able to get some notion of sampling from there, we moved into ethical considerations around data. The gathering of data, of course, leads to questions around ethical collection and use of that data. As Christians, we are held an even higher standard around ethical considerations in observational studies and experiments, we must keep the interest of the subject we are collecting data from at the forefront, and there are a lot of things in process to be able to help us do this. Institutional review boards, making sure we get informed consent, and then also making sure we respect confidentiality,
but again making sure we keep the subject at the forefront is one of the best ways of being able to use data ethically. From there, once we learned how to be able to collect our data, we moved into exploring different types of variables. For categorical variables, we explored both within a category as well as across categories for continuous variables or quantitative variables, numeric variables. We explored center and spread, and really sort of the overall look of the variable themselves. And accordingly, we talked about this idea visually, always, always, always try and visualize your data. It helps you see things a lot better. For qualitative categorical variables, we looked at a couple of different charts. We looked at a pie chart, which was a graph in which a circle is divided into sections that represent a proportion of the whole, whereas a bar chart has numerical values of variables represented by the height or the length of lines or rectangles. Now a lot of times a pie chart is when we're looking at again the population or the groups as a whole, and really what their proportional breakdown is. A bar chart can be used to compare just subsets of groups. You don't have to look at all of them for numeric or quantitative variables, we use things like line graphs and scatterplots. A line graph uses lines to connect individual data points over time, where a scatterplot uses the two variables and plots individual combinations of points for them. So, again, you have one variable on an x axis, one variable on a y axis, and we're seeing what values take place together, and we really are looking for the pattern of the resulting points to see if there's any kind of relationship that's been revealed when exploring variables numerically. On the other hand, we looked at sort of measures of spread or center, and so when looking at measures of center, we looked at things like the mode that would be great for categorical variables or qualitative variables. Basically, it's the value of a variable that happens the most often. For numeric or quantitative variables, when coming to center, we looked for things like mean and median, where the mean is just really summing up all the values and dividing by the number of values, it's just the average, where the median is the number right in the middle. Now, when it came to spread, on the other hand, or variability, we looked at things like range, which was the difference between the largest and the smallest values, as well as measures of variability called variance and standard deviation. Remember, these two things are tied together. Variance is a measure of dispersion around the mean, however, variance is also measured in squared units. Standard deviation is the square root of variance to be able to help. With the units great, so now we started looking at this data, and we started exploring our data, and starting to understand what our data looked like. Then we had to take a little bit of a detour, and we started talking about the notion of probability. The reason was when we were looking at probabilities, we needed to define these, so we could look at distributions of data, so when looking at the probability, remember the probability that an event happens is just a numerical measure of the likelihood of that event's occurrence, and it takes a value from
zero to one. The closer to zero the event is unlikely, the closer to one the event is very likely, with a probability of zero being it will never occur, and a probability of one being it will always occur, and if we were going to talk about probabilities, we also had to talk about a couple of things, like the law of large numbers. The law of large numbers states that as the number of independent trials increases, in the long run, remember we talked about this in the long run, in the long run, the proportion for a certain event gets closer and closer and closer to a single value. We call that single value the probability of the event. Remember, although that the law of large numbers is real, the law of averages is really just a myth. From there we were able to build a probability distribution, so the probability distribution for a random variable describes how probabilities are distributed over the values of these random variables, and so now we can start piecing everything together. We have probabilities, so we know that certain values inside of a variable may occur more often or less often, and then we can even look inside of a variable to get again those notions of center or spread, so all these concepts are rolling up to this idea of a distribution, and relative frequencies were what we used to estimate the probability of an event occurring, especially when it came to discrete random variables. In fact, probability distributions for discrete random variables are best described with tables or graphs or equations, like the example we worked through here. Remember, we worked a lot through this example, where x was the number of TVs sold at a small department store in a single day, and X can only take the value 0, 1, 2, 3, 4, 5, Once we looked at this, we could look at the actual distribution below. You know, how many days did we sell zero TVs? Well, 90 days. How many days did we sell one TV? 85 days, and so on and so forth. From there, we were able to calculate the probability of any one of those occurrences, so the probability of us selling zero TVs was 0.25, because it was 90 out of 365 So now we have this probability, but we also looked at the idea of being able to measure an average, or again a notion of center for this distribution, so we calculated what we call the expected value, and the expected value of the number of TVs we were selling on any given day was 1.88 TVs with a variance of 2.522 So again, notice how we wrapped up all the concepts together. Once we sampled our data, we started looking at our data. We looked at it in terms of measures of center and spread. Then we looked at probabilities, and then we wrapped all those concepts up together to get an idea of a distribution of a variable, as well as an idea of summarizing that variable in terms of center, spread, or probability of something happening. From there, we moved into a specific example of this, specifically the binomial distribution. Remember, the binomial distribution looks at the probabilities of the number of successes occurring in n independent trials. Think about the flip of a coin and how many times you were able to get heads in 10 flips of a coin, for example. Now, the binomial probability function was comprised of two intuitive pieces. It was the number of outcomes providing
exactly that many successes in those n trials, as well as the probability of a particular sequence of trial outcomes with that many successes in n trials. So we combined these together and looked at a couple of different examples, then we moved on to the idea of continuous random variables, so again we're generalizing even more, so with these continuous random variables, we said they can assume any value in an interval on the real line, or really in a collection of intervals on the real line, and so the probability of a random variable assuming a value inside of an interval was really the area underneath the curve, so we looked at this distribution, and we were looking at area underneath. It's very similar to what we did when it came to the discrete example for zero TVs. We just looked at essentially all the observations with zero. The problem is there's infinite. Many observations on a continuous random variable, so here we have to look at ranges. We looked at a couple examples of these as well. If you remember, we looked at the uniform probability distribution. The uniform is a common distribution where every single possible value has an equal chance of happening, but more importantly, we also looked at the normal probability distribution. The normal probability distribution is one of the most common and important distributions for describing a continuous random variable. In fact, it is the foundation of statistical inference. It helped us develop things like hypothesis testing and confidence intervals, and we also saw that it appeared in nature and in real world data. If you remember certain characteristics of the normal distribution, the normal distribution had some very useful characteristics. First of all, it was perfectly symmetric. It was unimodal, basically meaning it had one big hump of data in the middle. It is mean and median and mode were all equal to each other. It was asymptotic to the x axis, which means that it could take any value from negative infinity to positive infinity, even though the closer you were to the middle of the distribution, the more where that data actually is, and the further from the middle, the less data values we typically actually see. And again, it's completely defined by that middle, that average, that mean, and the standard deviation, the spread of the distribution. From there, we learned about some great things we could do with the normal distribution, like we learned about the empirical rule that basically told us within one standard deviation of the mean lies about 68% of the data you have in a normal distribution. Two standard deviations from the mean you have about 95% Three standard deviations about 99.7% So we can see a variety of different data points here, and what the real look of a normal distribution does. And so we could do some very quick mathematics, if you knew what the mean and standard deviation of your normal distribution was, you could figure out some easy values where you think your data is going to be located. However, we then sort of saw that we can't do this for all values inside of a normal distribution, so we converted our normal distributions from any normal distribution that we had to a standardized normal distribution. The value of converting these things to a standardized
normal distribution was basically for the point that we could answer this probability question about any single point inside of the distribution of our normal from there, what we did is we learned about the idea that we could have some sampling error, and we started talking about sampling distributions. In fact, we looked at the idea, if we were to take many, many, many, many, many, many, many samples and calculate the same statistic from each one of those samples, would that statistic have a predictable pattern? And it did that with the central limit theorem. If we were to use large samples, basically a sample size of 50 or more, the central limit theorem said that the sampling distribution of the sample mean is approximately normally distributed, regardless of what the population distribution looks like, and now everything has now been wrapped up together, right. So we talked about probabilities, we talked about center, we talked about spread, all for setting up the foundation of a distribution. Why? Because of the central limit theorem. The central limit theorem says that sample means follow a very specific distribution, that normal distribution that we talked about. Now, if we have a small sample, the sampling distribution of x bar is approximately normal only if the population actually is normal. So, take large enough samples, and sample means will basically approximate a normal distribution, regardless of what the population looks like. From there we actually got the sampling distribution of x bar, so again the sampling distribution of x bar is basically a collection of all possible x bars from all possible samples of the same size from your population, and we learned that the sampling distribution of x bar is normally distributed with a mean being the overall population mean, and the standard deviation being the population standard deviation divided by the square root of our sample size, the bigger the sample, the smaller the standard deviation of the mean, because of the fact that we were more exact and more reliable in terms of our estimate, we also learned about the idea of p hat. P hat is a sample proportion estimating a population proportion. We learned how proportions actually also follow the central limit theorem, because they're basically like averages, so therefore they followed a normal distribution. We learned about their expected value and their standard. Deviation, as well, once we had the idea of what the distributions look like, then we could measure some notion of error. If we know that statistics follow a predictable pattern, wonderful. From that predictable pattern, we know how wrong we're going to be. So that's how we built our interval estimates, right? So we had this idea of our original point estimate, plus or minus some margin of error that we created. Now, again, the purpose of an interval estimate is to provide some idea of how close we actually are, right? So, as a notion of wiggle room, really, to make people rely on our results a little bit better, we're admitting the fact that we know that there's going to be some variability in our guess, but that variability is accounted for by the fact that we know what patterns exist inside of data in general, and so we talked about the idea of a confidence interval, and again, I know confidence
intervals were a little bit weird, because confidence meant something we probably weren't really used to. Remember, confidence intervals are just interval estimates, where we have this confidence, where confidence was the confidence in the procedure itself. If we were to take many, many, many, many samples, all of the same size, that each produced a different confidence interval, 95% of them would contain the truth. And we looked at that visually. Here, for example, we have all of these sample means from the same population, and we build confidence intervals from all these sample means. Not all of them are actually going to capture the truth. Now, unfortunately, you don't know which one your sample is, but you're relying on the fact that more often than not, this procedure gives you a good answer. So that's what we do. From there we were able to actually calculate the confidence interval specifically for proportions as well as for means. They are basically laid out in these equations that we saw. Remember, though, when looking at the means, we did not use the normal distribution anymore. We needed to switch over to t distribution, since we are now estimating both mu and sigma. I know if you're going to make two estimates, you have to add a little extra wiggle room. The t distribution does that for us. Then, lastly, we moved into the world of hypothesis testing, and we talked about this example, or we talked about this example of a coin. You have a coin you believe is fair, so we tested it, and we kept flipping heads over and over and over and over again, and then you started saying, hmm, well, the probability of you getting heads this many times in a row in a fair coin is probably really small. I no longer believe the coin is fair. Congratulations, you just did a hypothesis test. It's just we use more formal language, like null hypothesis, test statistic, p value, and decisions. So that's really what we do. A hypothesis test uses the data to help us evaluate an initial claim about the parameter from a population. And there are four main steps to hypothesis testing, like we just talked about. We had to state our hypotheses, where the null hypothesis was our original idea, and the alternative is what we were trying to test. The test statistics were, we gathered all of our data to be able to do this. The p value told us the probability we saw the data that we did, and then based on that p value, we made a decision on our null hypothesis. We were basically trying to figure out how likely was it that we saw a sample, for example, a sample mean as far away from the original guess, mu naught that we actually had. Now, remember, hypothesis tests, much like confidence intervals, are not always right, and so there were different types of errors that we could do, right? So, sometimes we get it right, sometimes we get it wrong. When we get it wrong, we have either a type one or a type two error. If you think that you should reject the null hypothesis, but you actually shouldn't have, the null hypothesis was true, you've made a type one error. If you think that you should not reject the null hypothesis, but you actually should have, the null hypothesis was false. Then you have a type two error. Whew, can you believe it? That's everything we covered in this
course. Data is everywhere, but the nice part is we can do amazing things with data. We can explore it, we can understand it, we can make inferences from it. It's really sort of God giving us a glimpse of this world through data, however, we must use the information that we've seen here to find out things wisely and ethically. So that lecture summarizes everything that we've talked about. That is the end of this lecture, and I look forward to seeing you in the next one.