-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchap1_report2.Rmd
461 lines (352 loc) · 20.4 KB
/
chap1_report2.Rmd
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
---
title: "Paper1_Robustness_Report2"
author: "Peng"
date: "2023/2/16"
output: html_document
---
```{r load packages, message=FALSE, warning=FALSE}
#Load packages
#install.packages("clubSandwich")
library(readr)
library(did)
library(fixest)
library(DRDID)
library(tidyverse)
library(plm)
library(stargazer)
library(sandwich)
library(lmtest)
library(jtools)
library(clubSandwich)
```
```{r,message=FALSE, warning=FALSE}
#read data
setwd("~/R")
df2012<-read_csv("~/R/df2012_20210920.csv")
```
```{r}
# set levels of timedummy variables so that Y2012 will be used as
names(df2012)
unique(df2012$timedummy)
```
```{r, message=FALSE, warning=FALSE}
df2012$timedummy<-fct_relevel(df2012$timedummy,levels="Y2012","Y2013","Y2014","Y2015","Y2016","Y2017","janapr18","t1","t2")
#set levels of groups dummies so that Group C will be used as base
df2012$groups<-fct_relevel(df2012$groups, levels="C","A","B","D")
# set levels of period dummies so that t0 period will be used as base
df2012$periods<-fct_relevel(df2012$periods, levels="t0","t1","t2")
df2012<-df2012%>%select(-1)
```
```{r}
df2012<-df2012 %>%
mutate(timedummy2=case_when(year==2012~"Y2012",
year==2013~"Y2013",
year==2014~"Y2014",
year==2015~"Y2015",
year==2016~"Y2016",
year==2017~"Y2017",
janapr18==1~"Y2018janapr",
t1==1~"Yt1",
t2==1~"Yt2"))
unique(df2012$timedummy2)
```
# create new period dummies:
```{r}
library(lubridate)
# Transform string into date format
# 28 Oct, 2016 Engagement 1 date
# April 2017, report 1 date,
# April 24 2017, OIA1 date
# Jul 6, 2017 Media 1 date
# Oct 2017, report 2 date
# Dec 21, 2017, OIA 2 date
# Feb 1, 2018 Media Statements from Canterbury West Coast Secondary Principals Association
# Feb 26, 2018 report 2 date, OIA 2 reply
# Mar 21, 2018. Media 2 date
date_report1 <- "2017-04-01" # Assumpe both reports released on the first date of that month
date_report2 <- "2017-10-01"
date_engagement1<-"2016-10-28"
date_engagement2<- "2017-09-22"
date_schools_statement<-"2018-02-01"
date_media_1<-"2017-07-06"
date_media_2<-"2018-03-21"
```
# create new dummy variables of periods for further robustness checks
```{r}
df2012 <-df2012 %>%
mutate(period_engagement1 = case_when(df2012$sale_date_new < ymd(date_engagement1) ~ "t1_engagement1",
df2012$sale_date_new < ymd("2019-11-19") ~ "t2_engagement1",
TRUE ~ "t3_engagement1"
))%>%
mutate(period_engagement2 = case_when(df2012$sale_date_new < ymd(date_engagement2) ~ "t1_engagement2",
df2012$sale_date_new < ymd("2019-11-19") ~ "t2_engagement2",
TRUE ~ "t3_engagement2"
)) %>%
mutate(period_report1 = case_when(df2012$sale_date_new < ymd(date_report1) ~ "t1_report1",
df2012$sale_date_new < ymd("2019-11-19") ~ "t2_report1",
TRUE ~ "t3_report1")) %>%
mutate(period_report2 = case_when(df2012$sale_date_new < ymd(date_report2) ~ "t1_report2",
df2012$sale_date_new < ymd("2019-11-19") ~ "t2_report2",
TRUE ~ "t3_report2")) %>%
mutate(period_schoolstatement = case_when(df2012$sale_date_new < ymd(date_schools_statement) ~ "t1_schoolstatement",
df2012$sale_date_new < ymd("2019-11-19") ~ "t2_schoolstatement",
TRUE ~ "t3_schoolstatement"))%>%
mutate(period_media2 = case_when(df2012$sale_date_new < ymd(date_media_2) ~ "t1_media2",
df2012$sale_date_new < ymd("2019-11-19") ~ "t2_media2",
TRUE ~ "t3_media2"
))%>%
mutate(period_media1 = case_when(df2012$sale_date_new < ymd(date_media_1) ~ "t1_media1",
df2012$sale_date_new < ymd("2019-11-19") ~ "t2_media1",
TRUE ~ "t3_media1"
))
```
#create dummy variables for all three periods in different scenarioes
```{r}
df2012 <- df2012 %>%
mutate(t1_engagement1 = case_when(period_engagement1 == "t1_engagement1" ~ 1,
TRUE ~ 0))%>%
mutate(t2_engagement1 = case_when(period_engagement1 == "t2_engagement1" ~ 1,
TRUE ~ 0))%>%
mutate(t3_engagement1 = case_when(period_engagement1 == "t3_engagement1" ~ 1,
TRUE ~ 0))%>%
mutate(t1_engagement2 = case_when(period_engagement2 == "t1_engagement2" ~ 1,
TRUE ~ 0))%>%
mutate(t2_engagement2 = case_when(period_engagement2 == "t2_engagement2" ~ 1,
TRUE ~ 0))%>%
mutate(t3_engagement2 = case_when(period_engagement2 == "t3_engagement2" ~ 1,
TRUE ~ 0))%>%
mutate(t1_report1 = case_when(period_report1 == "t1_report2" ~ 1,
TRUE ~ 0))%>%
mutate(t2_report1 = case_when(period_report1 == "t2_report2" ~ 1,
TRUE ~ 0))%>%
mutate(t3_report1 = case_when(period_report1 == "t3_report2" ~ 1,
TRUE ~ 0))%>%
mutate(t1_report2 = case_when(period_report2 == "t1_report2" ~ 1,
TRUE ~ 0))%>%
mutate(t2_report2 = case_when(period_report2 == "t2_report2" ~ 1,
TRUE ~ 0))%>%
mutate(t3_report2 = case_when(period_report2 == "t3_report2" ~ 1,
TRUE ~ 0))%>%
mutate(t1_media1 = case_when(period_media1 == "t1_media2" ~ 1,
TRUE ~ 0))%>%
mutate(t2_media1 = case_when(period_media1 == "t2_media2" ~ 1,
TRUE ~ 0))%>%
mutate(t3_media1 = case_when(period_media1 == "t3_media2" ~ 1,
TRUE ~ 0))%>%
mutate(t1_media2 = case_when(period_media2 == "t1_media2" ~ 1,
TRUE ~ 0))%>%
mutate(t2_media2 = case_when(period_media2 == "t2_media2" ~ 1,
TRUE ~ 0))%>%
mutate(t3_media2 = case_when(period_media2 == "t3_media2" ~ 1,
TRUE ~ 0))
```
```{r}
names(df2012)
```
```{r}
df2012_mutated <- df2012
df2012_mutated$contour=replace_na(df2012_mutated$contour,"Unreported")
df2012_mutated$deck=replace_na(df2012_mutated$deck,"Unreported")
# df2012_mutated$garages_mainroof=replace_na(df2012_mutated$garages_mainroof,"Unreported")
df2012_mutated$roof_material=replace_na(df2012_mutated$roof_material,"Unreported")
df2012_mutated$wall_material=replace_na(df2012_mutated$wall_material,"Unreported")
df2012_mutated$building_age=replace_na(df2012_mutated$building_age,"Unreported")
df2012_mutated$land_area=replace_na(df2012_mutated$land_area,0.069)
df2012_mutated$floor_area=replace_na(df2012_mutated$floor_area,136)
```
```{r}
garage=df2012_mutated$garages_mainroof
# replace msising values with Unreported
garage[is.na(garage)]<-"Unreported"
df2012_mutated$garages_mainroof<-garage
```
#Get the same obs for the pooled cross section models(fix the 30 obs difference)
```{r}
bedrooms_min=df2012_mutated$bedrooms_min
# replace msising values with Unreported
bedrooms_min[is.na(bedrooms_min)]<-"Unreported"
#head(bedrooms_min)
df2012_mutated$bedrooms_min<- bedrooms_min
```
# Column 1
```{r}
col1_report2<-feols(lp~t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D,data=df2012)
summary(col1_report2)
```
```{r}
#Using D as control group
col1_D_report2<-feols(lp~t2_report2+t3_report2+A+B+C+t3_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*C+t3_report2*C,data=df2012)
summary(col1_D_report2)
```
```{r}
coefplot(col1_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
coefplot(col1_D_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:C","t3_report2:C"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# add control of quarter dummy
col1_q_report2<-feols(lp~t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+as.factor(sale_date_q),data=df2012)
summary(col1_q)
```
```{r}
coefplot(col1_q_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# add control of month dummy
col1_m_report2<-feols(lp~t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+as.factor(sale_date_m),data=df2012)
summary(col1_m_report2)
```
```{r}
coefplot(col1_m_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# Column 2
lm_housefeature2_report2<-feols(lp~t2_report2+t3_report2+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+floor_area+land_area+bedrooms_min+as.factor(building_age)+ as.factor(deck)+ as.factor(wall_material)
+as.factor(roof_material)+as.factor(garages_mainroof)+ as.factor(contour)+as.factor(period_report2) +as.factor(suburb),data=df2012_mutated)
summary(lm_housefeature2)
```
```{r}
coefplot(lm_housefeature2_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
col2_D_report2<-feols(lp~t2_report2+t3_report2+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*C+t3_report2*C+floor_area+land_area+bedrooms_min+as.factor(building_age)+ as.factor(deck)+ as.factor(wall_material)
+as.factor(roof_material)+as.factor(garages_mainroof)+ as.factor(contour)+as.factor(period_report2) +as.factor(suburb),data=df2012_mutated)
summary(col2_D_report2)
```
```{r}
coefplot(col2_D_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:C","t3_report2:C"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# add quarter dummy
col2_q_report2<-feols(lp~t2_report2+t3_report2+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+as.factor(sale_date_q)+floor_area+land_area+bedrooms_min+as.factor(building_age)+ as.factor(deck)+ as.factor(wall_material)
+as.factor(roof_material)+as.factor(garages_mainroof)+ as.factor(contour)+as.factor(period_report2) +as.factor(suburb),data=df2012_mutated)
summary(col2_q_report2)
```
```{r}
coefplot(col2_q_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
col2_m_report2<-feols(lp~t2_report2+t3_report2+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+as.factor(sale_date_m)+floor_area+land_area+bedrooms_min+as.factor(building_age)+ as.factor(deck)+ as.factor(wall_material)
+as.factor(roof_material)+as.factor(garages_mainroof)+ as.factor(contour)+as.factor(period_report2) +as.factor(suburb),data=df2012_mutated)
summary(col2_m_report2)
```
```{r}
coefplot(col2_m_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
#column 3
col3_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D|houseid+year, data=df2012)
summary(col3_report2)
```
```{r}
coefplot(col3_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
col3_D_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+t2_report2+t3_report2+A+B+C+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*C+t3_report2*C|houseid+year, data=df2012)
summary(col3_D_report2)
```
```{r}
coefplot(col3_D_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:C","t3_report2:C"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# control quarter
col3_q_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D|houseid+year+sale_date_q, data=df2012)
summary(col3_q_report2)
```
```{r}
coefplot(col3_q_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# control month
col3_m_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D|houseid+year+sale_date_m, data=df2012)
summary(col3_m_report2)
```
```{r}
coefplot(col3_m_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:D","t3_report2:D"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# control quarter &D, not required by Reviewers
col3_qD_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+t2_report2+t3_report2+A+B+C+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*C+t3_report2*C|houseid+year+sale_date_q, data=df2012)
summary(col3_qD_report2)
coefplot(col3_qD_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:C","t3_report2:C"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
# control month and D, not required by Reviewers
col3_mD_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+t2_report2+t3_report2+A+B+C+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*C+t3_report2*C|houseid+year+sale_date_m, data=df2012)
summary(col3_mD_report2)
coefplot(col3_mD_report2,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:C","t3_report2:C"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
# control month and D and suburb, not required by Reviewers
col3_mDs<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+t2_report2+t3_report2+A+B+C+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*C+t3_report2*C|suburb+houseid+year+sale_date_m, data=df2012)
summary(col3_mDs)
coefplot(col3_mDs,keep=c("t2_report2:A","t3_report2:A","t2_report2:B","t3_report2:B","t2_report2:C","t3_report2:C"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# Column 4
housefeature_pretrends_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+yr2012*A+yr2013*A+yr2014*A+yr2015*A+yr2016*A+yr2017*A+yr2012*B+yr2013*B+yr2014*B+yr2015*B+yr2016*B+yr2017*B+yr2012*D+yr2013*D+yr2014*D+yr2015*D+yr2016*D+yr2017*D+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+floor_area+land_area+bedrooms_min+as.factor(building_age)+ as.factor(deck)+ as.factor(wall_material)
+as.factor(roof_material)+as.factor(garages_mainroof)+ as.factor(contour)+as.factor(suburb)|houseid+year,data=df2012_mutated)
summary(housefeature_pretrends_report2)
```
```{r}
coefplot(housefeature_pretrends_report2,keep=c("A:t2_report2","A:t3_report2","B:t2_report2","B:t3_report2","D:t2_report2","D:t3_report2"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
# D
```{r}
col4_D_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+yr2012*A+yr2013*A+yr2014*A+yr2015*A+yr2016*A+yr2017*A+yr2012*B+yr2013*B+yr2014*B+yr2015*B+yr2016*B+yr2017*B+yr2012*C+yr2013*C+yr2014*C+yr2015*C+yr2016*C+yr2017*C+t2_report2+t3_report2+A+B+C+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*C+t3_report2*C+floor_area+land_area+bedrooms_min+as.factor(building_age)+ as.factor(deck)+ as.factor(wall_material)
+as.factor(roof_material)+as.factor(garages_mainroof)+ as.factor(contour)+as.factor(suburb)|houseid+year,data=df2012_mutated)
summary(col4_D_report2)
```
```{r}
coefplot(col4_D_report2,keep=c("A:t2_report2","A:t3_report2","B:t2_report2","B:t3_report2","C:t2_report2","C:t3_report2"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
#add quarter dummy
```
```{r}
col4_q<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+yr2012*A+yr2013*A+yr2014*A+yr2015*A+yr2016*A+yr2017*A+yr2012*B+yr2013*B+yr2014*B+yr2015*B+yr2016*B+yr2017*B+yr2012*D+yr2013*D+yr2014*D+yr2015*D+yr2016*D+yr2017*D+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+floor_area+land_area+bedrooms_min+as.factor(building_age)+ as.factor(deck)+ as.factor(wall_material)
+as.factor(roof_material)+as.factor(garages_mainroof)+ as.factor(contour)+as.factor(suburb)+as.factor(sale_date_q)|houseid+year,data=df2012_mutated)
summary(col4_q)
```
```{r}
coefplot(col4_q,keep=c("A:t2_report2","A:t3_report2","B:t2_report2","B:t3_report2","D:t2_report2","D:t3_report2"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# add month dummy
col4_m<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+yr2012*A+yr2013*A+yr2014*A+yr2015*A+yr2016*A+yr2017*A+yr2012*B+yr2013*B+yr2014*B+yr2015*B+yr2016*B+yr2017*B+yr2012*D+yr2013*D+yr2014*D+yr2015*D+yr2016*D+yr2017*D+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+floor_area+land_area+bedrooms_min+as.factor(building_age)+ as.factor(deck)+ as.factor(wall_material)
+as.factor(roof_material)+as.factor(garages_mainroof)+ as.factor(contour)+as.factor(suburb)+as.factor(sale_date_m)|houseid+year,data=df2012_mutated)
summary(col4_m)
```
```{r}
coefplot(col4_m,keep=c("A:t2_report2","A:t3_report2","B:t2_report2","B:t3_report2","D:t2_report2","D:t3_report2"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
# column 5
```{r}
# use feols() instead of plm()
col5<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+yr2012*A+yr2013*A+yr2014*A+yr2015*A+yr2016*A+yr2017*A+yr2012*B+yr2013*B+yr2014*B+yr2015*B+yr2016*B+yr2017*B+yr2012*D+yr2013*D+yr2014*D+yr2015*D+yr2016*D+yr2017*D+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D|houseid+year,data=df2012)
summary(col5)
```
```{r}
coefplot(col5,keep=c("A:t2_report2","A:t3_report2","B:t2_report2","B:t3_report2","D:t2_report2","D:t3_report2"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# D control
col5_D_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+yr2012*A+yr2013*A+yr2014*A+yr2015*A+yr2016*A+yr2017*A+yr2012*B+yr2013*B+yr2014*B+yr2015*B+yr2016*B+yr2017*B+yr2012*C+yr2013*C+yr2014*C+yr2015*C+yr2016*C+yr2017*C+t2_report2+t3_report2+A+B+C+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*C+t3_report2*C|houseid+year,data=df2012)
summary(col5_D_report2)
```
```{r}
coefplot(col5_D_report2,keep=c("A:t2_report2","A:t3_report2","B:t2_report2","B:t3_report2","C:t2_report2","C:t3_report2"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# add quarter dummy
col5_q_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+yr2012*A+yr2013*A+yr2014*A+yr2015*A+yr2016*A+yr2017*A+yr2012*B+yr2013*B+yr2014*B+yr2015*B+yr2016*B+yr2017*B+yr2012*D+yr2013*D+yr2014*D+yr2015*D+yr2016*D+yr2017*D+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+as.factor(sale_date_q)|houseid+year,data=df2012)
summary(col5_q_report2)
```
```{r}
coefplot(col5_q_report2,keep=c("A:t2_report2","A:t3_report2","B:t2_report2","B:t3_report2","D:t2_report2","D:t3_report2"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```
```{r}
# add month dummy
col5_m_report2<-feols(lp~yr2012+yr2013+yr2014+yr2015+yr2016+yr2017+yr2012*A+yr2013*A+yr2014*A+yr2015*A+yr2016*A+yr2017*A+yr2012*B+yr2013*B+yr2014*B+yr2015*B+yr2016*B+yr2017*B+yr2012*D+yr2013*D+yr2014*D+yr2015*D+yr2016*D+yr2017*D+t2_report2+t3_report2+A+B+D+t2_report2*A+t3_report2*A+t2_report2*B+t3_report2*B+t2_report2*D+t3_report2*D+as.factor(sale_date_m)|houseid+year,data=df2012)
summary(col5_m_report2)
```
```{r}
coefplot(col5_m_report2,keep=c("A:t2_report2","A:t3_report2","B:t2_report2","B:t3_report2","D:t2_report2","D:t3_report2"), ylim=c(-0.4,0.4), axis.text.x = element_text(size=14))
```