Chapter 13: Pearson's r Correlation And Regression

3/4/2016 Correlation Chapter 13: Pearson's r Correlation And Regression   Objectives for This Chapter Understand how and why we use correlation an...
Author: Eric Warren
2 downloads 2 Views 1MB Size
3/4/2016

Correlation

Chapter 13: Pearson's r Correlation And Regression

  Objectives for This Chapter

Understand how and why we use correlation analyses. Be able to construct and interpret a scatterplot. Understand how correlation magnitude and direction describe different types of relationships. Understand how to calculate and interpret the coefficient of determination. Be able to apply the steps of hypothesis testing to a correlation analysis. List and explain the assumptions of a correlation analysis. Apply regression concepts/calculations to prediction and decision­making. Distinguish among the alternative correlation analyses. What will correlations do for me?

Suppose that you woke up one morning and discovered that you had been given the gift of being able to predict the future. Suddenly, you found yourself able to predict, with some degree of accuracy, things like:

How long someone will live Whether the stock market will go up or down Whether someone will become a criminal Whether a surgery will prolong a cancer patient’s life Whether a depressed person will commit suicide Whether a person will make a productive employee Whether a football team will make a first down on the next play Whether somebody’s marriage will survive or end in divorce Would you use your gift for good and not for evil? Or would you say, “No thanks! Not interested.”  Well, in fact you are about to be given such a gift and I am going to give it to you! It is in the form of the correlation coefficient. Developed by Karl Pearson over a hundred years ago, it is officially called the Pearson Product Moment Correlation Coefficient. However, it is often referred to simply as Pearson's r. That's right. We've gone from z, to t, to F and finally to r. No wonder statistics is so tough. Statisticians don't even understand the alphabet. The correlation coefficient is an extremely powerful and useful statistical tool that allows you to evaluate whether or not a relationship exists between two things. These “things” are referred to as variables. Perhaps more importantly, not only does the correlation coefficient tell you whether or not a real (non­chance) relationship exists, it allows you to tell just how strong that relationship is. Finally—and here is where predicting the future comes in—if a real relationship exists between two variables, then the correlation coefficient allows you to make predictions about one variable based solely on knowledge of the other variable. In other words, if a relationship exists between a child watching violent television programs and his or her aggressive behavior in school, then the correlation coefficient will allow you to predict how violent a child would be in school based solely on how much violent television the child watched at home!  Think about the kind of power that gives you! Insurance companies use the correlation coefficient to predict how likely a person is to get into an accident. This enables them to set insurance rates so that high risk drivers pay

http://www.derekborman.com/230_web_book/module4/correlation/index.html

1/15

3/4/2016

Correlation

more. Mutual fund managers use correlation coefficients to decide what a stock’s price is likely to do and use that information to decide whether to buy or sell stocks. Healthcare providers use correlation coefficients to decide whether or not someone will likely die if they do not get a certain surgery and so they make decisions accordingly. Psychologists use correlation coefficients to predict whether or not a sexually violent predator (a person repeatedly convicted of sex crimes) is likely to commit another crime if he is released from prison.

How Do Scatterplots and correlations work?

 

Introduction to Scatterplots Scatterplots are similar to line graphs in that they use horizontal and vertical axes to plot data points. However, they have a very specific purpose. Scatterplots show how much one variable is affected by another. The relationship between two variables is called their correlation. Scatterplots usually consist of a large body of data points. The plot is constructed by plotting two related, numeric variables on the x axis and y axis of a graph. The actual dots or data points represent the intersections of the values of the two variables. The closer the data points come (when plotted) to making a straight line, the higher the correlation between the two variables, or the stronger the relationship. When we talk about how strong a relationship is, we refer to this as the magnitude of a correlation. We'll get into more specifics, shortly. If the data points make a "line" going from lower left to upper right, then the variables are said to have a positive correlation. Positive correlations are frequently referred to as direct correlations. If the "line" goes from upper left to lower right, the variables have a negative correlation. Negative correlations are often referred to as inverse correlations. If there is no identifiable, linear trend, then we would conclude that there is no correlation between two variables.

What else do we notice about the scatterplots? We see that both variables are numeric. Though we will talk briefly about a few other types of correlations, in this chapter we are going to focus on the bivariate correlation. The bivariate correlation is always an analysis of the relationship between two numeric variables on either an INTERVAL or RATIO scale.

