-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBiksi_Prader_1_assigment_econometrics_ii.do
90 lines (46 loc) · 1.5 KB
/
Biksi_Prader_1_assigment_econometrics_ii.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
* BGSE - Competition and Market Regulation, winter 2016
* Quantitative and Statistics Methods II.
* Bendegúz István Biksi, Benjamin Prader
* First assignment
clear all
use "Biksi_Prader_1_assigment_econometrics_ii_rail.dta"
set more off
*4.
* Summarizing the variables
summarize PRICE QUANTITY LAKES COLLUSION, detail
*5.
* Generating the logarithm of price and quantity
generate LOGPRICE=log(PRICE)
generate LOGQUANTITY=log(QUANTITY)
* generating month dummies
tab (MONTH), gen(month)
* OLS for the demand
regress LOGQUANTITY LOGPRICE LAKES month*
outreg2 using 5_demand_2, tex
* OLS for the supply
regress LOGPRICE LOGQUANTITY DM1 DM2 DM3 DM4 COLLUSION month*
outreg2 using 5_supply_2, tex
*6.
** manual 2sls for the demand
* first stage regression
reg LOGPRICE DM1 DM2 DM3 DM4 LAKES month*
outreg2 using 6_demand_2, tex
* predict prices
predict P1
* second stage regression
reg LOGQUANTITY P1 LAKES month*
** manual 2sls for the supply
* first stage regression
reg LOGQUANTITY DM1 DM2 DM3 DM4 COLLUSION LAKES month*
outreg2 using 6_supply_3, tex
* predict quantities
predict Q1
* second stage regression
reg LOGPRICE Q1 DM1 DM2 DM3 DM4 COLLUSION
** built in 2sls
* Demand
ivregress 2sls LOGQUANTITY LAKES month* (LOGPRICE=DM1 DM2 DM3 DM4), first
outreg2 using 6_demand_iv_2, tex
* Supply
ivregress 2sls LOGPRICE DM1 DM2 DM3 DM4 COLLUSION month* (LOGQUANTITY=LAKES), first
outreg2 using 6_supply_iv_2, tex