1. Home
  2. Explore
  3. Statistics
  4. Hypothesis Testing Basics

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Hypothesis Testing Basics

Transcript

Welcome to the full video lecture on hypothesis testing part 1. The content that's covered in this video can be found in the Lock^5 textbook in Chapter 4 sections 1 through 3. The full video lectures can get long. I recommend that you take breaks in the middle of this video to review the online notes or textbook or to walk through some examples on your own. These are the learning objectives that we're going to be covering this week. At the end of this lesson students should be able to:

identify and write null and alternative hypotheses; describe randomization procedures; determine p-values using randomization methods in stat key and Minitab Express; interpret p-values; and make conclusions on the basis of a p-value. Let's start with a quick review. These are all the population parameters that we can be working with this week. We won't be conducting hypothesis test for standard deviations but we will be conducting hypothesis testing for a single mean, difference in two means,

single proportion, difference in two proportions, correlation, and simple linear regression slope. Recall sample statistics are random variables because they differ from sample to sample. Last week, we used data from samples to estimate population parameters using confidence interval methods. In this lesson we're going to continue to study statistical inference but this week we'll be focusing on formal hypothesis testing. In hypothesis testing we use

data from a sample to determine if that sample could have reasonably come from a population with a given parameter. Let's look at an example of a scenario that we could apply hypothesis testing in. A company claims that only 5% of their products are defective. You have purchased 100 of their and 9 have been defective. do you have evidence that more than 5% of products in the population are probably defective? So here we have a company that

is claiming that in the population 5% are defective, in other words they're claiming P equals 0.05. Assuming that we have a random sample from the population, we want to find the probability that our sample came from a population that really does have a population proportion of 0.05. We'll walk through this example throughout this video. We'll write hypotheses and we'll walk through the whole randomization test procedure with this example as well

as a few other examples. Before we start walking through the different steps and our different learning objectives this week, I want to show you the big picture. We'll start by using the research question to write testable hypotheses. You'll be given a scenario and you'll have to turn that scenario into testable hypotheses. Then we'll use the value of the parameter in those hypotheses to construct a sampling distribution. Remember again we only have data from a

sample, we do not have data from the population, so we're going to use resampling methods again to construct the sampling distribution. Last week we use bootstrapping methods, this week we'll be using randomization methods. These are similar to bootstrapping methods. The difference is that now we have hypothesized population parameters that were testing so that's going to change how we make that sampling distribution. And then we'll use that

sampling distribution to determine the probability that a sample with the observed statistic came from that population. You'll see this is often written out as a conditional probability: given that the hypothesis is true, what's the probability that our sample came from that population? And we'll see that probability is known as a p-value. If you've read any quantitative research, you've probably seen p-value cited, they're often just written a

lowercase P. This week you're going to learn what those p-values really stand for. Let's start working through our learning objectives now. First learning objective: identify and write null and alternative hypotheses. In any sort of hypothesis testing procedure you're going to have two hypotheses the null and the alternative. The null hypothesis we often write as H sub 0 or H sub null. This is a statement of no difference in the population so null

means nothing the alternative hypothesis then is H sub a, you can also see this written as H sub 1, this is a statement of a difference in the population. Note that the hypotheses are always written in terms of population parameters and the null is always going to contain an equality. Because the null is always that there is no difference, in order to write our hypotheses there's three pieces of information that we need. First the

parameter of interest. So we'll have to look at the scenario and determine what parameter is that we're testing. In this lesson we will test for a single mean, a difference in two means, a single proportion, a difference in two proportions, correlation, or a simple linear regression slope. So these are the parameters that you'll be working with this week. The second piece of information that we'll need is the direction. Again we'll look at the

scenario and determine if the research question is asking if the population parameter is less than a given value, greater than a given value, or different from a given value. The null hypothesis is always going to contain the equality, so an equal to sign. The alternative hypothesis is going to contain one of these symbols: less than, greater than, or not equal to. The third piece of information that we need is the hypothesized parameter value. Again, this is