Positive Correlation Example

 (../../images/correlation/school_salary_scatterplot.png)The best way to give you an idea of how correlation works is to discuss a scatterplot example or two. Suppose that you are interested in answering the question: Is a person’s starting salary (the amount they are paid when they start their first job) related to how many years of education they have successfully completed? In other words, you are interested in finding out if more school will translate into more money when you get a job. Click images to enlarge. As you look at this scatterplot, does anything jump out at you? Can you say anything about the relationship between a person’s starting salary and the number of years of education that he or she successfully completes?

http://www.derekborman.com/230_web_book/module4/correlation/index.html

2/15

3/4/2016

Correlation

Does it seem like they are related at all? Who would you say tended to have higher starting salaries, people with less education or more education?   A careful review of the graph clearly indicates that people who had less education (less than a high school diploma) tended to also have lower starting salaries. On the other hand, as the amount of education a person got went up, so did their starting salary. People with the most education also tended to have the highest starting salaries. This is an example of a positive correlation or positive relationship.   In answer to our question about whether or not there is a relationship between the amount of education one receives and their starting salary, the evidence we have presented would suggest that “Yes, there is a positive relationship between amount of education and a person’s starting salary.” As result, you might conclude that you should pursue as much education as you can because it is likely to mean that you will receive a higher salary!  

Negative Correlation Example Okay, now you know what a positive relationship is; it is a relationship where as values on one variable (e.g., years of education) go up the values on the other variable (e.g., starting salary) also goes up. There is another kind of relationship besides a positive relationship—a negative relationship. Suppose you were interested in using data to find out if there is really a relationship between a person’s exercise patterns and their risk of heart attacks. What you are really asking is: Is there a relationship between the average 

 (../../images/correlation/exrcse_chol_scatterplot.png)number of minutes of exercise a person gets each week and that person’s risk of coronary hearth disease? What do you think would be the answer to this question? Just based on what you hear on television and read in newspapers and magazines, you probably would conclude that there is a relationship between how much a person exercises and his or her risk of heart disease, right? Well, you could use the very same procedure we looked at above to answer the question. Suppose we asked 30 people the following questions: How many minutes, on average, do you exercise each day? What is your cholesterol level? If we ask a bunch of people these two questions, then we will have two related, numeric data points for each participant in our study. You are ready to put your real question to the test. You could plot each person’s data on a scatterplot. You may very well see something similar to what you see here. Do you notice anything about what happens to a person’s cholesterol level as their amount of daily exercise increases? Look at people who exercise less than 12.96 minutes a day do they tend to have higher or lower cholesterol levels than those who exercise more than 12.96 minutes a day? Based on these data, it would appear that as the number of minutes a day a person exercises goes up, their cholesterol level goes down. This is an example of a negative relationship. You can generally identify a negative relationship in a scatterplot because the tendency is for the dots to go from the upper left to the lower right portion of the graph.

Spring Break!!

Now that you know how to see if there is a positive or negative relationship between two variables, the next question to ask is: How strong is that relationship? In other words: What is the magnitude of the correlation? Why is this an important question? Let’s take a look at another example.

http://www.derekborman.com/230_web_book/module4/correlation/index.html

3/15

3/4/2016

Correlation

Suppose Spring Break is fast approaching and you and some of your friends are thinking about heading south to Cancun, Mexico, for some rest, relaxation and fun. Being the wise consumer/traveler that you are, you ask yourself, “Is there a relationship between how expensive a hotel is and how much people enjoy their stay?” Your

