Download presentation
Presentation is loading. Please wait.
Published byArnold Shepherd Modified over 8 years ago
1
Chapter 4 More on Two-Variable Data
2
Four Corners Play a game of four corners, selecting the corner each time by rolling a die Collect the data in a table listing the trial number and the number of people remaining in the game
3
Four Corners Trial number Students remaining
4
The Spread of Cancer Time (years) Number of cancer cells 0 5 10 15 20 50 40 30 20 10 0 Page 194 in textbook
5
Sect 4.1 Transforming Relationships
6
Example 4.1 on page 195 The least squares regression line is not a good fit If we remove the elephant we dramatically drop our correlation coefficient (r= 0.86 becomes r=0.50)
7
Previous example with elephant removed We see a different trend The data curves to the right (is not linear)
8
Take the logarithm of both variables and the data becomes very linear The vertical spread about the LSRL is similar everywhere, so predictions of brain weight from body weight will be equally precise for any body weight (in the log scale)
9
Why transform? We need to have the data in a linear form so that we can find the LSRL and the r value When we have data that is not linear we must transform it so that it is as close to linear as possible Linear transformations cannot straighten a curved relationship between two variables ◦ Can change linear model kilometers to miles ◦ Can change linear model inches to feet
10
Applying a function such as a logarithm or square root to a quantitative transforming variable is called transforming or re- expressing the data Understanding how simple functions work helps us to choose and use transformations
11
First steps in transforming Transforming data amounts to changing the scale of measurement that was used when the data was collected Linear transformations cannot straighten a curved relationship between two variables To do that we resort to functions that are not linear Ex: logarithms, powers (+/-)
12
Monotonic Functions The different types of transformations (linear, +/- powers, and logarithms) are all monotonic A monotonic function f(t) moves in one direction as its argument t increases
13
Increasing/Decreasing Monotonic Functions A monotonic increasing function preserves the order of data If a>b, then f(a)>f(b) Its graph is increasing everywhere A monotonic decreasing function reverses the order of data If a>b, then f(a)<f(b) Its graph is decreasing everywhere Linear: a + bt (with slope +) Exponential (base >1) Log function Linear: a + bt (with slope -) Exponential (base <1) 1/t (for positive t)
14
A function can be monotonic over some range of t without being everywhere monotonic Ex: the square function t 2 is monotonic increasing for If the range of t includes both positive and negative values, the square is not monotonic It decreases as t increases for negative values of t and increases as t increases for positive values
15
Monotonic increasing Monotonic decreasing
16
Many variables take only 0 or positive values, so we are particularly interested in how functions behave for positive values of t
17
Linear vs. Exponential Growth Linear growth increases by a fixed amount in each equal time period adds a fixed increment in each equal time period Exponential growth increases by a fixed percentage of the previous total multiplied by a fixed number in each time period
18
To grasp the idea of multiplicative growth, consider a population of bacteria in which each bacterium splits into two each hour After one day there are 2 24 bacteria Rapid increase after a slow start
20
Exponential growth model y = a * b x a and b are constants Pattern follows a smooth curve
21
Nonlinear monotonic transformations Change data enough to alter the shape of distributions and the form of relations between two variables Are simple enough to preserve order and allow recovery of the original data
22
Strategy for transforming data: If the variable to be transformed takes values that are 0 or negative, first apply a linear transformation to make the values all positive Often we just add a constant to all the observations Then, choose a power or logarithmic transformation that simplifies the data Ex: one that approximately straightens a scatterplot
23
The logarithm transformation
24
Review of logarithms log b x = y remember: b y = x log (AB) = log A + log B log (A/B) = log A – log B log X p = p log X
25
Is the picture for cell phone growth (on page 205) exponential? We need an accurate way to check whether growth is exponential Can’t just “eye it”
26
Steps for the logarithm transformation First calculate the ratio of consecutive terms Don’t need to be exactly the same, but should be approximately the same Then apply a mathematical transformation that changes exponential growth into linear growth And patterns of growth that are not exponential into something other than linear
28
If we assume that it is exponential, then if we take the log of both sides we should get a straight line for our transformed data Remember, the exponential and logarithmic functions are inverses
29
Transforming cell phone growth
30
Transforming cell phone growth (continued) Log a and log b are constants, so the right side of the equation looks like the form for a straight line Plot the points in the form (x, log y) Table was shown previously Picture is on page 207 (next slide)
31
Plot appears slightly concave down, but more linear than original data
32
Compute LSRL to see results (careful what lists/data you use) Log y = -263 + 0.134 x
33
Transforming cell phone growth (continued) r 2 is 0.982, so 98.2% of the variation in log y is explained by the least squares regression of log y on x Need to look at residual plot (next slide)
35
Ideally, should show random scatter about y = 0 reference line Curved pattern shows us that some improvement is still possible For now, we will accept the exponential model on the basis of the high r 2 value
36
Prediction in the exponential growth model Regression is often used for prediction In the case of exponential growth, the logarithms rather than the actual responses follow a linear pattern To do prediction, we need to “undo” the logarithm transformation to return to the original units of measurement The same idea works for any monotonic transformation There is always exactly one original value behind any transformed value, so we can always go back to our original scale
37
Making the best prediction… If you look at the residual plot on page 208, the last four points look very linear To try to predict the number of subscribers in 2000 we could discard the first four points because they are the oldest and furthest removed from 2000 This gives us a new LSRL: log NewY = -189 + 0.0970 NewX
39
Section 4.1 cont.
40
Power law models y = a x p, where a and p are numbers Power law models become linear when we apply the logarithm transformation to both variables Powers greater than 1 give graphs that bend upward. The sharpness of the bend increases as the power increases. Powers less than 1 but greater than 0 give graphs that bend downward. Powers less than 0 give graphs that decrease as x increases. Greater negative values of p result in graphs that decrease more quickly.
42
y = a x p log y = log a + p log x Taking the logarithm of both variables straightens the scatterplot of y against x The power p in the power law becomes the slope of the straight line that links log y to log x
43
Prediction in power law models If taking the logarithm of both variables makes a scatterplot linear, a power law is a reasonable model for the original data The slope is only an estimate of the p in an underlying power model The greater the scatter of the points in the scatterplot about the fitted line, the smaller our confidence that this estimate is accurate
44
Example 4.9 page 216
48
Don’t forget to perform an inverse transformation:
50
Power law modeling with the graphing calculator Enter data into L1 and L2 Show scatterplot L3 = log L1 L4 = log L2 Graph L3 and L4 with each other Verify it is linear Find LSRL for L3/L4 Check r 2 value Graph residuals Look for random scatter Transform back to power model Make prediction
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.