Docsity

Correlation and Regression: Solutions - Chapter 9, Cheat Sheet of Earth science

Toggle sidebar
bg1
1
Σ Σ
2
.
n
Σ
n
x2
−
(
x
)
y2
−
(
y
)
2
Chapter 9: Correlation and Regression: Solutions
9.1Correlation
In this section, we aim to answer the question: Is there a relationship
between A and B?
Istherearelationshipbetweenthenumberofemployeetraininghoursandthenumberof
on-the-jobaccidents?Istherearelationshipbetweenthenumberofhoursapersonsleeps
and their reaction time? Is there a relationship between the number of hours a
student
spendsstudyingforacalculustestandthestudent’sscoreonthatcalculustest?
Definition: acorrelationis a relationship between two variables.
Typically,wetakextobetheindependent
variable.Wetakeytobethedependent variable. Data is representedbya
collection of ordered pairs( x,y).
Mathematically,thestrengthanddirectionofalinearrelationshipbetweentwovariablesis
representedbythecorrelationcoefficient.Supposethattherearenorderedpairs(x,y)t
hat make up a sample from a population. The correlation coefficientris
givenby:
.
n
Σ
(xy)
−(
Σ
x)
(
Σ
y)
This will always be a number between -1 and 1 (inclusive).
Ifris close to 1,wesaythat the variables arepositivelycorrelated.This means
there
islikelyastronglinearrelationshipbetweenthetwovariables,withapositiveslope.
Ifris close to -1,wesaythat the variables arenegativelycorrelated.This means
there
islikelyastronglinearrelationshipbetweenthetwovariables,withanegativeslope.
Ifris close to 0,wesaythat the variables arenotcorrelated.This means that
there
islikelynolinearrelati onshi pbetweenthetwovariables,however,thevariablesma
ystillberelated in someotherway.
•
•
•
r
=
Σ
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Correlation and Regression: Solutions - Chapter 9 and more Cheat Sheet Earth science in PDF only on Docsity!

n Σ n x^2 − ( x )

y^2 −( y )

2

Chapter 9: Correlation and Regression: Solutions

9.1 Correlation

In this section, we aim to answer the question: Is there a relationship

between A and B?

Istherearelationshipbetweenthenumberofemployeetraininghoursandthenumberof

on-the-jobaccidents?Istherearelationshipbetweenthenumberofhoursapersonsleeps

and their reaction time? Is there a relationship between the number of hours a

student

spendsstudyingforacalculustestandthestudent’sscoreonthatcalculustest?

Definition: a correlation is a relationship between two variables.

Typically,wetake x tobethe independent variable .Wetake y tobethe dependent variable. Data is representedbya collection of ordered pairs( x,y ).

Mathematically,thestrengthanddirectionofalinearrelationshipbetweentwovariablesis representedbythe correlationcoefficient .Supposethatthereare nordered pairs( x,y )t hat make up a sample from a population. The correlation coefficient r is givenby:

n

( xy ) −(

Σ x )(

Σ y )

This will always be a number between -1 and 1 (inclusive).

If r is close to 1,wesaythat the variables are positivelycorrelated .This means

there

islikelyastronglinearrelationshipbetweenthetwovariables,withapositiveslope.

If r is close to -1,wesaythat the variables are negativelycorrelated .This means there

islikelyastronglinearrelationshipbetweenthetwovariables,withanegativeslope.

If r is close to 0,wesaythat the variables are notcorrelated .This means that there

islikelyno linearrelationship betweenthetwovariables,however,thevariablesma ystillberelatedinsomeotherway.

r

Example2:Thetablebelowshowsthenumberofabsences, x ,inaCalculuscourseandthe

finalexamgrade, y ,for7students.Findthecorrelationcoefficientandinterpretyourresult.

x 1 0 2 6 4 3 3

y^95 90 90 55 70 80

You may use the facts that (double check this for practice)

Σ x = 19 ,

Σ y = 565 ,

Σ x (^2) = 75 ,

y^2 = 46 , 775 ,

Σ xy= 1 , 380.

Calculate the numerator:

n

( xy ) −.

Σ x Σ.

Σ y Σ= 7 · 1380 − 19 · 565 = − 1075

Then calculate thed e n o m i n a t o r :

. n x^2

x 2. n y^2

y 2 =. 7 · 75 −(1 9)

2

. 7 · 46775 −(565)

2

Now, divide tog e t r

Interpretthisresult:Thereisastrongnegativecorrelationbetweenthenumberofabsences and

the final exam grade, since r is very close to 1. Thus, as the number of absences

increases,thefinalexamgradetendstodecrease.

