-
Notifications
You must be signed in to change notification settings - Fork 0
/
Interpreting_Coefficients.do
62 lines (41 loc) · 2.07 KB
/
Interpreting_Coefficients.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
* This do file shows some examples about how to interpret coefficient estimates from a regression with log transformation.
* Example source: https://stats.oarc.ucla.edu/other/mult-pkg/faq/general/faqhow-do-i-interpret-a-regression-model-when-some-variables-are-log-transformed/
* Code Author: Ian He
* Date: Jun 28, 2023
* Stata Version: 18
clear all
global dtadir "D:\research\Econometrics_Tips\Data"
********************************************************************************
import delimited "$dtadir\lgtrans.csv", clear
* Report different types of means for "write"
ameans write
bysort female: ameans write
* Generate a dummy indicating "female"
gen gender = (female=="female")
drop female
rename gender female
* Log transforming variables
gen lgwrite = ln(write)
gen lgread = ln(read)
gen lgmath = ln(math)
********************************************************************************
* When dependent variable is log transformed
reg lgwrite
display exp(_b[_cons]) // same as the geometric mean
reg lgwrite female
display exp(_b[_cons]) // same as the geometric mean of male
display exp(_b[female])
********************************************************************************
* When some independent variables are log transformed
reg write female lgmath lgread
* With a 10% increase in reading score, the difference in the expected mean writing scores will be ( ) units.
display _b[lgread] * ln(1.1)
********************************************************************************
* When outcome variable and some independent variables are log transformed
reg lgwrite female lgmath read
* The expected percent increase in geometric mean from male student group to female student group is about ( )%.
display (exp(_b[female]) - 1) * 100
* With a one-unit increase in reading score, we expect to see about ( )% of increase in the geometric mean of writing score.
display (exp(_b[read]) - 1) * 100
* For any 10% increase in math score, the expected ratio of the writing score will be ( ).
display (1.1)^(_b[lgmath])