Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 4: More about Relationships Between Two Variables

Similar presentations


Presentation on theme: "Chapter 4: More about Relationships Between Two Variables"— Presentation transcript:

1 Chapter 4: More about Relationships Between Two Variables

2 4.1 – Transforming to Achieve Linearity
Exponential Growth

3 Not all data can be expressed with a linear model.

4 PROBLEM! We cannot use least-squares regression for nonlinear data because least-squares regression depends upon correlation, which only measures the strength of linear relationships. SOLUTION! Transform the data into a linear set, then use the least-squares regression to determine the best fitting line for the transformed data. Finally, do a reverse transformation equation which will model our original nonlinear data.

5 Properties of Logarithms
1. log ab = log a + log b a b 2. log = log a – log b 3. log xp = p  log x Remember: log has a base of 10 and natural logs (ln) have a base of e. It doesn’t matter which one you use.

6 Linearizing Exponential Functions:
We want to write an exponential function of the form y = abx as a linear model. (where x, y are variables and a,b are constants) y = abx log y = log (abx) log y = log a + log bx log y = log a + xlog b (x, y) (x, log y)

7 CONCLUSIONS: 1. If the graph of (x, y) is exponential, then the graph of (x, log y) is linear. 2. If the graph of (x, log y) is linear, then the graph of (x, y) is exponential.

8 Example #1 Transform the exponential data to a linear model using logs and then natural logs. y = 5(2)x log y = log (5  2x) ln y = ln (5  2x) log y = log 5 + log 2x ln y = ln 5 + log 2x log y = log 5 + xlog 2 ln y = ln 5 + xln 2 log y = x ln y = x

9 Example #2 ln y = 16 + 9x e e y = e(16 + 9x) y = e(16)  e(9x)
Convert the equation back to an exponential function. ln y = x e e y = e(16 + 9x) y = e(16)  e(9x) y = e(16)  e(9)x y = 8,886,  x

10 Example #3 log y = 4 + 2x 10 10 y = 10(4 + 2x) y = 10(4)  10(2x)
Convert the equation back to an exponential function. log y = 4 + 2x y = 10(4 + 2x) y = 10(4)  10(2x) y = 10(4)  10(2)x y = 10,000  100x

11 Calculator Tip: Exponential Functions
L1: x L2: y L3: leave blank for now! L4: log y LinReg(L1, L4, Y1) - (x, log y, Y1) To prevent Overload error: convert years to a smaller number

12 Calculator Tip: Residual Plot
After calculating the line of regression: In Lists!

13 Calculator Tip: Exponential Equation
ExpReg(L1, L2, Y2) - (x, y, Y2)

14 Exponential to Linear Change:
1. The ratio of the y’s should be fairly constant 2. Graph x and y and look at the pattern 3. Calculate the transformed linear model 4. Describe the r value and the residual plot

15 1. Make a scatterplot of the data and describe the graph.
Example#4: Consider the following data representing the population for Asian and Pacific Islander. Year 1950 1960 1970 1980 1990 2000 Population (in thousands) 1131 1620 2320 3330 4770 6850 1. Make a scatterplot of the data and describe the graph.

16 D: Positive, as year increases, population increases
F: Nonlinear S: Strong

17 Year 1950 1960 1970 1980 1990 2000 Population (in thousands) 1131 1620 2320 3330 4770 6850 2. Describe the pattern of change and find the percent of change for each y (ratio of y’s). The ratios of the y’s are fairly consistent, suggesting an exponential model

18 3. Find r and describe its meaning
D: Positive S: Strong

19 4. Graph and comment on the residual plot for x and y.
Curve, not a good linear model

20 5. Take the log of the y-values and make a new scatterplot.
D: Positive D: Positive F: Nonlinear F: Linear S: Strong S: Strong

21 6. Find the least squares regression line of the transformed data.
Log(Population) = (Year)

22 r = 0.968 3. Find r and describe its meaning
7. Find the value of r and describe its meaning. r = r = 0.968 D: Positive D: Positive S: Strong S: Strong

23 Curve, not a good linear model
4. Graph and comment on the residual plot for x and y. 8. Construct the residual plot and describe its meaning. No pattern, so good linear model Curve, not a good linear model