going to come from our scenario. For a single mean or a single proportion you will be given a number in the scenario. So, is the mean greater than five? different from two? Is the proportion less than 50%? greater than 0.75? For difference in two means and difference in proportions we usually assume that the hypothesized parameter value is zero because we want to know from you sub 1 and u sub 2 are different. If they're different, then mu sub 1 minus mu sub 2

does not equal 0 and the same for proportions. For correlation slope the hypothesized parameter value is also typically 0 because we want to know if there is a positive relationship, a negative relationship, or just some relationship. If there's no relationship then Rho or beta would equal 0. In your online notes there are a few of these tables for all the possible parameters that you could be studying this week. This gives you for the three different

possible research questions, the hypotheses that you would write, and also whether it would be a two-tailed right tailed or left tailed test. In this particular table mu sub o refers to the number in the null hypothesis so when you're writing out all of these hypotheses you would not write mu sub o, you would replace that with the number from this scenario. Here's the table for the difference in two proportions again, you would look at your scenario to

determine what type of research question you have. That determines your null and alternative hypotheses, and also whether you have a two tail, a right tail, or a left tailed test. Let's look at the example from earlier again to write our hypotheses we really only need the last sentence here. Do you have evidence that more than 5% of products in the population are probably defective? Our variable of interest here is whether or not each product is defective. This is a categorical variable. We're looking at a proportion. Our parameter of interest is p. In terms of direction, we want to know if more than 5% or more than 0.05 are probably defective. We have a right tailed test. The hypothesized parameter value is 5% which would translate to a proportion of 0.05. We need to write two hypotheses: a null hypothesis and an alternative hypothesis. The null hypothesis always contains the equality.

If you have a less than, greater than, or not equal to, that's always going to be your alternative hypothesis. Typically your research question is your alternative hypothesis, because typically the research question is asking is the parameter less than, greater than, or different from a given value. In this case our null hypothesis with the Equality would then be that p=0.05 So for this particular scenario, we have our null and alternative hypotheses.

Here's another example. In the population of American women, is there a relationship between age in years and the number of shoes owned? First piece of information that we need is the parameter of interest. Age in years and number of shoes owned are both quantitative variables, and we want to know if there is a relationship, so we're looking for a correlation and this will be measured using Pearson's r. So the parameter of interest is Rho. In terms of

the direction, our scenario doesn't give us a direction, it just says is there a relationship. We don't know if we're looking for positive or negative so the direction is two-tailed. The hypothesized parameter value for correlations most of the time is going to be zero, because if there is a relationship that the correlation is some value other than 0. This is our alternative hypothesis. The null hypothesis though is going to contain the equality, so H sub o is that Rho equal 0, versus each sub a that Rho does not equal 0. These are the hypotheses that we would be testing given this research question.

And one last example, in the population of all Penn State World Campus students, are females more likely to have a gym membership than males? In terms of the parameter of interest, we're comparing the proportion of female students who have a gym membership to the proportion of male students who have a gym membership, so we're comparing two proportions or the difference in two proportion is what we're looking at. The parameter of interest is going to be the

proportion of females minus the proportion of males. We want to know if females are more likely than males which means that the proportion of females minus the proportion of males would be greater than zero. This is our alternative hypothesis. The null hypothesis would then be that there's no difference between the two, so the difference would be equal to zero. I want to point out that these hypotheses are equivalent to these. We could add P sub m

to both sides and our null would be that the two proportions are equal. The alternative would be that the proportion of females is greater than the proportion of males. It's perfectly acceptable to use either set of these hypotheses. Our second learning objective is to describe randomization procedures. Like the bootstrapping procedures that we saw last week, this is another type of a resampling procedure. The difference between bootstrapping and randomization

procedures is that now the sampling distribution is constructed under the assumption that the null hypothesis is true. How this is actually done is going to differ depending on whether you're working with a single mean, difference in means, correlation or regression, but regardless of the parameter, know that we're working under the assumption that the null hypothesis is true. This means that the randomization distribution will be centered on the value in the null