thinking is   (../../images/correlation/hotel_fun_scatter1.png)that if there is a relationship showing that the more people pay, the more fun they tend to have, then you may want to pay a little more for your hotel. On the other hand, if people who stay at cheaper hotels have as much as or more fun, why pay the extra bucks? To answer your question, you ask a bunch of people who have been to Cancun over spring break about how much their hotel cost and also ask them to rate how much fun they had on a scale of 0 to 10 (0 = no fun at all and 10 means so much fun that your head exploded). Next, you plot their responses on a scatterplot. This plot provides an example of a “weak” positive relationship. Click images to enlarge. Notice that you can tell that there is a positive relationship between hotel cost and how much fun people who have stayed there reported (as one variable goes up so does the other). HOWEVER, notice that there is a lot of variability. What I mean by variability is that there are a lot of people who only paid around $500 who had almost as much fun or more fun than people who paid much more!

 (../../images/correlation/hotel_fun_scatter2.png)But what if your results had turned out differently? What if your results indicated a different relationship between the variables that you were investigating. This is an example of a “strong” positive relationship. In a strong correlation (whether it is positive or negative) the dots tend to group to form more of a straight line. Notice how in this scatterplot there is a very clear trend that tells you: As people pay more for their hotel they also tend to report having more fun during their stay. Why is it so important to know whether a relationship is strong or weak?Because it allows us to make predictions! Let’s get back to our Spring Break example. Suppose that you have a certain amount of money to spend and you want to be as certain as possible to get the most for your money. Should you pay top dollar for your hotel or go on the cheap side? If you had gotten the results depicted in the first scatterplot, you might be less inclined to spend a lot on your hotel, because it is difficult to predict with accuracy how much more fun you would have in an expensive hotel. On the other hand, the results in the second scatterplot depict a strong, positive relationship; it is very clear that higher price is related to more fun. Given this information one could clearly say that people who paid $900 reported having much more fun than people who paid $500.Therefore, you could predict that if you paid top dollar for your lodging, you would have more fun. Note, this does not mean you will have more fun only that it appears likely that you will. You cannot say that paying more will cause you to have more fun, only that since it appears cost and fun are related it seems reasonable to predict that you may have more fun. The main point of this is that a strong relationship allows you to make much more accurate predictions than a weak relationship. And if I may also add...ACT RESPONSIBLY ON SPRING BREAK! There. I said it and I'm glad that I did.   This chapter incorporates multiple exerpts from The Radical Statistician: A Beginners Guide to Unleashing the Power of Applied Statistics in The Real World (5th Ed.) Jim Higgins Publishing. 2006.

Create your own scatterplot

http://www.derekborman.com/230_web_book/module4/correlation/index.html

4/15

3/4/2016

Correlation

In this activity, you will be able to create scatterplots for correlated data of different sample sizes and computed r values (correlation coefficients) of different strengths and directions. Just use the appropriate sliders. You can even create your own scatterplot by entering x and y data points for each dot on the scatterplot. If you want to see some real­world data depicted, open up one of the sample data sets. Get in touch with your inner stats geek and enjoy!! 107.5

105 100

120

140

Regression Line

160

Observations Highcharts.com

Random Data Sets  Graph Your Own Data   

Sample size: 62

 

X  0 Y  0

Sample Data Sets  Select a data set to view

   

Add Data Point    

Pearson's r: 0

   

What do I do with a correlation coefficient?

As it turns out, we need more than scatterplots to really make the best use of correlation analyses. After all, creating scatterplots can be time consuming to construct. And while scatterplots can be useful to get an idea about whether or not a relationship exists between two variables, it can be very difficult to differentiate between weak relationships (which are still important) and instances when there are no relationships. What we need is a way to take all the information we have collected and somehow reduce it to a single summary number that tells us:

1. Is there a relationship between the two variables? 2. Is the relationship, if it exists, positive or negative? 3. How strong is the relationship? In addition, it would be great if the same number could be used to actually make predictions about one variable based on information about the other. For example, wouldn’t it be great if this number would allow us to decide how much fun we want to have in Cancun and have it tell us how much we would need to spend on our hotel? As a matter of fact, there is such a number. It is called the correlation coefficient, and we're going to talk about that, right now. A correlation coefficient is a single summary number that gives you a good idea about how closely one variable is related to another variable. The statistical letter associated with the correlation coefficient is r, sometimes referred to as Pearson's r. Just as we have done in past chapters, we will assess computed and critical statistical values. In this chapter we will assess r­comp and r­crit values. We will also become familiar with a new table of critical values associated with the r distribution. In order for you to be able to understand this new statistical tool, we will need to start with a scatterplot and then work our way to the correlation coefficient. We will not be manually calculating the correlation coefficient but rather discussing it's characteristics and uses.

Should I tell my boss to take this job and shove it? http://www.derekborman.com/230_web_book/module4/correlation/index.html

5/15

3/4/2016