24 9. Perform the inverse transformation to express y-hat as an exponential equation.
y = 10( x) y = 10( )  10( x) y = 10( )  10( )x y =  x

25 10. Check your work on your calculator using ExpReg.

26 11. Make a prediction for the population in 2010 using both equations.
log y = (110) y =  x log y = y =  (110) y = y = 9,

27 1. Make a scatterplot of the data and describe the graph.
Example#5: Consider the following data representing an account balance over time: x: time (months) 48 96 144 192 240 y: account balance ($) 100 161.22 259.93 419.06 675.62 1. Make a scatterplot of the data and describe the graph.

28 D: Positive, as time increases, account balance increases
F: Nonlinear S: Strong

29 x: time (months) y: account balance ($)
48 96 144 192 240 y: account balance ($) 100 161.22 259.93 419.06 675.62 2. Describe the pattern of change and find the percent of change for each y (ratio of y’s).

30 3. Find r and describe its meaning
D: Positive S: Strong

31 4. Graph and comment on the residual plot for x and y.
Curved, not good linear model

32 5. Take the natural log of the y-values and make a new scatterplot.
D: Positive D: Positive F: Nonlinear F: Linear S: Strong S: Strong

33 6. Find the least squares regression line of the transformed data.
ln(Account Balance) = (Months)

34 r = 0.9481 7. Find r and describe its meaning.
D: Positive D: Positive S: Strong S: Strong

35 Curved, not good linear model
4. Graph and comment on the residual plot for x and y. 8. Construct the residual plot and describe its meaning. No pattern, so good linear model Curved, not good linear model

36 9. Perform the inverse transformation to express y-hat as an exponential equation.
e e y = e( x) y = e( )  e ( x) y = e( )  e ( )x y =  1.01x

37 10. Check your work on your calculator using ExpReg.

38 11. Make a prediction for the account balance in 60 months using both equations.
y =  1.01x ln y = (60) y =  1.01(60) ln y = e e y = $181.67 y = $181.67

39 4.1 – Transforming to Achieve Linearity – Power Model

40 A power model is in the form y = axp
A power model is in the form y = axp. To transform this equation into a linear model you must apply the log transformation to both variables x and y. y = axp log y = log (axp) log y = log a + log xp log y = log a + plog x How is this different than exponential functions? You have to take the log of both x and y to make a linear model.

41 Example #6 y = 4x5 y = 4x5 log y = log (4x5) ln y = ln (4x5)
Find the LSRL by taking the logs and then the natural logs. y = 4x5 y = 4x5 log y = log (4x5) ln y = ln (4x5) log y = log 4 + log x5 ln y = ln 4 + ln x5 log y = log 4 + 5log x ln y = ln 4 + 5ln x log y = log x ln y = ln x

42 e e y = e(-5 + 9lnx) y = e(-5)  e(9lnx) y = e(-5)  e(lnx)9
Example #7 Convert the equation back to a power equation. ln y = ln x e e y = e(-5 + 9lnx) y = e(-5)  e(9lnx) y = e(-5)  e(lnx)9 y = x9

43 10 10 y = 10(0.5 + 2logx) y = 10(0.5)  10(2logx)
Example #8 Convert the equation back to a power equation. log y = log x y = 10( logx) y = 10(0.5)  10(2logx) y = 10(0.5)  10(logx)2 y = x2

44 Calculator Tip: Power Functions
L1: x L2: y L3: log x L4: log y LinReg(L3, L4, Y1) - (log x, log y, Y1)

45 Calculator Tip: Power Equation
PwrReg(L1, L2, Y2) - (x, y, Y2)

46 1. Make a scatterplot of the data and describe the graph.
Example #9 The distances from our sun and the periods of the 9 planets in the solar system are given below. Distance (astronomical units) .39 .72 1 1.5 5.2 9.5 19 30 40 Period (earth years) .24 .62 1.9 12 29 84 160 250 1. Make a scatterplot of the data and describe the graph.

47 D: Positive, as distance increases, period increases
F: Nonlinear S: Strong

