Chapter 4: More on Two-Variable (Bivariate) Data.

55
Chapter 4: More on Two-Variable (Bivariate) Data

Transcript of Chapter 4: More on Two-Variable (Bivariate) Data.

Page 1: Chapter 4: More on Two-Variable (Bivariate) Data.

Chapter 4:More on

Two-Variable (Bivariate) Data

Page 2: Chapter 4: More on Two-Variable (Bivariate) Data.

4.1 Transforming Relationships Animal’s Brain Weight vs. Weight of BodyAnimal’s Brain Weight vs. Weight of Body

Outliers

r=.86

Page 3: Chapter 4: More on Two-Variable (Bivariate) Data.

Logarithm

r=.50

Drop Outliers

Page 4: Chapter 4: More on Two-Variable (Bivariate) Data.

Plot Logarithm vs. Logarithm

r=.96 The vertical spread about the LSRL is similar everywhere, so the predictions of brain weight from body weight will be pretty precise (high r2) – in LOG SCALE

Page 5: Chapter 4: More on Two-Variable (Bivariate) Data.

Working with a function of our original measurements can greatly simplify statistical analysis.

Transforming-

How?

Page 6: Chapter 4: More on Two-Variable (Bivariate) Data.

Recall…Recall… Chapter 1 we did Linear Transformations

Took a set of data and transformed it linearly Called:

SHIFTING

C to F

Meters to Miles

4 669

15

Page 7: Chapter 4: More on Two-Variable (Bivariate) Data.

A Linear Transformation CANNOT make a curved relationship between 2 variables “straight”

Resort to common non-linear functions like the logarithm, positive & negative powers

We can transform either one of the explanatory/response variables OR BOTH when we do we will call the variable “t”

Page 8: Chapter 4: More on Two-Variable (Bivariate) Data.

Real World Example:Real World Example:We measure fuel consumption of a car in

miles per gallon

Engineers measure it in gallons per mile (how many gallons of fuel the car needs to travel 1 mile)

Reciprocal Transformation: 1/f(t)

My Car- 25 miles per gallon

1/25=.04 gallons per mile

Page 9: Chapter 4: More on Two-Variable (Bivariate) Data.

Monotonic Function A A monotonic functionmonotonic function f(t) moves in one f(t) moves in one

direction as its argument “t” increases direction as its argument “t” increases Monotonic IncreasingMonotonic Increasing

Monotonic DecreasingMonotonic Decreasing

Page 10: Chapter 4: More on Two-Variable (Bivariate) Data.

Monotonic Increasing:

2t

Positive “t”

a + bt

slope b>0tlog2t

Page 11: Chapter 4: More on Two-Variable (Bivariate) Data.

Monotonic Decreasing:

Positive “t”

a + bt

slope b<0 2

11

tt

11 tt

Page 12: Chapter 4: More on Two-Variable (Bivariate) Data.

Nonlinear monotonic transformations change data enough to change form or relations between 2 variables, yet preserve order and allow recovery of original data.

Page 13: Chapter 4: More on Two-Variable (Bivariate) Data.

Strategy:1.1. If the variable that you want to If the variable that you want to

transform has values that are 0 or transform has values that are 0 or negative apply linear transformation negative apply linear transformation (add a constant) to get all positive.(add a constant) to get all positive.

2.2. Choose power or logarithmic Choose power or logarithmic transformation that approximately transformation that approximately straightens the scatterplot.straightens the scatterplot.

Page 14: Chapter 4: More on Two-Variable (Bivariate) Data.

Ladder of Power Transformations:

Power Function: tP

Page 15: Chapter 4: More on Two-Variable (Bivariate) Data.

Power Functions:

Monotonic Power Function

For t > 0….

1. Positive p – are monotonic increasing

2. Negative p – are monotonic decreasing

2t

2

11

tt

Page 16: Chapter 4: More on Two-Variable (Bivariate) Data.

Monotonic Decreasing- Hard to interpret because reversed order of original data point

We want to make all tP therefore monotonic increasing.

We can apply a

LINEAR TRANSFORMATION p

t p 1

Page 17: Chapter 4: More on Two-Variable (Bivariate) Data.

Original Data (t) Original Data (t) Power FunctionPower Function Linear Trans:Linear Trans:

00 undefinedundefined UndefinedUndefined

11 11 00

22

33

44

Linear Transformation: Linear Transformation:

1

11

t1t

p

t p 1

