Docsity

Linear Correlation and Regression: A Comprehensive Guide with Examples, Slides of Statistics

Toggle sidebar
bg1
1
Correlation and
Regression
Chapter 9
§9.1
Correlation
Larson & Farber, Elementary Statistics: Picturing the World, 3e 3
Correlation
A correlation is a relationship between two variables. The data
can be represented by the ordered pairs (x, y) where x is the
independent (or explanatory)variable, and y is the dependent
(or response)variable.
A scatter plot can be used to determine
whether a linear (straight line) correlation
exists between two variables.
x
2 4
–2
– 4
y
2
6
– 2
2
– 4
1
– 1
3
0
4
2y
5
x
Example:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Linear Correlation and Regression: A Comprehensive Guide with Examples and more Slides Statistics in PDF only on Docsity!

Correlation and

Regression

Chapter 9

Correlation

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^3)

Correlation

A correlation is a relationship between two variables. The data can be represented by the ordered pairs (x, y) where x is the independent (or explanatory) variable, and y is the dependent (or response) variable.

A scatter plot can be used to determine whether a linear (straight line) correlation exists between two variables.

x 2 4

  • 4

y

2

6

y 2

x 5

Example:

Larson & Farber, Elementary Statistics: Picturing the World, 3e 4

Linear Correlation

x

y

Negative Linear Correlation

x

y

No Correlation

x

y

Positive Linear Correlation

x

y

Nonlinear Correlation

As x increases, y tends to decrease.

As x increases, y tends to increase.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^5)

Correlation Coefficient

The correlation coefficient is a measure of the strength and the direction of a linear relationship between two variables. The symbol r represents the sample correlation coefficient. The formula for r is

2 2 2 2

n xy x y r n x x n y y

The range of the correlation coefficient is −1 to 1. If x and y have a strong positive linear correlation, r is close to 1. If x and y have a strong negative linear correlation, r is close to −1. If there is no linear correlation or a weak linear correlation, r is close to 0.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^6)

Linear Correlation

x

y

Strong negative correlation

x

y

Weak positive correlation

x

y

Strong positive correlation

x

y

Nonlinear Correlation

r = −0.91 r = 0.

r = 0. r = 0.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 10

Correlation Coefficient

Test score, y

Hours, x

Example continued:

100

x

y

Hours watching TV

Test score

(^80) 60 40 20

2 4 6 8 10 Continued.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^11)

Correlation Coefficient

xy 0 85 164222285340380420348455525500 x^201499252525364949100

Test score, y 96 85 82 74 95 68 76 84 58 65 75 50

5476

3

6724

2

7225

1

9216

0

7056

5

5776

5

4624

5

9025

3

4225

7

3364

6

5625

7

2500

10

y^2

Hours, x

Example continued:

( ) ( ) (^2) ( ) 2 2 ( ) 2 r^ n^ xy^ x^ y n x x n y y

=^ ∑^ − ∑^ ∑ ∑ − ∑ ∑ − ∑

( ) ( ) (^2) ( ) 2

1 2(3 7 2 4 ) 5 4 9 0 8 1 2(3 3 2 ) 5 4 1 2(7 0 8 3 6 ) 9 0 8

=^ − − −

≈ − 0 .8 3 1

There is a strong negative linear correlation. As the number of hours spent watching TV increases, the test scores tend to decrease.

∑ x= 54 ∑ y= 908 ∑ x y= (^3724) ∑ x^2 = 332 ∑ y^2 = 70836

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^12)

Testing a Population Correlation Coefficient

Once the sample correlation coefficient r has been calculated, we need to determine whether there is enough evidence to decide that the population correlation coefficient ρ is significant at a specified level of significance. One way to determine this is to use Table 11 in Appendix B.

If |r| is greater than the critical value, there is enough evidence to decide that the correlation coefficient ρ is significant.

5 0.878 0.

7 0.754 0.

6 0.811 0.

4 0.950 0.

n αα αα = 0.05 αααα = 0. For a sample of size n = 6, ρ is significant at the 5% significance level, if |r| > 0.811.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 13

Testing a Population Correlation Coefficient

  1. Determine the number of pairs of data in the sample.
  2. Specify the level of significance.
  3. Find the critical value.
  4. Decide if the correlation is significant.
  5. Interpret the decision in the context of the original claim.

Finding the Correlation Coefficient ρ In Words In Symbols Determine n.

Identify α.

Use Table 11 in Appendix B. If |r| > critical value, the correlation is significant. Otherwise, there is not enough evidence to support that the correlation is significant.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^14)

Testing a Population Correlation Coefficient

Test score, y

Hours, x

Example: The following data represents the number of hours 12 different students watched television during the weekend and the scores of each student who took a test the following Monday.

Continued.

The correlation coefficient r ≈ −0.831.

Is the correlation coefficient significant at α = 0.01?

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^15)

Testing a Population Correlation Coefficient

Example continued:

r ≈ −0.

5 0.878 0. 6 0.811 0.

4 0.950 0.

n αα αα = 0.05 αα αα = 0. n = 12

11 0.602 0.

13 0.553 0.

12 0.576 0.

10 0.632 0.