48 Distance (astronomical units)
.39 .72 1 1.5 5.2 9.5 19 30 40 Period (earth years) .24 .62 1.9 12 29 84 160 250 2. Describe the pattern of change and find the percent of change for each y (ratio of y’s). Ratio of y’s are not similar, perhaps not exponential

49 3. Find r and describe its meaning
D: Positive S: Strong

50 4. Graph an exponential model and discuss if it is appropriate to use this model.
Curved, not good linear model

51 1. Make a scatterplot of the data and describe the graph.
5. Transform the data to a linear model by taking the log of the x’s and the y’s. Make a sketch of the new scatterplot. 1. Make a scatterplot of the data and describe the graph. D: Positive D: Positive F: Nonlinear F: Linear S: Strong S: Strong

52 6. Find the least squares regression line of the transformed data.
log(Period) = log(Distance)

53 r = 0.9779 3. Find r and describe its meaning
7. Find the value of r and describe its meaning. r = r = D: Positive D: Positive S: Strong S: Strong

54 No pattern, so good linear model
8. Construct the residual plot and describe its meaning. No pattern, so good linear model

55 10 10 y = 10(0.002916+ 1.49627logx) y = 10(0.002916)  10(1.49627logx)
9. Perform the inverse transformation to express y-hat as an exponential equation. y = 10( logx) y = 10( )  10( logx) y = 10( )  10(logx) y = x

56 10. Check your work on your calculator using PwrReg.

57 11. If a planet were discovered 35 astronomical units from our sun, predict its period using both equations. y = x y = (35) y =

58 1. Graph the original data. Do you see a curve?
How do you determine if the model is exponential or power? 1. Graph the original data. Do you see a curve? 2. Look for the ratio of the y values to see if maybe exponential 3. Take the logs of both x and y. Then graph (x, log y) and (log x, log y). Which graph looks more linear? 4. Use the r value and the residual plot to determine the strength of the linear relationship.

59 Example #10 An experiment was conducted to determine the effect of practice time (in seconds) on the percent of unfamiliar words recalled. Here is a Fathom scatterplot of the results with a least-squares regression line superimposed. (a) Sketch a residual plot below.

60 (b) Does a linear model fit the data well? Justify your answer.
No, the residual plot has a curve in it, so it isn’t linear

61 We used Fathom to transform the original data in hopes of achieving linearity. The screen shots below show the results of two different transformations. (c) Would an exponential model or a power model fit the original data better? Justify your answer. Power, Stronger r value and residual plot is not as curved

62 (d) Use the model you chose in (c) to predict word recall for 25 seconds of practice. Show your method. e e

63 Example #11 Foresters are interested in predicting the amount of usable lumber they can harvest from various tree species. The following data have been collected on the diameter of Ponderosa pine trees, measured at chest height, and the yield in board feet. Note that a board foot is defined as a piece of lumber 12 inches by 12 inches by 1 inch. Determine if an exponential or power model would make a better model. Support your reasoning. Using the model you have chosen, predict the yield in board feet from a diameter of 40.

64 yes 1. Graph the original data. Do you see a curve? Diameter Bd Feet
36 192 28 113 88 41 294 19 32 123 22 51 38 252 25 56 17 16 31 141 20 86 21 39 231 33 187 37 205 23 57 265 1. Graph the original data. Do you see a curve? yes

65 no 2. Look for the ratio of the y values to see if maybe exponential
Diameter Bd Feet 36 192 28 113 88 41 294 19 32 123 22 51 38 252 25 56 17 16 31 141 20 86 21 39 231 33 187 37 205 23 57 265 2. Look for the ratio of the y values to see if maybe exponential no

66 3. Take the logs of both x and y
3. Take the logs of both x and y. Then graph (x, log y) and (log x, log y). Which graph looks more linear? Power is more linear

67 4. Use the r value and the residual plot to determine the strength of the linear relationship.
Power has a stronger r value and doesn’t have a curve in the residual plot, therefore, it is a power model.

68 Using the model you have chosen, predict the yield in board feet from a diameter of 40.

69 4.2 – Relationship between Categorical Variables

70

71 Because we cannot perform direct calculation on categorical data, we use the counts or percents of individuals by category. Two-Way Table: Classifies categorical data according to two variables. Marginal Distribution: The total of each margin, column and row. Conditional Distribution: Distribution of one variable for given categories of another variable.