hypothesis. With bootstrapping procedures the sampling distribution was centered on the sample statistic, now before we do those resampling steps we're going to either shift the original sample or we're going to combine the two samples, so our sampling distribution now is going to be centered on the value in the null hypothesis. Let's go to StatKey now to look at a few examples. The first example that we're going to work with we want to know if the mean price of the

house in Canton, New York is different from $200,000. This is one of the data sets that is built into StatKey. House prices our quantitative variable and we have a single group: prices in Canton, New York, so we're going to construct a randomization distribution for a single mean. This is one of the built-in data sets it's called home prices Canton. Now in StatKey, like with the bootstrapping procedures, you have the option of editing the data, you could select all

the data delete it and then copy and paste in your own data from Minitab Express, there's a few examples of that in your online notes. But for this example, we're going to use the data set that's already built in. In our research question we wanted to know if the mean was different from $200,000 so we need to change the null value to MU equals 200 like before StatKey is going to show us our original sample distribution here on the upper right.

We can see that we have a sample size of N equals 10 and a sample mean of 146.8, and this is in thousands of dollars. If I were to generate one randomization sample, we can now see this distribution at the lower right. What makes randomization procedures different from bootstrapping procedures is that before we're taking the random sample, again in this case with replacement, from the original sample we are shifting the original sample so that

it has a mean equal to the mean in the null hypothesis. So we're taking this original sample where the mean was 146.8 and we're going to shift it to the right so that its mean is equal to 200. So in other words we're going to take these points and we are going to add 53.2 because that would make our sample mean equal to 200. We can see here, this high point here is 378.2, there's no point with that value in the original sample, this is actually one of these

samples with the 53.2 added to it. So 325 turns into 378.2 Like before the mean of our first randomization sample is plotted at the larger dot plot, the randomization dot plot of x-bar. We can generate a few thousand randomization samples, again I typically recommend that students take at least 5,000 samples, and here we have a randomization dot plot of sample means from all of those 5001 randomization samples that I took, this is going to serve as our sampling distribution. Let's go back and look at another example.

This is the example that we saw earlier, recall that we wrote our null and alternative hypotheses, so when we go to StatKey we'll have to change the hypothesized population proportion value to 0.05. We're going to be entering data into StatKey, this is not a data set that's already built in. The information that we need from this scenario to tell StatKey how to construct the distribution, we need to tell it that we have a sample size of 100 and an

observed x value of 9. Let's go back to StatKey now to construct this randomization distribution for a single proportion. We'll edit the data. In our sample, 9 out of 100 products were defective, and our null hypothesis was that P equals 0.05. Now if we generate a few thousand randomization samples, this randomization dot plot of the proportion is going to serve as our sampling distribution. We have one more example to look at.

Are the mean commute times different in Atlanta and St. Louis? We have two different groups here: Atlanta and St. Louis, and we're told that we're comparing a mean. Let's go back to StatKey to construct a randomization distribution for the difference in two means. We're going to be using one of the data sets built into StatKey: commute time Atlanta versus st. Louis. When you're looking at the difference in means, you'll see that there are a few different randomization methods available. In this course we're always going to be using the default method, in this case reallocate groups. We're comparing the means of two groups, what we're doing is we're taking all the values in our original sample, here we

can see there were 500 observations from each city, we're taking our total sample of 1,000, and we're randomly splitting them into two groups, and then computing the difference between the two groups. Let's generate one randomization sample. All of those 1,000 original data points were randomly assigned to either Atlanta or St. Louis, and then we took the mean of Atlanta minus the mean of St. Louis, and here the difference in those two randomization sample means was 0.54.

That value is now plotted on our randomization dot plot on the left. We could do that again, and again we take the mean of Atlanta minus the mean of St. Louis in our randomization samples, this time the difference is negative 0.15. Remember for the difference in two means the null hypothesis is always that the two groups are equal or that the mean of group one minus the mean of group two equals 0 ,so this randomization dot plot after we generate a few thousand samples should be centered on 0.

