WHT

# P Value Formula | Calculate The P-value In Statistics – Formula To Find The P-value In Hypothesis Testing

Subscribe Here

10,009

1,107,954

## Calculate The P-value In Statistics - Formula To Find The P-value In Hypothesis Testing

Transcript:

Hello, welcome to this lesson. And mastering statistics we’re going to continue working with hypothesis testing in this particular case we’re going to start to talk about the concept of a p-value, so keep in mind that this right for now is in the context of our large sample hypothesis testing of means, so we’re doing hypothesis testing with means we’re doing large samples for right now, and so we have sample size is greater than 30 now up until now, we’ve been doing everything in terms of rejection regions, all right, and that’s basically where the level of significance, Alpha, whether it’s left tail, right tail or to tail. You have to set it all up, but essentially you create these boundaries and these are rigid boundaries that you can then look at calculate your test statistic from your data, see where it falls and depending on where it falls, you can tell if you have rejected the null hypothesis, or if you fail to reject it, all right, well, every once in a while when I do teaching, I get around to a topic that I get really excited about because p-value’s in this case is something that gives a lot of students, A lot of heartburn, A lot of, you know, scratching your head and trying to figure out what it really means well. I’m excited because I can explain this to you. I think with some concrete examples and especially after we get through this. We do a couple more examples, hopefully. I believe that you will have very, very good understanding. What p-values are intuitively number one thing before you do? Any kind of you know, diving into this is? I want you to keep in the back. Your mind, that’s the purpose of a p-value, really the process and sort of the reason that we do. It is really no different than what we’ve been doing before. Essentially we want to figure out. Lin, which reject that null hypothesis and when we fail to reject it so before we we were using the rejection regions and figuring out where it falls here. We’re doing something very similar at first. It’s going to look totally different, but then when I start talking about it enough, you’ll realize it’s exactly the same thing, so keep that in back. Your mind We’re using it for the same purpose, so we just go down my list, make sure. I say everything. Rejection regions work perfectly fine and statistics. There’s nothing wrong with rejection region, but P-value’s are more common to real research. So if you read a real research paper in statistics, they do a big study. They figure out what the hypothesis is and reject a null hypothesis. You’re going to see P-value’s running around there their explanation, so it’s much much more calm, and I’ll explain why it’s more common in real research, and so that’s why we learn it here, and I’ve already said this once I’ll repeat it again. P-value’s are just another trigger to decide when we should reject that null hypothesis, and when we should fail to reject it First, I need to write down a definition of what you’re going to see in a book. What a p-value is so. Let me get that down for you, but just keep in mind. Don’t worry too much about the definition as we write it down. I mean, I’ll kind of explain it, but as we go through it, you’ll get a much more intuitive understanding of what a p-value is. That will be much more concrete than what. I’m going to write down here. The following is what you’ll typically see in a book. It will say p-values and a book will typically define it as follows. This is a good definition. There’s nothing wrong with it, it’s just. I need to show you some pictures for you. To really understand it. It’s basically the probability, and by the way that’s called a p-value because it’s basically P for probability of obtaining of obtaining a sample. I’m going to put in quotes here because I need to explain it more extreme. Then then the ones observed in your data, assuming that the null hypothesis is true, the crucial part of what we’re reading here is that the concept of a p-value is just a probability, and you know what probability has been talking about that for ages in the class probability, right, it’s a decimal between 0 and 1 the probability of obtaining a sample more extreme than the ones observed in your data. Now, what do I mean by observed in your data? It’s because all of these hypothesis tests involve, you know, you write down your null hypothesis. You write down your alternate, and then you go get some data because you need to try to, you know, just prove the null hypothesis or reject it or whatever. So you last 23 or 28 or 99 people what they had for breakfast that morning or whatever that’s the data, so you collect that data that sample data that you have whether it’s 50 samples or 60 samples, that’s your sample data and you have all of those different values. They’re typically you’re looking at a mean in this case. We’ve been talking about hypothesis testing of means, so you’re looking at the length of pencils on an assembly line volume of water being filled into, you know, the bottles of water in a factory or something. You’re talking about numbers and the hypothesis test that we’ve been doing so far have been all about the mean values of those things, so we go and select some to study and sample to try to test that alternate research hypothesis, and we get the values back. The p-value is the probability of obtaining a sample more extreme than the ones observed in your data, so you have a collection of data that you get from the assembly line or whatever. The 25 samples are the 50 samples that you have. That’s the data that I’ve collected. The P-value is giving a representation of what would be the likelihood of getting a data even more extreme than the one that I actually did collect and the reason I put more extreme imporant in quotations here is because it kind of depends on the problem that you’re doing as to as to which way is more What more extreme actually means in other words, If I’m doing a right tailed test right tailed be that way then basically, I’m measuring the length of pencils, and I spend my research hypothesis is that the pencils are greater than 3 meters long, right so more, my data, more extreme is going to be in there in the right hand direction, more extreme towards that tail, But if I’m doing a left tailed test, then more extreme means more direct more strain in the left-hand direction. I think a lot of this can be simplified by writing some of this down, so let’s say that I have a left-tail test, right, very common thing that we do in statistics left-tail test. So let’s draw a picture of it real quick. So we have what we have is a little distribution like this. This is a V distribution or a normal distribution centered at zero. Okay, so what it’s basically saying is if I’m doing a left tailed test. Don’t forget what I’m really doing. Let me switch over to red here on the left tailed test. There’s always a little region here off to the left, right that we shade right now, typically in previous problems. This shaded region has always been the level of significance. Right, That’s that’s what I always told you. Your level of significant goes goes in your tail, and then your your test statistic just lands wherever it lands, and you draw your conclusion here. We’re doing things a little bit different. I’m just explaining what a p-value is to you. If you’re doing a left tailed test and by definition, the null hypothesis is here, and we suspect that the candy bars in this case. But the left tail tests are shorter than they should be. In other words. We think they’re getting smaller then the null hypothesis said, so we’re moving this way. Okay, now when we do the sampling and we get all the values of the candy bars, we calculate a test statistic. That’s this number, right, That’s what we’ve been always been testing. Based on the sample mean hypothesis mean, and the standard deviation of the sample and the number of samples we get a test statistic here so. I’m going to put that Z down here, and this is what we get from our sample data. This value of Z comes from the sample data, right, so it’s kind of a representative of this value of these kind of like a representative indication of what the sample data really is telling you it’s taking into account the mean the standard deviation the number of samples, so that’s what this kind of means this whole time. We’ve been comparing this number to the level of significance basically and where that falls on the chart to figure out if we reject the null hypothesis or not, so forget about rejecting anything. Forget about testing it right now. The concept of a p-value is basically this value of Z comes from the test statistic. It is the test statistic and it represents your sample data. So when we say the p-value is a probability of obtaining a sample, more extreme than the ones observed in your data, what? I’m basically saying is that this value of Z is called the test statistic and this comes from my sample data, so all of these values here to the left all of the Z values to the left. These are more extreme. All of these possible values of Z to the left are more extreme than this one and the reason. I’m counting to the left is being more extremist because this is a left tailed test, right, so the bottom line is the p-value is well. Geez, we just switch over to green the p-value. Is this area that’s shaded right here. Right, it is the probability remember probabilities are areas under a curve of obtaining a sample more extreme than the ones observed in your data. My data gives me a sample standard deviation of sample. I’m sorry a sample mean a sample standard deviation in the number of samples. Here’s what we’re relating to the hypothesis. The null hypothesis We get a Z value back. This represents my set of data. I’m saying that it falls right here. I’m not doing any testing yet. I’m not testing any null hypothesis, saying the data that I get back. It’s kind of represented in the chart here. It’s far enough away from the null hypothesis to the left. We’re doing a left tailed test. There you go data points more extreme than the ones that. I’ve actually collected or by definition to the left and the area of all of those possible data points that I could get to the left is what we call the p-value right, More extreme means to the left in this case. Now, let me go over here and we’ll do now a right tailed test and hopefully you kind of have an idea of what it’s going to be before We actually do it, but let me go ahead and do it just to be absolutely explicit in a right tailed test. We have a distribution same as we do before, which is always by the way centered at zero member dot and these are no. These are normal distributions because we have large sample sizes. Right, so I collect my data. Let’s say I’m doing a right-tailed test and I have, you know, candy bars coming off an assembly line. My research hypothesis says these candy bars are longer than 10 centimeters. That’s the research the alternate hypothesis so longer than 10 centimeters that would be a right hand symbol, so I would be doing a right hand. I’d be doing a right hand till a right tailed test. Okay, so I would collect all that. I would go and look at 35 candy bars off the assembly line and I would get information from that. I would get a sample mean I would get a sample standard deviation, And I know how many samples that I collected. This is the hypothesis means the null hypothesis Mean I would calculate this number and I would get a value of Z. This value of Z is kind of a represented, It’s like one number that generally represents the entire set of data that I collected. It’s one number, right, so this value Z goes here, all right, and what I’m basically saying Is that all of these values to the right or more extreme than my data, right, and a p-value is the probability of obtaining a sample more extreme than the ones observed in your in your in your data set, So my data set returns a value of Z here. Everything to the right we’re saying is more extreme, because it’s a right tailed test, right, and the probability of getting something more extreme than my data set that I had here is what we call the p-value, so it’s literally the area under the curve to the right of the test statistic. Z that you calculate for your data. In this case over here, it’s the area to the left of the test statistic that we calculate for our data. So I know because I’m using red shading, and I know because I’m shading the tails. Some of you guys are thinking that this is the level of significance. It’s not the level of significance all. I’ve said, is that I calculate the test statistic from my sample data. Its representative of the data that I you know have measured. I put it on this guy and then more extreme to the right for a right-tail test is called a p-value so it’s. The area to the right more extreme to the left is going to be in that case for a left tailed test. That’s why I put more extreme than quotation. Now there’s one more case. I want to show you or in fact, actually, before we get to that. Let me go and give a little bit more concrete examples of left and right tailed testing. Okay, let’s say, as a actual example that the null hypothesis is that the mean is greater than equal 0.15 and the alternate hypothesis is that the mean is less than 0.15 So this is a typical problem that you could actually have. The alternate hypothesis is to the left. So you know, you’re doing a left-tail test that tells you that all right, also given to you in the problem, you’re given that from the data, the test statistic. Z is negative. One point three four. This doesn’t fall out of thin air. What this basically is, Is you collect all of the lengths or the volumes or whatever. Here’s your measuring, and you dump that information. The sample mean sample standard deviations in the number of samples. You stick it into the test. Statistic and out comes a value of Z that number of Z that that value of Z is representative of the data set that you have it kind of takes into account. All the data points, the spread of the data and everything and out comes one number. That’s kind of representative of that whole data set. That’s what we’ve been using it for all along. We’ve been using that one representative number to tell us if we’re in the rejection region or not. Okay, so that is all given to us. We haven’t done anything yet, but we know we’re doing a left tailed test. So if I were to draw this, I would draw something like this, and I know that I’m doing a left tailed test, okay, so the bottom line is the value of Z that comes about from the sample data negative one point, three, four, and since I’m doing a left tailed test, I come up here and I shade this guy to the left because I’m getting the probability of getting a sample more extreme than the data that I actually collected so this area here is called the p-value all right now. How do we actually find the p-value? We haven’t actually calculated anything yet. How we actually find it well. This is a normal distribution. You have a chart of the normal distribution in the back of your textbook. Every statistics textbook does don’t forget. The normal distribution gives you the area to the left. It’s different than the T distribution. Which gives you the area to the right. I know it gets a little bit confusing. You always have to remember that. The table for a normal distribution is giving you the area to the left. So what if what do we do? If we want to find this p-value, well, we have the value of Z and it has the area shaded to the left of Z. So all we literally have to do is go to the table, right and find the probability that Z is less than negative one point three, four. So literally, all we do is look at Z- 1.34 in our Z distribution table. The area that it gives us is the area to the left, which is exactly what we want and I get zero Point Zero nine zero one. So that means the p-value zero point zero nine zero one. That is the p-value for this problem. So if you were given a situation where somebody says, here’s the null hypothesis, Here’s the alternate hypothesis. Here’s the z-score that comes from the sample data. Calculate the p-value for this problem. Now notice we haven’t done any hypothesis testing yet. I haven’t even gotten to that yet, but I just want you to get practice with finding the p-value. Well, the only reason you need. This is to know that it’s a left tailed test. This is representative of our sample data, so we plop it on the chart and since it’s a left tailed test, the probability of getting a value, more extreme than our sample data would be the probability of to the left of this value of Z, which I can readily look up in the back of any book. So that’s how you find a p-value for a left-tail test right now. What happens if we have a right-tail test? Okay, what happens if we have a right tailed test Well for a right tailed test, okay, for a right-tail test, Let’s pretend that we have a null hypothesis, which, as a mean of less than or equal to zero point, four three and an alternate hypothesis looks to put an. A there a mean greater than zero point four three and let’s say from the data. Z is equal to two point seven eight. So all we have is this and the question is. What is the p-value for this problem notice? We don’t have a hypothesis. We have some hypothesis on the board, but we haven’t been asked to test it. We haven’t really been given a level of significance. We haven’t really been told exactly everything about the problem all. I want you to do for. This problem is find out. What is the p-value? Well, you have to know what a p-value is. It’s the probability of getting a value more extreme than the sample data that you collected. Now we don’t have the raw data, but we have the. Z Value the test statistic that came from that guy there, so let’s go and draw a picture and get our bearings for what we actually have and what we actually need. So here is our distribution. This is a Z or a normal distribution and notice that this is a right tailed test. This is a right tailed test, So zero goes in the center and this value of Z that I got from my data was two point seven eight, right, that is a representative number in terms of Z. That kind of represents the whole data set that I’ve collected. We put it on the curve right there. What will be the probability of getting a value of next time? We select a sample or whatever of being more extreme than that well? This is a normal distribution, so we go up here. We shade to the right. More extreme in this case means to the right because it’s a right tailed test. More extreme in the previous case was to the left because it’s a left-tail test, so the phrase more extreme really depends on the kind of problem that you’re dealing with. That’s why I put it in quotation marks. So what I’m looking for is the probability that I’ve select my next sample and I get a value more extreme than the data set that I previously collected. So that means that this area here is going to be the p-value the area under the curve to the right of this value of Z. So in order to do that, you can use your normal distribution table in the back your book. The probability of getting a value of Z greater than 2.7 aims when I’m after, but remember that when you’re using a normal distribution, you can’t just put the number 2.78 in there and circle the answer because what we’re looking for is the area to the right right, but if I actually put 2.78 N into the normal distribution, it’s going to give me the area to the left. In other words, it’s going to return the area of everything over here, so if you remember back to the very beginning of mastering statistics like the very first volume when we start talking about the normal distribution basically said when you’re using that table. If you want the area to the right the way you actually handle it, is you basically say that’s going to be equal to the probability of Z. You flip the sign around negative two point, seven eight, because remember everything symmetrical. This is two point seven eight here. I’m interested in this area of the area. The only thing I care about. If I look on this side right around here, Z is negative. Two point, seven eighty and the area to the left of that negative value of Z is going to be exactly the same as the area that I care about here, so when I’m trying to find areas to the right with a normal distribution, I flip the sign around the the inequality round and I change the sign of Z there, so I go into my chart and I look up the value of negative two point. Seven eight in my chart, which is somewhere over here. It’s going to return an area to the left. That area is the same as what? I care about, so whenever I do that, I’m going to get zero Point Zero zero to seven. So all you have to do is say that that is the P Value Zero Point Zero Zero Two 7s the P-value. The p-value literally is the probability of obtaining a value like the next sample. I were to take the probability of obtaining a value more extreme than the data set that I’ve collected the data set that I’ve collected is represented mathematically by this test statistic. It contains kind of all the raw information and boils down to a to a value of Z. So that’s what a p-value is. I keep saying it over and over again. I want you to visualize that. The P-value is an area to the right or it’s an area to the left, and when we get into situations where it’s a two-tailed test, it’s going to be very similar. And I’ll get to that whenever I get to that, but for right now, I want you to understand the concept of a p-value notice. We haven’t done any actual hypothesis testing it. I haven’t even told you how to use p-values to make decisions, right, but I told you at the beginning that the big overall arching concept here is that p-value’s are going to be used to tell us. If we reject or fail to reject the null hypothesis, just like the rejection regions. We did before. I promise you that we are going to get there. You are going to understand, but you have to take it kind of baby steps with me first. Understand what the p-value is? It is the area to the right of the value of Z that you get from your test that you get from your sample data. If it’s a right tailed test or to the left If it’s a left tailed test, all right, make sure you understand it, so we’ve done two problems. We’ve calculated the p-value for one four right one for a left. I want to stop here. Go on to the next section where I’m going to show you how to use what these p-values are in order to make decision in other words to tell us if we reject or fail to reject a hypothesis.