72 Segmented bar graph: Adds up conditional probabilities to 100% based on categories The following segmented bar graph represents the conditional distributions of living arrangements for each race category:

73 Example #12 In a national survey of adult Americans in 1998, people were asked to indicate their age and to classify their interest in politics as very much, somewhat, or not much. The ages were grouped in ranges. 18-35 36-55 56-94 Not Much 146 89 Somewhat 192 260 154 Very Much 47 125 106 381 606 278 385 531 349 1265 Calculate the row and column totals.

74 18-35 36-55 56-94 Not Much 146 89 Somewhat 192 260 154 Very Much 47 125 106 381 606 278 385 531 349 1265 b. What proportion of the survey respondents were between ages 18 and 35? = 0.3043

75 18-35 36-55 56-94 Not Much 146 89 Somewhat 192 260 154 Very Much 47 125 106 381 606 278 385 531 349 1265 c. What proportion of the survey respondents were between 36 and 55? =

76 18-35 36-55 56-94 Not Much 146 89 Somewhat 192 260 154 Very Much 47 125 106 381 606 278 385 531 349 1265 d. What proportion of the survey respondents were between 56 and 94? =

77 18-35 36-55 56-94 Not Much 146 89 Somewhat 192 260 154 Very Much 47 125 106 381 606 278 385 531 349 1265 e. Restrict your attention (for the moment) to just the respondents under 35 years of age. What proportion of these young respondents classify themselves as having not much interest in politics? = 0.3792

78 18-35 36-55 56-94 Not Much 146 89 Somewhat 192 260 154 Very Much 47 125 106 381 606 278 385 531 349 1265 f. What proportion of the young respondents classify themselves as somewhat interested in politics? = 0.4987

79 18-35 36-55 56-94 Not Much 146 89 Somewhat 192 260 154 Very Much 47 125 106 381 606 278 385 531 349 1265 g. What proportion of the young respondents classify themselves as having very much interest in politics? = 0.1221

80 18-35 36-55 56-94 Not Much .2749 .2550 Somewhat Very Much Total 1.000
h. Record the conditional distribution that you have just calculated in the table below. 18-35 36-55 56-94 Not Much .2749 .2550 Somewhat Very Much Total 1.000 0.3792 0.4987 0.4896 0.4413 0.1221 0.2354 0.3037

81 i. Construct a segmented bar graph

82 Example #13 The University of CA at Berkeley was charged with having discriminated against women in their graduate admissions process for the fall quarter of The table below identifies the number of acceptances and denials for both men and women applicants in each of the six largest graduate programs at the institution at that time. Men Accepted Men Denied Women Accepted Women denied Program A 511 314 89 19 Program B 352 208 17 8 Program C 120 205 202 391 Program D 137 270 132 243 Program E 53 138 95 298 Program F 22 351 24 317 total 1195 1486 559 1276

83 1195 1486 2681 559 1276 1835 1754 2762 4516 Accepted Denied Total Men
Start by ignoring the program distinction, collapsing the data into a two-way table of gender by admissions status. To do this, find the total number of men accepted and denied and the total number of women accepted and denied. Fill in the table below: Accepted Denied Total Men Women 1195 1486 2681 559 1276 1835 1754 2762 4516

84 b. Consider for the moment just the men applicants
b. Consider for the moment just the men applicants. Of the men who applied to one of these programs, what proportion were accepted? Now consider the women applicants; what proportion of them were accepted? Do these proportions seem to support the claim that men were given preferential treatment in admissions decisions? MEN WOMEN = = 0.4457 0.3046

85 Proportion of men Accepted Proportion of women Accepted
c. To try to isolate the program responsible for the alleged mistreatment of women applicants, calculate the proportion of men and the proportion of women within each program who were accepted. Record your results in the table below: Proportion of men Accepted Proportion of women Accepted Program A Program B Program C Program D Program E Program F 511/1195 = 89/559 = 352/1195 = 17/559 = 120/1195 = 202/559 = 137/1195 = 132/559 = 53/1195 = 95/559 = 22/1195 = 24/559 =