Page 18: Chapter 4: More on Two-Variable (Bivariate) Data.

11 tt

11 tt

11 tt

11 ttp

t p 1

Page 19: Chapter 4: More on Two-Variable (Bivariate) Data.

p

t p 1

This is log t

This is a line

Page 20: Chapter 4: More on Two-Variable (Bivariate) Data.

Concavity of Power Functions:

P is greater than 1 =

- Push out right tail & pull in left tail

- Gets stronger as power p moves up away from 1

P is less than 1 =

- Push out left tail & pull in right tail

- Gets stronger as power p moves down away from 1

Page 21: Chapter 4: More on Two-Variable (Bivariate) Data.

Country’s GDB vs. Life Expectancy

Page 22: Chapter 4: More on Two-Variable (Bivariate) Data.

P=

Page 23: Chapter 4: More on Two-Variable (Bivariate) Data.

P=

Page 24: Chapter 4: More on Two-Variable (Bivariate) Data.

P=

Use

x

1

Page 25: Chapter 4: More on Two-Variable (Bivariate) Data.
Page 26: Chapter 4: More on Two-Variable (Bivariate) Data.

How do you know what transformation will make the scatterplot straight?

** DO NOT just push buttons!! ** We will develop methods of selection

1. Logarithmic Transformation

2. Power Transformation

Page 27: Chapter 4: More on Two-Variable (Bivariate) Data.

1. Logarithmic 1. Logarithmic TransformationsTransformations

Page 28: Chapter 4: More on Two-Variable (Bivariate) Data.

Exponential GrowthExponential Growth

A variable grows…Linearly:

Exponentially:

Page 29: Chapter 4: More on Two-Variable (Bivariate) Data.

The King’s Chess Board…The King’s Chess Board…

xbay King’s Offer: 1,000,000 grains - 30 days

bxay

Wise Man: 1 grain per day and double for 30 days

Page 30: Chapter 4: More on Two-Variable (Bivariate) Data.

Cell Phone GrowthCell Phone Growth

Page 31: Chapter 4: More on Two-Variable (Bivariate) Data.

Suspect Exponential Suspect Exponential Growth…Growth…1.1. Calculate Ratios of Consecutive TermsCalculate Ratios of Consecutive Terms

- IF approximately the same… continue- IF approximately the same… continue

Page 32: Chapter 4: More on Two-Variable (Bivariate) Data.

Suspect Exponential Suspect Exponential Growth…Growth…

2. Apply a Transformation that: 2. Apply a Transformation that:

a. Transforms exponential growth into a. Transforms exponential growth into linear growth linear growth

b. Transforms non-exponential growth b. Transforms non-exponential growth into non-linear growthinto non-linear growth

xbay

Page 33: Chapter 4: More on Two-Variable (Bivariate) Data.

Logarithm Review…Logarithm Review…

xbifonlyandifyx yb log

1.log(AB)=

2.log(A/B)=

3.logXp =

Page 34: Chapter 4: More on Two-Variable (Bivariate) Data.

The Transformation…The Transformation…We hypothesize an exponential model of the

form y=abx