## 0.3.0 | Wor Build 0.3.0 Installation Guide

Transcript: [MUSIC] Okay, so in this video? I want to take a look at the new windows on Raspberry Pi build 0.3.0 and this is the latest version. It's just been released today and this version you have to build by yourself. You have to get your own whim, and then you...

read more

## Youtube Neural Network | But What Is A Neural Network? | Chapter 1, Deep Learning

Transcript: These are three, sloppily written and provided at a very low resolution of 28 x 28 pixels But your mind has no problem recognizing it as three and I want you to take a moment to appreciate How your brain can do this effortlessly and smoothly I mean this...

read more

## Youtube Artificial Intelligence For The Pc | Machine Learning & Artificial Intelligence: Crash Course Computer Science #34

Transcript: Hi, this is Carrie Ann, and welcome to the Computer Science course! As we touched upon several times in this series, computers are miraculous at storing, organizing and Fetch and process huge amounts of data. This is ideal for things like e-commerce sites...

read more

## Youtube Ai | Talking Tech And Ai With Google Ceo Sundar Pichai!

Transcript: [music] yeah. I know soon so as soon as we hit record, then the noises start so now a little landscaping, a little little construction. Uh, have you had it through the pandemic? Has it been hard kind of doing stuff like this? Yeah, weirdly, it's gotten...

read more