α = 0.

Because, the population correlation is significant, there is enough evidence at the 1% level of significance to conclude that there is a significant linear correlation between the number of hours of television watched during the weekend and the scores of each student who took a test the following Monday.

|r| > 0.

Appendix B: Table 11

Larson & Farber, Elementary Statistics: Picturing the World, 3e 19

Hypothesis Testing for ρ

  1. Find the standardized test statistic.
  2. Make a decision to reject or fail to reject the null hypothesis.
  3. Interpret the decision in the context of the original claim.

Using the t-Test for the Correlation Coefficient ρ In Words In Symbols

If t is in the rejection region, reject H 0. Otherwise fail to reject H 0.

2 2

t^ r 1 r n

= − −

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^20)

Hypothesis Testing for ρ

Test score, y

Hours, x

Example: The following data represents the number of hours 12 different students watched television during the weekend and the scores of each student who took a test the following Monday.

Continued.

The correlation coefficient r ≈ −0.831.

Test the significance of this correlation coefficient significant at α =

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^21)

Hypothesis Testing for ρ

Example continued:

H 0 : ρ = 0 (no correlation) Ha: ρ ≠ 0 (significant correlation)

The level of significance is α = 0.01.

Degrees of freedom are d.f. = 12 – 2 = 10. The critical values are −t 0 = −3.169 and t 0 = 3.169. The standardized test statistic is

−t 0 = −3. t 0 t^0 = 3.

2

1 ( 0.831) 12 2

=^ − − − −

2 2

t^ r 1 r n

= − − ≈ − 4.72.

The test statistic falls in the rejection region, so H 0 is rejected.

At the 1% level of significance, there is enough evidence to conclude that there is a significant linear correlation between the number of hours of TV watched over the weekend and the test scores on Monday morning.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 22

Correlation and Causation

The fact that two variables are strongly correlated does not in itself imply a cause-and-effect relationship between the variables.

If there is a significant correlation between two variables, you should consider the following possibilities.

  1. Is there a direct cause-and-effect relationship between the variables? Does x cause y?
  2. Is there a reverse cause-and-effect relationship between the variables? Does y cause x?
  3. Is it possible that the relationship between the variables can be caused by a third variable or by a combination of several other variables?
  4. Is it possible that the relationship between two variables may be a coincidence?

Linear Regression

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^24)

Residuals

After verifying that the linear correlation between two variables is significant, next we determine the equation of the line that can be used to predict the value of y for a given value of x.

Each data point di represents the difference between the observed y-value and the predicted y-value for a given x-value on the line. These differences are called residuals.

x

y

d 1 d 2

d 3

For a given x-value, d = (observed y-value) – (predicted y-value)

Observed y- value

Predicted y- value

Larson & Farber, Elementary Statistics: Picturing the World, 3e 28

Regression Line

Example: The following data represents the number of hours 12 different students watched television during the weekend and the scores of each student who took a test the following Monday.

xy 0 85 164222 285340380420348455525500 x^201499252525364949100

Test score, y 96 85 82 74 95 68 76 84 58 65 75 50

5476

3

6724

2

7225

1

9216

0

7056

5

5776

5

4624

5

9025

3

4225

7

3364

6

5625

7

2500

10

y^2

Hours, x

∑x = 54 ∑ y= 908 ∑ xy= (^3724) ∑x 2 = 332 ∑y 2 = 70836

a.) Find the equation of the regression line. b.) Use the equation to find the expected test score for a student who watches 9 hours of TV.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^29)

Regression Line

Example continued: ( ) ( ) ( ) 2 2

n xy x y m n x x

( ) ( ) ( ) 2

b = y −m x

ŷ = –4.07x + 93.

100

x

y

Hours watching TV

Test score

(^80) 60 40 20

2 4 6 8 10

( ) (^ )

( , ) 54 908, 4.5,75. 12 12 x y = ≈

Continued.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^30)

Regression Line

Example continued: Using the equation ŷ = –4.07x + 93.97, we can predict the test score for a student who watches 9 hours of TV.

ŷ = –4.07x + 93.

A student who watches 9 hours of TV over the weekend can expect to receive about a 57.34 on Monday’s test.

Measures of Regression

and Prediction Intervals

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^32)

Variation About a Regression Line

To find the total variation, you must first calculate the total deviation, the explained deviation, and the unexplained deviation.

Tot al devia tion = y (^) i−y E xplain ed devia tion = yˆ (^) i−y Un expla in ed devia t ion = y (^) i −yˆi

x

y (^) (xi, yi)

(xi, ŷi) (xi, yi)

Unexplained deviation y (^) i −y ˆi Total deviation y (^) i− y Explained deviation y ˆ (^) i−y

y

x

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^33)

Variation About a Regression Line

The total variation about a regression line is the sum of the squares of the differences between the y-value of each ordered pair and the mean of y.

The explained variation is the sum of the squares of the differences between each predicted y-value and the mean of y.

The unexplained variation is the sum of the squares of the differences between the y-value of each ordered pair and each corresponding predicted y-value.

( )

2 Tot a l va r ia t ion = ∑ y (^) i−y

( ) 2 E xplain ed var iat ion = ∑ yˆ (^) i−y

( ) 2 U nexpla in ed va r ia t ion = ∑ y (^) i −yˆi Tot al var iat ion = E xplain ed var iat ion +Un explain ed var iat ion

Larson & Farber, Elementary Statistics: Picturing the World, 3e 37

The Standard Error of Estimate

Example: The regression equation for the following data is ŷ = 1.2x – 3.8. Find the standard error of estimate.

xi yi ŷi (yi – ŷi )^2

∑ = 0.

Unexplained variation ( ˆ)^2 2 s e y^ i^ yi n = ∑^ − −

= (^5) − 2 ≈0. The standard deviation of the predicted y value for a given x value is about 0.365.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^38)

The Standard Error of Estimate

Example: The regression equation for the data that represents the number of hours 12 different students watched television during the weekend and the scores of each student who took a test the following Monday is ŷ = –4.07x + 93.97. Find the standard error of estimate.

ŷi 93.97 89.9 85.83 81.76 81.76^ 73. (yi – ŷi)^2 4.12 24.01 14.67 60.22 175.3 31.

Test score, yi^968582749568

Hours, xi^0

ŷi 73.6273.62 69.55 65.48 65.48 53. (yi – ŷi)^2 5.66107.74133.4 0.23 90.63 10.

Test score, yi 76 84 58 65 75 50

Hours, xi 5 5 6 7 7 10

Continued.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^39)

The Standard Error of Estimate

Example continued:

( )^2

i i e

y y s n

The standard deviation of the student test scores for a specific number of hours of TV watched is about 8.11.

( ˆ)^2 658.

∑ y (^) i − yi = Unexplained variation

Larson & Farber, Elementary Statistics: Picturing the World, 3e 40

Prediction Intervals

Two variables have a bivariate normal distribution if for any fixed value of x, the corresponding values of y are normally distributed and for any fixed values of y, the corresponding x- values are normally distributed. A prediction interval can be constructed for the true value of y.

Given a linear regression equation ŷ = mx + b and x 0 , a specific value of x, a c-prediction interval for y is ŷ – E < y < ŷ + E where

The point estimate is ŷ and the margin of error is E. The probability that the prediction interval contains y is c.

2 0 2 2

1 (^ )

c e ( )

n x x E t s n (^) n x x

− = + + ∑ − ∑

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^41)

Prediction Intervals

1. Identify the number of ordered pairs in d.f. = n− 2

the data set n and the degrees of freedom.

  1. Use the regression equation and the given x-value to find the point estimate ŷ.
  2. Find the critical value tc that corresponds to the given level of confidence c.

Construct a Prediction Interval for y for a Specific Value of x

In Words In Symbols

y ˆ = m x i+b

Use Table 5 in Appendix B.

Continued.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^42)

Prediction Intervals

  1. Find the standard error of estimate se.
  2. Find the margin of error E.
  3. Find the left and right endpoints and form the prediction interval.

Construct a Prediction Interval for y for a Specific Value of x

In Words In Symbols

( )^2 ˆ 2

i i e

y y s n

2 0 2 2

1 (^ ) 1 c e ( )

n x x E t s n (^) n x x

− = + + ∑ − ∑

Left endpoint: ŷ – E Right endpoint: ŷ + E Interval: ŷ – E < y < ŷ + E

Larson & Farber, Elementary Statistics: Picturing the World, 3e 46

Multiple Regression Equation

In many instances, a better prediction can be found for a dependent (response) variable by using more than one independent (explanatory) variable.

For example, a more accurate prediction of Monday’s test grade from the previous section might be made by considering the number of other classes a student is taking as well as the student’s previous knowledge of the test material.

A multiple regression equation has the form ŷ = b + m 1 x 1 + m 2 x 2 + m 3 x 3 + … + mkxk where x 1 , x 2 , x 3 ,…, xk are independent variables, b is the y- intercept, and y is the dependent variable.

  • Because the mathematics associated with this concept is complicated, technology is generally used to calculate the multiple regression equation.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^47)

Predicting y-Values

After finding the equation of the multiple regression line, you can use the equation to predict y-values over the range of the data.

Example: The following multiple regression equation can be used to predict the annual U.S. rice yield (in pounds).

ŷ = 859 + 5.76x 1 + 3.82x 2

where x 1 is the number of acres planted (in thousands), and x 2 is the number of acres harvested (in thousands). (Source: U.S. National Agricultural Statistics Service)

a.) Predict the annual rice yield when x 1 = 2758, and x 2 = 2714.

b.) Predict the annual rice yield when x 1 = 3581, and x 2 = 3021.

Continued.

Larson & Farber, Elementary Statistics: Picturing the World, 3e (^48)

Predicting y-Values

Example continued:

= 859 + 5.76(2758) + 3.82(2714) = 27,112.

a.) ŷ = 859 + 5.76x 1 + 3.82x 2

The predicted annual rice yield is 27,1125.56 pounds.

= 859 + 5.76(3581) + 3.82(3021) = 33,025.

b.) ŷ = 859 + 5.76x 1 + 3.82x 2

The predicted annual rice yield is 33,025.78 pounds.