Correlation

  Okay. So, you've been working at the same place for three years. You see the same people, day in and day out. You know what they have for lunch each day. You even know about their weird little habits, like when Bill and Tom have their weekly contest to see who can endure having their finger stapled the most times. There is certainly a lot to consider in deciding whether to stay with this company. Now, A good statistician would want to collect and analyze some data before doing anything rash. You know that you're going to conduct a correlation analysis. So, what two numeric variables would you want to relate? What variables would allow you to predict an important factor related to your possible future with the company? We could start by trying to find out if there is any kind of relationship between the number of months people have worked for the company and their hourly wage using a scatterplot. Let's look at the data and the scatterplot. Click images to enlarge.

(../../images/correlation/data_time_money.jpg) (../../images/correlation/time_wage_scatterplot.png) Okay. Pretty much what we expected. It appears that we have a positive correlation between Months Working for Company and Hourly Wage. In other words, the longer you are with the company, the more you get paid. Now, don't you feel bad for wanting to march in and give your boss an atomic wedgie? Well, don't be too hard on yourself, just yet. You need to dig into this a little more to really figure out what's going on here.

Correlation does not equal causation Note that these findings do not mean that time with the company actually causes higher compensation (correlation does not equal causation) it only shows that there is a relationship between the two variables and that the relationship tends to be positive in nature. To be correlated only means that two variables are related. You cannot say that one of them “causes” the other. Correlation tells you that as one variable changes, the other seems to change in a predictable way. If you want to show that one variable actually causes changes in another variable, then you need to use a different kind of statistical test. Additionally, you would probably want to know something about average pay for different months with the company. Your correlation analysis doesn't provide these types of statistics. NEED TO EXPAND NEXT SEMESTER

What is a good correlation coefficient When we take all of the data above and calculate a correlation coefficient, we end up with r­comp = +.95. If your correlation coefficient is a positive number you can tell, just by looking at it, that there is a positive relationship between the two variables. Remember that a positive relationship means that as values on one variable increase (go up) the values on the other variable tend to increase (go up) in a predictable manner. If your correlation coefficient is a positive number, then you know that you have a positive relationship. This means that the values of the two variables rise and fall together, in a predictable way.

http://www.derekborman.com/230_web_book/module4/correlation/index.html

6/15

3/4/2016

Correlation

(../../images/correlation/perfect_correlation.jpg)One of the most important things to remember about correlation coefficients is that they always fall between ­1.00 and +1.00. All correlation coefficients range from ­1.00 to +1.00. That never changes. A correlation coefficient of ­1.00 tells you that there is a perfect negative relationship between the two variables. This means that as values on one variable increase there is a perfectly predictable decrease in values on the other variable. In other words, as one variable goes up, the other goes in the opposite direction (it goes down). A correlation coefficient of +1.00 tells you that there is a perfect positive relationship between the two variables. This means that as values on one variable increase there is a perfectly predictable increase in values on the other variable. In other words, as one variable goes up so does the other. A correlation coefficient of 0.00 tells you that there is a zero correlation, or no relationship, between the two variables. In other words, as one variable changes (goes up or down) you can’t really say anything about what happens to the other variable.

Of course, our understanding of the world is imperfect. Psychologists and scientists rarely end up with a perfect correlation coefficient. Most correlation coefficients tend to be somewhat lower than plus or minus 1.00. The closer a correlation coefficient is to 0.00, the weaker the relationship is and the less able you are to tell exactly what happens to one variable based on knowledge of the other variable. The closer a correlation coefficient approaches plus or minus 1.00 the stronger the relationship is and the more accurately you are able to predict what happens to one variable based on the knowledge you have of the other variable. So, should you stick with this job or move on to greener pastures? Read on.  

Squaring your Correlation: The Coefficient of Determination

Many students who are new to the concept of correlation coefficients make the mistake of thinking that a correlation coefficient is a percentage. They tend to think that when r = .90, it means that 90% of the changes in one variable are accounted for or by the other variable. Even worse, some think that this means that any predictions you make will be 90% accurate. This is not correct! A correlation coefficient is a “ratio” not a percent. However it is very easy to translate the correlation coefficient into a percentage. All you have to do is “square the correlation coefficient” which means that you multiply it by itself. So, if the symbol for a correlation coefficient is r, then the symbol for this new statistic is simply r2 which can be called r squared. There is a name for this newstatistic—the coefficient of determination. The coefficient of determination tells you the percentage of one variable that is directly related to the variability in the other variable. Another way to think about this is that the coefficient of determination is the percentage of characteristics that the two variables have in common. These characteristics underlie the values of our two variables and can be discussed (hypothetically) in concrete terms. More on this in a minute.