86 Yes, program A and program B accepted less women than men.
d. Does it seem as if any program is responsible for the large discrepancy between women in the overall proportions admitted? Yes, program A and program B accepted less women than men.

87 = = 0.90 0.80 Survived Died Total Hospital A 800 200 1000 Hospital B
Example #14: The following two-way table classifies hypothetical hospital patients according to the hospital that treated them and whether they survived or died: Survived Died Total Hospital A 800 200 1000 Hospital B 900 100 Calculate the proportion of hospital A’s patients who survived and the proportion of hospital B’s patients who survived. Which hospital saved the higher percentage of its patients? Hospital A Hospital B = = 0.80 0.90

88 Suppose that when we further categorize each patient according to whether they were in fair condition or poor condition prior to treatment we obtain the following two-way table: FAIR CONDITION Survived Died Total Hospital A 590 10 600 Hospital B 870 30 900 POOR CONDITION Survived Died Total Hospital A 210 190 400 Hospital B 30 70 100

89 = = 0.9667 0.9833 FAIR CONDITION Survived Died Total Hospital A 590 10
600 Hospital B 870 30 900 POOR CONDITION Survived Died Total Hospital A 210 190 400 Hospital B 30 70 100 b. Among those who were in fair condition, compare the recovery rates for the two hospitals. Which hospital saved the greater percentage of its patients who had been in fair condition? Hospital A Hospital B = = 0.9833 0.9667

90 = = 0.3 0.525 FAIR CONDITION Survived Died Total Hospital A 590 10 600
Hospital B 870 30 900 POOR CONDITION Survived Died Total Hospital A 210 190 400 Hospital B 30 70 100 c. Among those who were in poor condition, compare the recovery rates for the two hospitals. Which hospital saved the greater percentage of its patients who had been in poor condition? Hospital A Hospital B = = 0.525 0.3

91 Simpson’s Paradox: When you combine data sometimes it reverses the direction of the relationship in the individual pieces.

92 d. Write a few sentences explaining (arguing from the given data given) how it happens that hospital B has the higher recovery rate overall, yet hospital A has the higher recovery rate for each type of patient. e. Which hospital would you rather go to if you were ill? Explain.

93 4.3 – Establishing Causation

94 The only time you can determine causation is when you conduct an experiment.
What if you can’t do an experiment? Look for a strong, consistent association The increase in the explanatory variable leads to a stronger increase in response The cause is plausible

95 x causes y

96 Seems x causes y, but z has an effect on x and y,
“Z is common to both” Seems x causes y, but z has an effect on x and y, making it look like x causes y

97 Seems x causes y, but z also has an effect on y,
making it look like x causes y

98 Example #15 A soccer coach wanted to improve the team's playing ability, so he had them run two miles a day. At the same time the players decided to take vitamins. In two weeks the team was playing noticeably better, but the coach and players did not know whether it was from the running or the vitamins. What type of variable is this? Confounding. Running Improve teams ability vitamins

99 Example #16 An article that appeared in the San Luis Obispo Tribune (November 11, 1999) was titled “Study Points Out Dangerous Side to SUV Popularity: Half of All 1996 Ejection Deaths Occur in SUVs.” This article states that SUV’s have a much higher rate of passengers being thrown from a window during an accident than do automobiles. The article also states that more than half of all deaths caused by ejection involved SUVs – the basis for the conclusion that SUVs are more dangerous than cars. Later in the article, there is a comment that about 98% of those injured or killed in ejection accidents were not wearing seat belts. Comment on the conclusion that SUVs are more dangerous than cars. Confounding variable

100 SUV Roll over Seat belts

101 Example #17 A study showed that households with more TV sets tend to have longer life expectancies. Describe a possible common response relationship. More TVs Longer life expectancy More $ COMMON RESPONSE!

102 Example #18 Based on a survey conducted on the DietSmart.com website, investigators concluded that women who regularly watched Oprah were only one-seventh as likely to crave fattening foods as those who watched other daytime talk shows. Is it reasonable to conclude that watching Oprah causes a decrease in cravings for fattening foods? Explain. NO, Not an experiment!


Download ppt "Chapter 4: More about Relationships Between Two Variables"

Similar presentations


Ads by Google