2-06 Non-Linear Models - Logged Variables and Standardized Coefficients
2-06 Non-Linear Models - Logged Variables and Standardized Coefficients
Feb 6
Topic for today
Logged variables and standardized coefficients
What we did last class
1. How do we estimate non-linear relationships between X and
Y?
2. How does the interpretation of coefficients change with non-
linear estimation?
3. How do we find ‘turning points’ in non-linear relationships?
Questions we want to answer today
1. What other ways are there to estimate non-linear
relationships?
2. How does the interpretation of coefficients change when
estimating in logs?
3. How do we compare coefficients of variables when they are
using very different scales?
Log function is useful
• The shape is useful
(diminishing returns, but
always increasing)
• Logged models allow us to
interpret results in
percentage terms
4
Thinking about units of change
Suppose we have wage data for a large number of people
across many years and we want to know how inflation
affects wages.
5
Log models and percentage change
• Logged models allow us to estimate models in which the
coefficients reflect percentage rather than absolute changes.
6
Log-linear model
7
Linear-log models
8
Linear-log model
9
Log-log models
10
Natural logs
[for reference]
11
Calculus of logged models (log-linear model; only Y is logged)
[for reference only]
12
Calculus of logged models (linear-log model; only X is logged)
[for reference only]
Rearrange:
13
Calculus of logged models (both Y and X are
logged)
[for reference only]
14
Hiccup 1: Scale is a bit wonky in logged models
15
16
Hiccup 2: Can’t log many variables
• A log of some number is the exponent to which we need to
raise e in order to get that number
• Log(7.389) = 2 because
• Log(0.000001) = -13.81 because
• Log(0.0) = -∞ because 0
• Log(negative number) [e.g. log(-2)] is undefined.
• Any variable that has a 0 or negative number can’t be logged.
17
Hiccup 3: Deciding among possible logged models not
easy
• Dependent variable is different across models (e.g. ln Y vs Y)
• Usually theory or graphical justification is sufficient.
• But it can require advanced tools to adjudicate among various
logged models (e.g. log-log versus linear-log models)
18
Logged life expectancy models
reg LogLifeexpectancy LogGDPPC
Number of obs = 173
R-squared = 0.5910
LogLifeexp~y | Coef. Std.Err. t P>|t|
-------------+-----------------------------------
LogGDPPC | .0770517 .00490 15.72 0.0
_cons | 3.572252 .04251 84.02 0.0
20
21
Standardized coefficients
To compare coefficients of variables measured on
different scales, we standardize variables.
• When the independent variable, Xk, and the dependent variable
are standardized, a one standard deviation increase in Xk is
associated with a standard deviation increase in the dependent
variable.
22
23
24
Example in Stata
. regress salary ba hr, beta
Source | SS df MS Number of obs = 6762
-------------+------------------------------ F( 2, 6759) = 1444.34
Model | 1.5471e+16 2 7.7356e+15 Prob > F = 0.0000
Residual | 3.6200e+16 6759 5.3558e+12 R-squared = 0.2994
-------------+------------------------------ Adj R-squared = 0.2992
Total | 5.1671e+16 6761 7.6425e+12 Root MSE = 2.3e+06
------------------------------------------------------------------------------
salary | Coef. Std. Err. t P>|t| Beta
-------------+----------------------------------------------------------------
ba | 1.24e+07 940986 13.20 0.000 .1422752
hr | 129627.4 2889.771 44.86 0.000 .4836231
_cons | -2869439 244241.1 -11.75 0.000 .
25
Create standardized variables in Stata
1) Manually
sum math
Variable | Obs Mean Std. Dev. Min Max
-------------+------------------------------------------
math | 200 52.645 9.368448 33 75
27
What we will do next class
1. How do you estimate a relationship between X and Y when Y
is a dummy variable?
2. How does the interpretation of the coefficients change?
28