1 / 24

Stat 112 Notes 11

Stat 112 Notes 11. Today: Fitting Curvilinear Relationships (Chapter 5) Homework 3 due Friday. I will e-mail Homework 4 tonight, but it will not be due for two weeks (October 26 th ). Curvilinear Relationships . Relationship between Y and X is curvilinear if E(Y|X) is not a straight line.

hea
Télécharger la présentation

Stat 112 Notes 11

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Stat 112 Notes 11 • Today: • Fitting Curvilinear Relationships (Chapter 5) • Homework 3 due Friday. • I will e-mail Homework 4 tonight, but it will not be due for two weeks (October 26th).

  2. Curvilinear Relationships • Relationship between Y and X is curvilinear if E(Y|X) is not a straight line. • Linearity for simple linear regression model is violated for a curvilinear relationship. • Approaches to estimating E(Y|X) for a curvilinear relationship • Polynomial Regression • Transformations

  3. Transformations • Curvilinear relationship: E(Y|X) is not a straight line. • Another approach to fitting curvilinear relationships is to transform Y or x. • Transformations: Perhaps E(f(Y)|g(X)) is a straight line, where f(Y) and g(X) are transformations of Y and X, and a simple linear regression model holds for the response variable f(Y) and explanatory variable g(X).

  4. Curvilinear Relationship Y=Life Expectancy in 1999 X=Per Capita GDP (in US Dollars) in 1999 Data in gdplife.JMP Linearity assumption of simple linear regression is clearly violated. The increase in mean life expectancy for each additional dollar of GDP is less for large GDPs than Small GDPs. Decreasing returns to increases in GDP.

  5. The mean of Life Expectancy | Log Per Capita appears to be approximately a straight line.

  6. How do we use the transformation? • Testing for association between Y and X: If the simple linear regression model holds for f(Y) and g(X), then Y and X are associated if and only if the slope in the regression of f(Y) and g(X) does not equal zero. P-value for test that slope is zero is <.0001: Strong evidence that per capita GDP and life expectancy are associated. • Prediction and mean response: What would you predict the life expectancy to be for a country with a per capita GDP of $20,000?

  7. How do we choose a transformation? • Tukey’s Bulging Rule. • See Handout. • Match curvature in data to the shape of one of the curves drawn in the four quadrants of the figure in the handout. Then use the associated transformations, selecting one for either X, Y or both.

  8. Transformations in JMP • Use Tukey’s Bulging rule (see handout) to determine transformations which might help. • After Fit Y by X, click red triangle next to Bivariate Fit and click Fit Special. Experiment with transformations suggested by Tukey’s Bulging rule. • Make residual plots of the residuals for transformed model vs. the original X by clicking red triangle next to Transformed Fit to … and clicking plot residuals. Choose transformations which make the residual plot have no pattern in the mean of the residuals vs. X. • Compare different transformations by looking for transformation with smallest root mean square error on original y-scale. If using a transformation that involves transforming y, look at root mean square error for fit measured on original scale.

  9. ` By looking at the root mean square error on the original y-scale, we see that all of the transformations improve upon the untransformed model and that the transformation to log x is by far the best.

  10. The transformation to Log X appears to have mostly removed a trend in the mean of the residuals. This means that . There is still a problem of nonconstant variance.

  11. Comparing models for curvilinear relationships • In comparing two transformations, use transformation with lower RMSE, using the fit measured on the original scale if y was transformed on the original y-scale • In comparing transformations to polynomial regression models, compare RMSE of best transformation to best polynomial regression model (selected using the criterion from Note 10). • If the transfomation’s RMSE is close to (e.g., within 1%) but not as small as the polynomial regression’s, it is still reasonable to use the transformation on the grounds of parsimony.

  12. Transformations and Polynomial Regression for Display.JMP Fourth order polynomial is the best polynomial regression model using the criterion on slide 10 Fourth order polynomial is the best model – it has the smallest RMSE by a considerable amount (more than 1% advantage over best transformation of 1/x.

  13. Interpreting the Coefficient on Log X

  14. Log Transformation of Both X and Y variables • It is sometimes useful to transform both the X and Y variables. • A particularly common transformation is to transform X to log(X) and Y to log(Y)

  15. Heart Disease-Wine Consumption Data (heartwine.JMP)

  16. Evaluating Transformed Y Variable Models The log-log transformation provides slightly better predictions than the simple linear regression Model.

  17. Interpreting Coefficients in Log-Log Models

  18. Another interpretation of coefficients in log-log models

  19. Another Example of Transformations: Y=Count of tree seeds, X= weight of tree

  20. By looking at the root mean square error on the original y-scale, we see that Both of the transformations improve upon the untransformed model and that the transformation to log y and log x is by far the best.

  21. Comparison of Transformations to Polynomials for Tree Data

  22. Prediction using the log y/log x transformation • What is the predicted seed count of a tree that weights 50 mg? • Math trick: exp{log(y)}=y (Remember by log, we always mean the natural log, ln), i.e.,

More Related