This is the randomization distribution for the mean of group 1 minus the mean of group 2 here the mean of Atlanta minus the mean of St. Louis, this is the distribution that we're going to use to approximate our sampling distribution. Now let's go back to the PowerPoint slides, and we'll talk about how these distributions can be used to find the p-value. We can use a randomization distribution to determine how likely our

sample statistic is given that the null hypothesis is true. This is often written out in the form of a conditional probability: the probability of obtaining this sample statistic given that the null hypothesis is true. This probability is known as the p-value. When we're conducting a randomization test, the p-value is the proportion of samples on the randomization distribution that are more extreme than our observed sample in the direction of the alternative

hypothesis. Let's walk through a few examples of this. We've seen this example before, we've written our hypotheses and we've already used stat key to construct a randomization distribution, so I'm going to go back to stat key now I'm going to construct this randomization distribution again, and I'm going to show you how you can use it to find the p-value. We're conducting a randomization test for a single proportion in our sample 9 out of 100 products in our sample were defective and our null hypothesis was that p equals 0.05. We'll generate a few thousand randomization samples.

Again we had a right tailed test because our alternative hypothesis was that P is greater than 0.05, in stat key when I select right tail the default and stat key is always to put 5 percent split between the two tails so 2.5 percent in both tails. You need to remember to change the cut value at the bottom. This value at the bottom needs to be the original sample value, here our sample proportion was 0.090, so I click this and I change the cutoff to 0.090.

Now we can see all of the randomization samples with a sample proportion of 0.090 or greater are highlighted in red. This area is our p-value. Up above stat key tells us that this proportion is 0.070. So for this particular scenario, our p-value is 0.070.

Let's run through the same example using Minitab Express. In Minitab Express I'm going to go to statistics, resampling, randomization test for one sample proportion. Of you're on a PC this might look slightly different, I believe they have the bootstrapping and randomization procedures in separate windows. Once you get in here it should look the same regardless of if you're on a PC or a Mac. We're going to be entering summarized data. In our sample 9 out of 100 products were defective and our hypothesizes proportion with 0.05. Under options

the default is to do a two-tailed test, but we have a right tailed test, our alternative hypothesis was that P is greater than 0.05. We click OK. Just like when we did bootstrapping methods last week, the first thing Minitab Express is going to give us as a histogram The histogram that Minitab Express provides is similar to the dot plot that stat key provides. This is our randomization distribution, with our p-value highlighted in red so our p-value here

is 0.0620. If we scroll down we can also see this p-value in the table, and Minitab Express will also write out the hypotheses for you so you can confirm that you conducted the correct test. The p-value here is slightly different from the one that we thought in stat key but that's just due to random sampling variation. Let's move on to interpreting p-values. The p-value is the proportion of samples on the randomization distribution that are more

extreme than our observed sample in the direction of the alternative hypothesis. This is often written out as a conditional probability: the probability of obtaining this sample statistic given that the null hypothesis is true. We could also flip this around and say given that the null hypothesis is true, the probability of taking a random sample and observing a test statistic as extreme or more extreme than the one in our sample is the p-value. Let's look now at how we can apply this p-value to address our research questions.

The fifth learning objective is making conclusions on the basis of a p-value. Of the p-value is small, then it is unlikely that our sample came from a population with the parameter in the null hypothesis. The question now is what is considered a small p-value? The cutoff is typically set at 0.05, in other words if there's less than a 5% chance that a population with the given parameter would produce a sample with the statistics that we observed then we say that it is unlikely

that our sample came from that population. If your p-value is less than or equal to 0.05 we reject the null hypothesis, this means that the results are statistically significant. If the p-value is greater than 0.05 we fail to reject the null hypothesis, the results are not statistically significant. Now that we've covered all of the learning objectives for this lesson, I want to go back do you a few complete examples. First let's

review all the steps that you're going to go through to conduct a randomization test. Step one: you're going to determine what type of tests you need to conduct and write your hypotheses. These are the different tests that you're going to learn this week, all of these can be done in StatKey. Minitab Express also has a few of these options. In the online notes you can review all of the different possible hypotheses, your hypotheses are going to

be dependent on the parameter of interest, the direction of the research question, and the value of the hypothesized parameter. Step two: construct a randomization distribution under the assumption that the null hypothesis is true. We walked through a few examples of doing this in stat key. Step 3:use the randomization distribution to find the p-value in stat key or Minitab Express You can conduct a one tailed test or a two-tailed test, and we'll walk

through a few examples of these, but note that in stat key if you're conducting a two-tailed test you need to add the shaded proportion on the left to the shaded proportion on the right. Step 4: decide if you should reject or fail to reject the null hypothesis. This decision is going to be based on the p-value. If P is less than or equal to 0.05 we reject the null hypothesis, if P is greater than 0.05 we fail to reject the null hypothesis. And finally, step 5: state a real-world conclusion in relation to the original research question. So after we find our p-value and make our decision, we go back to the beginning and we write out a sentence or two in conclusion referring back to the original scenario. Let's walk through a few examples now.

A company claims that only 5% of their products are defective. You have purchased 100 of their products and 9 have been defective. Do you have evidence that more than 5% of products in the population are probably defective? We've already walked through this example, in step 1 we said that this was a single proportion test and we wrote our hypotheses. In steps two and three we went to stat key and we also went to Minitab Express for this one to construct a randomization distribution

to find our p-value. Step four make a decision, in both stat key and Minitab Express our p-value was greater than 0.05. In stat key I believe it was 0.070 and in Minitab express it was a little above 0.06 both cases P is greater than 0.05, so we failed to reject the null hypothesis. Step 5 we state our real-world conclusion. There is not evidence that more than 5% of products are defective in the population.

When you're conducting one of these tests for a lab assignment this week you should be writing out your 5 steps like this, and for steps 2 and 3 you should be including a screenshot of your output from stat key or Minitab Express. Here's another example, is the mean price of a house in Canton New York different from $200,000? Step 1, determine the test and write hypotheses. We're told that we're looking at a mean and we only have a sample from one group: Canton, New York. So this is a randomization test for a single mean. We want to know if the mean is different from $200,000 so that's going to be your alternative hypothesis the null hypothesis always contains the equality and remember that your hypotheses should always be written in terms of population parameters. Our null hypothesis is that mu equals 200 and our alternative hypothesis is that mu does not equal 200. For steps two and

three we're going to go to stat key, this is one of the data sets that's built into StatKey so we'll conduct a randomization test to determine if the mean is different from 200. Again we said that we were going to conduct a randomization test for a single mean and this is the home prices in Canton, New York data set. Our null is that mu equals 200, we'll take a few thousand randomization samples. This is a two-tailed test because our alternative hypothesis was that mu is not equal to 200.

When I select two-tailed the default and stat key is always to take the middle ninety-five versus the outer five we need to remember to change the numbers at the bottom, and stat key is set up so that when you change one of these values it mirrors that change on the other side, the mean in our original sample was 146.8 That would be over here on the left so we'll change the value at the bottom left to 146.8. Our p-value now is the total area that's shaded in red that

gives us 0.015 on the left and 0.015 on the right for a p-value of 0.03, let's go back to the PowerPoint slide now to finish our five-step hypothesis testing procedure. Our p-value was 0.03, because our p-value is less than or equal to 0.05, we reject the null hypothesis. Step 5: state the real-world conclusion. There is evidence that the mean price in the population of all houses in Canton New York is different from $200,000.

There are many more examples in the online notes this week including a few that show you how to take data from an Excel file or a Minitab Express file put it in StatKey and run a randomization test using that. Before I leave you, I just want to review the learning objectives for this week. One: identify and write null alternative hypotheses. Two: describe randomization procedure. Three: determine p-values using randomization methods in stat key and Minitab Express. Four: interpret p-values.

And, five: make conclusions on the basis of a p-value. If you haven't done so already, I recommend that you go to the online notes and you watch some more of those example videos, there are also a few examples in your textbook. As always, if you have any questions this week. please post them to the discussion board on Canvas.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent