r03 regression using logarithms
play

R03 - Regression: using logarithms STAT 587 (Engineering) Iowa - PowerPoint PPT Presentation

R03 - Regression: using logarithms STAT 587 (Engineering) Iowa State University October 24, 2020 Logarithms Parameter intrepretation Parameter interpretation in regression If E [ Y | X ] = 0 + 1 X, then 0 is the expected response


  1. R03 - Regression: using logarithms STAT 587 (Engineering) Iowa State University October 24, 2020

  2. Logarithms Parameter intrepretation Parameter interpretation in regression If E [ Y | X ] = β 0 + β 1 X, then β 0 is the expected response when X is zero and dβ 1 is the expected change in the response for a d unit change in the explanatory variable. For the following discussion, Y is always going to be the original response and X is always going to be the original explanatory variable.

  3. Logarithms Corn yield example Corn yield example Suppose Y is corn yield (bushels/acre) X is fertilizer level in lbs/acre Then, if E [ Y | X ] = β 0 + β 1 X β 0 is the expected corn yield (bushels/acre) when fertilizer level is zero and dβ 1 is the expected change in corn yield (bushels/acre) when fertilizer is increased by d lbs/acre.

  4. Logarithms Regression with logarithms Regression with logarithms Regression models using logarithms y,x log(y),x 1.0 0.5 2 0.0 1 −0.5 Expected response −1.0 slope 0.5 1.0 1.5 2.0 0.5 1.0 1.5 2.0 negative y,log(x) log(y),log(x) positive 2 20 0 10 −2 0 0.5 1.0 1.5 2.0 0.5 1.0 1.5 2.0 Explanatory variable

  5. Logarithms Response is logged Response is logged If E [log( Y ) | X ] = β 0 + β 1 X, then we have Median [ Y | X ] = e β 0 + β 1 X = e β 0 e β 1 X then e β 0 is the median of Y when X is zero e dβ 1 is the multiplicative change in the median of Y for a d unit change in the explanatory variable.

  6. Logarithms Response is logged Response is logged Let be Y is corn yield (bushels/acre) and X is fertilizer level in lbs/acre. If we assume E [log( Y ) | X ] = β 0 + β 1 X then Median [ Y | X ] = e β 0 e β 1 X e β 0 is the median corn yield (bushels/acre) when fertilizer level is 0 and e dβ 1 is the multiplicative change in median corn yield (bushels/acre) when fertilizer is increased by d lbs/acre.

  7. Logarithms Response is logged Response is logged negative slope positive slope 2 Response Median 1 0 0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 Explanatory variable

  8. Logarithms Explanatory variable is logged Explanatory variable is logged If E [ Y | X ] = β 0 + β 1 log( X ) , then, β 0 is the expected response when X is 1 and β 1 log( d ) is the expected change in the response when X increases multiplicatively by d ,e.g. β 1 log(2) is the expected change in the response for each doubling of X or β 1 log(10) is the expected change in the response for each ten-fold increase in X .

  9. Logarithms Explanatory variable is logged Explanatory variable is logged Suppose Y is corn yield (bushels/acre) X is fertilizer level in lbs/acre If E [ Y | X ] = β 0 + β 1 log( X ) then β 0 is the expected corn yield (bushels/acre) when fertilizer amount is 1 lb/acre and β 1 log(2) is the expected change in corn yield when fertilizer amount is doubled.

  10. Logarithms Explanatory variable is logged Explanatory variable is logged negative slope positive slope 1 Expected response 0 −1 0.5 1.0 1.5 2.0 0.5 1.0 1.5 2.0 Explanatory variable

  11. Logarithms Both response and explanatory variable are logged Both response and explanatory variable are logged If E [log( Y ) | X ] = β 0 + β 1 log( X ) , then Median [ Y | X ] = e β 0 X β 1 , and thus e β 0 is the median of Y when X is 1 and d β 1 is the multiplicative change in the median of the response when X increases multiplicatively by d , e.g. 2 β 1 is the multiplicative change in the median of the response for each doubling of X or 10 β 1 is the multiplicative change in the median of the response for each ten-fold increase in X .

  12. Logarithms Both response and explanatory variable are logged Both response and explanatory variables are logged Suppose Y is corn yield (bushels/acre) X is fertilizer level in lbs/acre If Median [ Y | X ] = e β 0 e β 1 log( X ) = e β 0 X β 1 , E [log( Y ) | X ] = β 0 + β 1 log( X ) or then e β 0 is the median corn yield (bushels/acre) at 1 lb/acre of fertilizer and 2 β 1 is the multiplicative change in median corn yield (bushels/acre) when fertilizer is doubled.

  13. Logarithms Both response and explanatory variable are logged Both response and explanatory variables are logged negative slope positive slope 3 Response Median 2 1 1.2 1.6 2.0 1.2 1.6 2.0 Explanatory variable

  14. Logarithms Both response and explanatory variable are logged Why use logarithms The most common transformation of either the response or explanatory variable(s) is to take logarithms because linearity will often then be approximately true, the variance will likely be approximately constant, influence of some observations may decrease, and there is a (relatively) convenient interpretation.

  15. Logarithms Both response and explanatory variable are logged Summary of interpretations when using logarithms When using the log of the response, β 0 determines the median response β 1 determines the multiplicative change in the median response When using the log of the explanatory variable ( X ), β 0 determines the response when X = 1 β 1 determines the change in the response when there is a multiplicative increase in X

  16. Logarithms Constructing credible intervals Constructing credible intervals Recall the model ind ∼ N ( β 0 + β 1 X i , σ 2 ) . Y i Let ( L, U ) be a 100(1 − a ) % credible interval for β . For ease of interpretation, it is often convenient to calculate functions of β , e.g. f ( β ) = e β . f ( β ) = dβ and A 100(1 − a ) % credible interval for f ( β ) (when f is monotonic) is ( f ( L ) , f ( U )) .

  17. Logarithms Breakdown times example Breakdown times In an industrial laboratory, under uniform conditions, batches of elec- trical insulating fluid were subjected to constant voltages (kV) until the insulating property of the fluids broke down. Seven different volt- age levels were studied and the measured responses were the times (minutes) until breakdown. summary(Sleuth3::case0802) Time Voltage Group Min. : 0.090 Min. :26.00 Group1: 3 1st Qu.: 1.617 1st Qu.:31.50 Group2: 5 Median : 6.925 Median :34.00 Group3:11 Mean : 98.558 Mean :33.13 Group4:15 3rd Qu.: 38.383 3rd Qu.:36.00 Group5:19 Max. :2323.700 Max. :38.00 Group6:15 Group7: 8

  18. Logarithms Breakdown times example Insulating fluid breakdown Insulating fluid breakdown 2000 Time until breakdown (min) 1500 1000 500 0 30 35 Voltage (kV)

  19. Logarithms Breakdown times example Insulating fluid breakdown Insulating fluid breakdown 2000 Time until breakdown (min) 1500 1000 500 0 30 35 Voltage (kV)

  20. Logarithms Breakdown times example Run the regression and look at diagnostics Residual Plot Q−Q Plot Sample Quantiles 1500 1500 Residuals 1000 1000 500 500 0 0 −500 −500 0 200 400 −800 −400 0 400 800 Predicted Values Theoretical Quantiles COOK's D Plot Index Plot 1500 1.5 COOK's D Residuals 1000 1.0 500 0.5 0 0.0 −500 0 20 40 60 0 20 40 60 Observation Observation Number

  21. Logarithms Breakdown times example Logarithm of time (response) Insulating fluid breakdown 1,000.00 Time until breakdown (min) 100.00 10.00 1.00 0.10 30 35 Voltage (kV)

  22. Logarithms Breakdown times example Logarithm of time (response): residuals Residual Plot Q−Q Plot 4 2 Sample Quantiles 2 Residuals 0 0 −2 −2 −4 −4 0 2 4 6 −4 −2 0 2 4 Predicted Values Theoretical Quantiles COOK's D Plot Index Plot 0.3 2 COOK's D Residuals 0.2 0 0.1 −2 0.0 −4 0 20 40 60 0 20 40 60 Observation Observation Number

  23. Logarithms Breakdown times example Summary m <- lm(log(Time) ~ I(Voltage-30), Sleuth3::case0802) exp(m$coefficients) (Intercept) I(Voltage - 30) 41.86752 0.60208 exp(confint(m)) 2.5 % 97.5 % (Intercept) 25.2582342 69.3987157 I(Voltage - 30) 0.5370152 0.6750281 At 30 kV, the median breakdown time is estimated to be 42 minutes with a 95% credible interval of (25, 69). Each 1 kV increase in voltage was associated with a 40% (32%, 46%) reduction in median breakdown time.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend