150 likes | 324 Views
Chapter 4 More About Relationships Between Two Variables. 4.1 Transforming to Achieve Linearity 4.2 Relationship Between Categorical Variables 4.3 Establishing Causation. How do you determine if data is linear?. Look at the graph (is it straight?) Look at the residual plot (is it scattered?)
E N D
Chapter 4More About Relationships Between Two Variables 4.1 Transforming to Achieve Linearity 4.2 Relationship Between Categorical Variables 4.3 Establishing Causation
How do you determine if data is linear? • Look at the graph (is it straight?) • Look at the residual plot (is it scattered?) • Look at the correlation coefficient, r (is it close to -1 or 1?) If the answer to any of these questions is no, then a line is probably not a good fit and a curved function may be more appropriate.
Curved Functions Tested in AP Stats Exponential Regression • (x, log y) is linear • Linear Regression on (x, log y) is • Algebraically solve for Power Regression • (log x, log y) is linear • Linear Regression on (log x, log y) is • Algebraically solve for
What if the data is not linear? • Transform the data to determine whether Exponential or Power Regression is appropriate. • Run a Linear Regression on the transformed data. • Perform an inverse transformation to turn the equation into Exponential or Power.
Transform the Data to Determine if Exponential or Power Regression is Appropriate • Enter data into L1 and L2. • See that it is not linear. (scatterplot is curved, residual is curved) • Transform the data into logarithms. • Enter L3 = log x and L4 = log y. • Look at (x, log y) and (log x, log y) for linearity. • If (x, log y) is linear, use exponential regression. • If (log x, log y) is linear, use power regression.
Run a Linear Regression on the Transformed Data Exponential • Run Linear Regression on (x, log y) 4:LinReg L1,L4 • Write as • Define your variables as they were originally (x = ?, = predicted ?) Power • Run Linear Regression on (log x, log y) 4:LinReg L3,L4 • Write as • Define your variables as they were originally (x = ?, = predicted ?)
Perform an Inverse Transformation to Turn the Equation into Exponential or Power Exponential Example Power Example
Non-Linear Regression in the Calculator • Enter data into L1 and L2. • See that it is not linear. (scatterplot is curved, residual is curved) • Run 0:ExpReg L1, L2, Y1 • Run A:PwrReg L1, L2, Y1 • See which fits the data better • Look at the graph and see which curve follows the data better. • Look at r and r2 to see which line (x, log y) or (log x, log y) fits the data better. • Write out the equation from the calculator (NO LOGS) and define x = ? and = predicted ?
By Hand vs. The Calculatorx = L1, y = L2, log x = L3, log y = L4 LinReg L1, L4 = ExpReg L1, L2 LinReg L3, L4 = PwrReg L1, L2
Categorical Data in Two Way Tables Marginal Distribution: the distribution of only one of the variables. Find the marginal distribution of ice cream flavors.
Categorical Data in Two Way Tables Conditional Distribution: the distribution of one variable given a specific condition of the other variable. Find the conditional distribution of grade level among those who prefer chocolate.
What percent of students like strawberry? • What percent of seniors like vanilla? • What percent of chocolate lovers are juniors? • What percent of students are freshmen? • What percent of students are vanilla loving seniors? • What percent of upper classmen like chocolate?
Simpson’s Paradox Suppose two people, Lisa and Bart, are editors for the St. Louis Post Dispatch. Answer the following questions given the data below: What percentage of articles did Lisa edit in Week 1? _________ Bart? _________ Who edited a higher percentage of articles in Week 1? ______________________ What percentage of articles did Lisa edit in Week 2? _________ Bart? _________ Who edited a higher percentage of articles in Week 2? ______________________ What percentage of articles did Lisa edit Total? _________ Bart? _________ Who edited a higher percentage of articles in Total? ______________________
HOW CAN THIS BE?? In the first week, Lisa improves 60 percent of the articles she edits while Bart improves 90 percent of the articles he edits. In the second week, Lisa improves just 10 percent of the articles she edits, while Bart improves 30 percent. Both times, Bart improved a much higher percentage of articles than Lisa—yet when the two tests are combined, Lisa has improved a much higher percentage than Bart!