Example3:Thetablebelowshowstheheight, x ,ininchesandthepulserate, y ,perminute,

for 9 people. Find the correlation coefficient and interpret yourr e s u l t.

x^68 72 65 70 62 75 78 64

y 90 85 88 10 0

You may use the facts that (double check this for practice)

Σ x = 622 ,

Σ y = 773 ,

Σ x (^2) = 43 , 206 ,

Σ y^2 = 68 , 007 ,

xy= 53 , 336.

Calculate the numerator:

n

( xy ) −.

Σ x Σ.

Σ y Σ= 9 · 53336 − 622 · 773 = − 782

Then calculate thed e n o m i n a t o r :

. n x^2

x 2. n y^2

y 2 =. 9 · 432 06 −( 622)

2

. 9 · 68007 −(773)

2

Now, divide tog e t r

Interpret this result: There appears to be an extremely weak, if any,

correlation between height and pulse rate, since r is close to 0.

Example4:Thetablebelowshowsthenumberofabsences, x ,inaCalculuscourseandthe

finalexamgrade, y ,for7students.Findthecorrelationcoefficientandinterpretyourresult.

x 1 0 2 6 4 3 3

y^85 80 70 55 90 90

There are 7 ordered pairs ( x, y ), so n = 7. Calculate the needed sums:

x y x

2 y

2 xy

1 85 1 722 5

x = 19 y = 565 x

2 = 75 4 y

2 = 46775 xy = 1470

n n^5

9.2 LinearR e g r e s s i o n

Ifthereisa“significant”linearcorrelationbetweentwovariables,thenextstepistofindthe

equationofalinethat“best”fitsthedata.Suchanequationcanbeusedforprediction:given

anew x -value,thisequationcanpredictthe y -

valuethatisconsistentwiththeinformationknownaboutthedata.Thispredicted y -

valuewillbedenotedby y ˆ.Thelinerepresentedbysuchanequationiscalledthe linear

regressionline.

The equation for a line is

y ˆ= mx+b,

where m is the slope of the line and b is the y-intercept (the y-value for which x

is 0).

Ingeneral,theregressionline,willnotpassthrougheachdatapoint.Foreachdatapoin

t, there is an error: the difference between the y -value from the data and the y -

value

ontheline, y ˆ.Bydefinition,thislinearregressionlineissuchthatthesumofthesquaresoftheerrorsi

stheleastpossible.Itturnsout,givenasetofdata,thereisonlyonesuchline.The

slope mand y-intercept bare givenby

m=n

Σxy −(

Σ x )(

Σ y ) (^) b =Σ

y −m Σ

x

n

( x^2 ) −(

Σ x )

(^2) n n

Examples: Find the equation of the regression line for each of the two

examples and two practice problems in section 9_._ 1.

Example 1:

First, find the slope m. Start by determining the numerator:

n

Σ xy −.

Σ x Σ.

Σ y Σ 5 · 1189 − 37 · 139 = 802

Next, find thed e n o m i n a t o r :

n

( x

2 ) −.

x Σ2= 5 · 375 −(37)

2 = 506

Divide to obtain m = 506

Now,findthey-intercept: b = Σ

y− mΣ

x≈ 139 − 1. 58

Therefore,theequationoftheregressionline is y ˆ= 1_._ 58 x+ 16_._ 11

AdditionalQuestions:Usetheequationsto(Ex1)predictthehourlypayrateofanemployee

whohasworkedfor20years,and(Ex2)predictthetestscoreforastudentwith5absences.

For an employee who has worked 20 years, x = 20. Plug this into the

equation for theTherefore,t (^) −

heequation

oftheregres

sionlineis y ˆ

= 0_._ 40 x+ 1

13_._ 53 .Even

thoughwefo

undan

equation,

recall that

the

correlation

between x a

nd y in this

examplew

asweak.

Thus, this

regression

line many

not work

very well

for the

data.

Example

4:

n n 7 7

First, find the slope m. Start by determining the numerator:

n

Σ xy −.

Σ x Σ.

Σ y Σ= 7 · 1470 − 19 · 565 = − 445

Next, find thed e n o m i n a t o r :

n

( x

2 ) −.

x Σ2= 7 · 75 −(19)

2 = 164

Divide to obtain m=

Now, find the y-intercept: b =Σ

y −m Σ

x ≈

Therefore,theequationoftheregressionlineis y ˆ= 2_._ 71 x+ 88_._ 07 .Eventhoughwefound

an equation, recall that the correlation between x and y in this

examplewasweak. Thus, this regression line many not work very well for the

data.Forexample, for a student with x = 0 absences, plugging in,wefind that

the grade predictedbythe regression line is 88.