http://www.derekborman.com/230_web_book/module4/correlation/index.html

7/15

3/4/2016

Correlation

 (../../images/correlation/overlap_diagrams.png)For now, let's visualize. Click image to enlarge. Overlapping variability can be depicted nicely with Venn diagrams as you see here. In the first example, there is no overlap between the two variables. This means that there is no relationship and that whatever we know about Variable A tells us nothing at all about Variable B. In the second example, there is some overlap. The correlation coefficient is r = 0.25. If we square that to get the coefficient of determination (r2) would get 12.25%. This tells us that 12.25% of how a person scored on Variable B is directly related to how he/she scored on Variable A (and vice­versa). In other words, if we know a person’s score on Variable A we know about 12.25% of what there is to know about how they scored on Variable B! We could also say that the two variables have 12.25% of underlying characteristics in common. That is quite an improvement over the first example. We could actually make an enhanced prediction based on your knowledge. In the third example, there is even more overlap between the two variables. The correlation coefficient is r = 0.80. By squaring r we can see that fully 64% of the variation in scores on Variable B is directly related to scores on Variable A. Predictions based on one variable or the other would be even more accurate. That is, in the previous example, we would be only 12.25% certain of our predictive accuracy. Whereas in the second example, we could be 64% So what we know is that larger correlations allow us to make better predictions and provide us with more understanding about the characteristics that two variables have in common. But you still don't know whether you should stay with your current employer or break away to start up that dating website focusing exclusively on people who are allergic to peanuts. Read on.

Steps of Hypothesis Testing

Thus far we've not really addressed the topic of statistical significance. We'll do that now. We'll be using the same procedures as before. State the null and alternative, alpha level, compare comp and crit, draw conclusions, and so forth. Let's walk through the steps of hypothesis testing for the hourly wage x months worked example. 1. H0: ρ = 0. We've introduced a new symbol. The symbol ρ which is read as "rho." Rho is the correlation within a population. For correlation analyses, we're not expressing the null in terms of average differences. Instead, the null states that there is no relationship between the selected variables from the population. Stating this in words for our example: There is no relationship between the number of months that someone works for this company and someone's current hourly wage.  2. H1: ρ ≠ 0 or ρ > 0. Our alternative hypothesis probably would be a directional hypothesis (ρ > 0) in this example. When you set out to collect data from employees at the company, you would have anticipated that as people work more months, they are paid more. Stating the directional alternative in words: There is a significant positive relationship between the number of months that someone works for this company and someone's current hourly wage.

http://www.derekborman.com/230_web_book/module4/correlation/index.html

8/15

3/4/2016

Correlation

3. Set α = .05.  4. Reject H0 if |r­comp| ≥ r­crit (r.05 for df = N ­ 2). In this case, r.05 (df = 8) = .632. Notice a few things about our rejection statement. First, r­comp is expressed as an absolute value because we can have positive and negative coefficients in correlation analyses. Second, degrees of freedom for this type of correlation analyses always equals the number of pairs of scores minus 2. And for our example, we have 10 pairs of scores. Finally, our r­crit is .632, found by using our df and alpha level to find the critical correlation value in our Table of Critical r Values For Pearson Correlation. What we are essentially stating in this step is that if our computed correlation coefficient (positive or negative) is equal to or greater than .632, then we will reject our initial assumption that there is no relationship between our variables.  5. The fifth step is to perform the computation. In this chapter we won't actually be performing the Pearson's r calculation. Instead I will simply give the computed value to you. For our example, r­comp = .95. As far as r­comp goes, that's pretty big. Our critical r value was .632. Because r­comp is greater than r­crit, we will be rejecting our null hypothesis and concluding that there is a significant, non­chance correlation between the two variables. 6a. A Pearson's r, bivariate correlation analysis was conducted to determine whether there is no relationship between the number of months that someone works for this company and someone's current hourly wage. 6b. There was sufficient evidence to reject the null hypothesis; r(8) = +.95, p