To gain linearity, use the (x, log(y)) To gain linearity, use the (x, log(y)) transformationtransformation

)log(log xaby ylogylog

Form? –

Page 35: Chapter 4: More on Two-Variable (Bivariate) Data.

When our data is growing exponentially… if When our data is growing exponentially… if we plot the log of y versus x, we should we plot the log of y versus x, we should observe a straight line for the observe a straight line for the transformed data!transformed data!

xbay )(logloglog

Page 36: Chapter 4: More on Two-Variable (Bivariate) Data.
Page 37: Chapter 4: More on Two-Variable (Bivariate) Data.

LOG (Y) = -263 + 0.134 (year)

R-sq = 98.2%

Page 38: Chapter 4: More on Two-Variable (Bivariate) Data.

Eliminate first 4 years & perform regressionEliminate first 4 years & perform regression

Page 39: Chapter 4: More on Two-Variable (Bivariate) Data.

LOG (New Y) = -189 + 0.0970(New X)

R-sq = 99.99%

Page 40: Chapter 4: More on Two-Variable (Bivariate) Data.

Predictions in Predictions in Exponential Growth ModelExponential Growth Model

Regression is often used for predictionsRegression is often used for predictions In exponential growth, ________ rather In exponential growth, ________ rather

than actual values follow a linear patternthan actual values follow a linear pattern To make a prediction of Exp. Growth we To make a prediction of Exp. Growth we

must thus “undo” the logarithmic must thus “undo” the logarithmic transformation.transformation.

The inverse operation of a logarithm is _____________________

Page 41: Chapter 4: More on Two-Variable (Bivariate) Data.

LOG (New Y) = -189 + 0.0970(New X)

R-sq = 99.99%

Predict the number of cell phone users in 2000.

)(0970.189)log( 1010 NewXNewY

y

y

ˆ

ˆ

Page 42: Chapter 4: More on Two-Variable (Bivariate) Data.

If a variable grows exponentially… its ___________ grow linearly!

In other words… if (x, y) is exponential, then (x, log(y)) is linear!

Page 43: Chapter 4: More on Two-Variable (Bivariate) Data.

Read and do Technology Toolbox- Page 210-211 on your own!!

Page 44: Chapter 4: More on Two-Variable (Bivariate) Data.

2. Power 2. Power TransformationsTransformations

Page 45: Chapter 4: More on Two-Variable (Bivariate) Data.

Example:

Pizza Shop- order pizza by diameter10 inch 12 inch 14 inch

Amount you get depends on the area of the pizza

Area circle = pi times the square of the radius

222

2

442x

xxrarea

Power Law Model

Power Law ModelPower Law Model

Page 46: Chapter 4: More on Two-Variable (Bivariate) Data.

Power LawsPower Laws We expect area to go up with the square of We expect area to go up with the square of

dimensiondimension We expect volume to go up with the cube of a We expect volume to go up with the cube of a

dimensiondimension

Real Examples: Many Characteristics of Living Real Examples: Many Characteristics of Living ThingsThings

Kleiber’s Law-Kleiber’s Law- The rate at which animals use The rate at which animals use energy goes up as the ¾ power of their body energy goes up as the ¾ power of their body weight (works from bacteria to whales).weight (works from bacteria to whales).

Page 47: Chapter 4: More on Two-Variable (Bivariate) Data.

Power Laws Become LinearPower Laws Become Linear Exponential growth becomes linear when Exponential growth becomes linear when

we apply the logarithm to the response we apply the logarithm to the response variable (y).variable (y).

Power Laws become linear when we Power Laws become linear when we apply the logarithm transformation to apply the logarithm transformation to BOTH variables.BOTH variables.

Page 48: Chapter 4: More on Two-Variable (Bivariate) Data.

To Achieve Linearity…To Achieve Linearity…

1. The power law model is

2. Take the logarithm of both sides of equation (this straightens scatterplot)

3. Power p in the power law becomes the slope of the straight line that links log(y) to log(x)

4. Undo transformation to make prediction

pxay

Page 49: Chapter 4: More on Two-Variable (Bivariate) Data.

Fish Example…Fish Example…Read Example 4.9 page 216Read Example 4.9 page 216

Model: weight = a x length3

Page 50: Chapter 4: More on Two-Variable (Bivariate) Data.

Log (weight) = log a + [3x log(length)]

Yes appears very linear- perform LSRL on [log(length), log(weight)]

Page 51: Chapter 4: More on Two-Variable (Bivariate) Data.

LSRL:

log(weight)= -1.8994 + 3.0494log(length)

r = .9926 r2 = .9985

Page 52: Chapter 4: More on Two-Variable (Bivariate) Data.

log(weight)= -1.8994 + 3.0494log(length)

= -1.894 + log(length)3.0494

This is the final power equation for the original data (note- look at p-value)!

Page 53: Chapter 4: More on Two-Variable (Bivariate) Data.

Prediction…Prediction…

Why did we do this?

weight = 10-1.8994 x length3.0494

Predict the weight of a 36cm fish

Page 54: Chapter 4: More on Two-Variable (Bivariate) Data.

Summary- Order of Summary- Order of Checking…Checking… 1. Look to see if there is a 1. Look to see if there is a

___________________if so use LSRL___________________if so use LSRL 2. If points are ____________plot (x, log 2. If points are ____________plot (x, log

y) or (x, ln y) to gain linearityy) or (x, ln y) to gain linearity 3. If there is a _________ relationship 3. If there is a _________ relationship

(power model) plot (logx, logy)(power model) plot (logx, logy) 4. If the scatterplot looks ________ plot 4. If the scatterplot looks ________ plot

(logx, y)(logx, y)

Page 55: Chapter 4: More on Two-Variable (Bivariate) Data.