210 likes | 328 Views
Lecture 6: Log transformations. January 29, 2014. Question. Assume we’ve estimated the following model Estimated Gallons/100 Miles = 1.111 + 1.21 Weight(000s) What is the estimated MPG of a vehicle weighing 6.4K lbs ? 6.7 11.3 8.9 12.2. Administrative. Exam 1:
E N D
Lecture 6: Log transformations January 29, 2014
Question Assume we’ve estimated the following model Estimated Gallons/100 Miles = 1.111 + 1.21 Weight(000s) What is the estimated MPG of a vehicle weighing 6.4K lbs? • 6.7 • 11.3 • 8.9 • 12.2
Administrative • Exam 1: • Up through chapter 22 • Quiz 2 and Homework will be graded soon • Problem Set 3 out. • Longer – start it asap. • One more Problem Set before the exam.
Last time • Transformation of data • Don’t forget to transform back to the correct units! • Today: • Log transformations • Interpreting log coefficients. • Estimating price elasticity optimal pricing
Log Transformations • Another very useful transformation: logarithms • Useful when the association between variables is more meaningful on a percentage scale. • Price Elasticity of Demand • Percentage change in quantity demanded given a 1% change in price • Key to figuring out the optimal price to charge.
Why Logs? • Often we might expect a multiplicative relationship • Think about salary and years of experience. Linear? • Maybe. But often salary growth or promotions are percentage increases. So a 3% increase is $X*1.03. • Given this, log(Salary) by years of experience makes more sense. So often we might start by transforming the variable. • When things are on a multiplicative scale, think logs.
Log Transformations Assume you’re estimating Sales Volume by Average Price Estimated Sales Volume = 190,480 – 125,190*Price r2 = 0.83 Residual Plot Fitted Line
Log Transformations If we take the log of both independent and dependent variables (called a log-log regression): Estimated ln(Sales Volume) = 11.05 – 2.442 * ln(Price) r2 = 0.955 Fitted line Residual Plot
Log Transform the Predictor: Interpreting the Intercept Assume you’re estimating $ Sales by feet of shelf space: • How would you interpret the intercept in the regression equation: • Interpretation of the slope and intercept change when the predictor (X) is on a log scale. • Bad things happen with log(0); you want log(x) = 0 • Intercept is when x = 1; • Predicting $84 of sales with 1 foot of shelf space
Log Transform the Predictor: Interpreting the Slope • Slope: still a marginal effect but slightly different • The reason it’s common to use ln instead of log10: • Let’s say we have PredictedSales(5 feet) = 84 + 139 log(5) • And increase shelf space (our X) by 1% PredictedSales(1.01 * 5 feet) = 84 + 139 log(1.01 * 5) = 84 + 139 log(5) + 139 log( 1.01) = 84 + 139 log(5) + 139 log(1.01) =PredictedSales(5 feet) + 139 log(1.01) • If we use ln instead of log10 then ln(1.01) ≈ 1% PredictedSales (1.01 * 5 feet) =PredictedSales(5 feet) + 1.39 • Or for a 1% change in feet (our X), we get $1.39 in sales (our Y)
Log Transform the Predictor: Interpreting the Slope =PredictedSales(5 feet) + 139 log(1.01) • If we use ln instead of log10 then ln(1.01) ≈ 1% PredictedSales (1.01 * 5 feet) =PredictedSales(5 feet) + 1.39 • Or for a 1% change in feet (our X), we get $1.39 in sales (our Y), 1% times the estimated slope. • When we use a log scale for the predictor, we are saying that a given percentage change in the predictor has the same impact on the response
Log Transform the Response Log Transform the Dependent Var: Log($Value) = 3.03 – 0.2 Age Intercept? • As before: Log($Value) = 3.03 – 0.2 * 0 = log($Value when Age =0) = 3.03 • Value = e3.03 = $20.7 Pay attention to units and scale! Slope? • Still a percent change but in this time for the response: • One additional year in Age will drop the value by 20%
Interpreting Logs • When we transformed the predictor, we were able to talk about %-changes in the predictor • Similarly when we transformed the response we talked about %-changes in the response. • S… when we transform both, we interpret the slope as %-change in x to a %-change in y.
Log-log regression If we’re estimating quantity demanded from price and transform both by ln • Interpret as a %change in Quantity given a %change in Price • AKA: the price elasticity of demand • Could also calculate income elasticity of demand, etc. • Hence log-log regressions often very useful because we’re often interested in quantities of the form: • This is the estimate of the slope in a log-log regression
Elasticity • Why do we care about Price Elasticity? • Lots of reasons… • Profit maximization and optimal pricing! • Let’s assume you’re not in a competitive market and need to figure out how much to charge for a good (e.g., OJ) • Unit cost to you is $1 • You can charge whatever you want (monopolist) • If you price close to $1 you’ll sell many but won’t make much per unit. If you charge more, you’ll make more but sell fewer units. • How do you price?
Optimal Pricing • To answer this we need a little more info • How sensitive to the price of OJ are the consumers? Elasticity. Estimated log Sales = 4.81 - 1.75 log Price
Optimal Pricing Estimated log Sales = 4.81 - 1.75 log Price Now what? • Check conditions, residual plots • Solve for price: • From Econ/Optimization you should have seen (hopefully?) • So we should charge? • $1 * (-1.75)/ (1 + (-1.75)) = $2.33 • How many will you sell? • Estimated log Sales = 4.81 - 1.75 log (2.33) = 3.33 • Put into correct units: e3.33 ≈ 28 cartons • How much will you make? 1.33*28 = $37.24
Example • Data: pet_food.csv • Assume you are a monopolist and had control of market prices. Also assume that all of the data in the pet_food.csv came from an experiment your company controlled. Using the information on Amount of Sales and Price charged, determine the optimal price of your company’s pet food, when the marginal cost of the pet food is $0.75 • 0.85 • 1.14 • 1.27 • 1.68 • I don’t know.
Warning:Estimating Demand (Supply) • We’re still introducing concepts so I don’t want to jump too far ahead, but… • If market prices are a function of demand and supply, we have to be a little careful. • Unless we’re willing to make certain assumptions we often run into what is called an “identification problem.” • Too many equations to estimate from the data we have • We’ll deal with this issue later (hopefully), but I want to warn you now • You can’t estimate the demand function from prices alone without knowing something about the supply function. • Estimating demand functions is a large area in applied Economics/Econometrics. Can be tricky…
Next time • Simple Regression Model • Review – the theory behind what we’ve done. • Highlight the assumptions needed for the model