Model
Rent 0
felm.00<-felm(log(RENT_0)~treat+Price+Unemployee.Rate+
Personal.Income+Resident.Population+
treat:(d.2001+d.2002+d.2003+
d.2005+d.2006+d.2007+d.2008+
d.2009+d.2010+d.2011+d.2012+
d.2013+d.2014+d.2015)|MSA+YEAR|0|MSA,
data = RENT.merge1)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
summary(felm.00)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
##
## Call:
## felm(formula = log(RENT_0) ~ treat + Price + Unemployee.Rate + Personal.Income + Resident.Population + treat:(d.2001 + d.2002 + d.2003 + d.2005 + d.2006 + d.2007 + d.2008 + d.2009 + d.2010 + d.2011 + d.2012 + d.2013 + d.2014 + d.2015) | MSA + YEAR | 0 | MSA, data = RENT.merge1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.247660 -0.042112 0.000362 0.042852 0.306519
##
## Coefficients:
## Estimate Cluster s.e. t value Pr(>|t|)
## treat NaN 0.000e+00 NaN NaN
## Price 4.993e-04 1.328e-04 3.761 0.000218 ***
## Unemployee.Rate 1.625e-02 2.766e-03 5.875 1.58e-08 ***
## Personal.Income 4.765e-06 1.517e-06 3.142 0.001914 **
## Resident.Population -1.047e-04 3.350e-05 -3.125 0.002025 **
## treat:d.2001 -9.232e-03 1.264e-02 -0.731 0.465809
## treat:d.2002 1.282e-02 3.393e-03 3.778 0.000204 ***
## treat:d.2003 1.890e-03 2.566e-03 0.736 0.462282
## treat:d.2005 7.991e-02 3.121e-02 2.560 0.011150 *
## treat:d.2006 1.535e-01 5.307e-02 2.893 0.004205 **
## treat:d.2007 1.437e-01 5.407e-02 2.657 0.008474 **
## treat:d.2008 1.481e-01 4.693e-02 3.157 0.001822 **
## treat:d.2009 1.937e-01 4.550e-02 4.256 3.10e-05 ***
## treat:d.2010 2.147e-01 4.034e-02 5.322 2.57e-07 ***
## treat:d.2011 2.227e-01 3.728e-02 5.974 9.41e-09 ***
## treat:d.2012 1.501e-01 4.333e-02 3.464 0.000641 ***
## treat:d.2013 1.924e-01 2.212e-02 8.696 8.77e-16 ***
## treat:d.2014 1.539e-01 2.525e-02 6.095 4.97e-09 ***
## treat:d.2015 1.345e-01 2.664e-02 5.049 9.41e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.07021 on 2973 degrees of freedom
## Multiple R-squared(full model): 0.918 Adjusted R-squared: 0.9111
## Multiple R-squared(proj model): 0.09216 Adjusted R-squared: 0.01643
## F-statistic(full model, *iid*):134.2 on 248 and 2973 DF, p-value: < 2.2e-16
## F-statistic(proj model): 53.66 on 19 and 216 DF, p-value: < 2.2e-16
#coef_df <- coeftest(felm.00,vcov. = vcovHC(felm.00,type = "HC1"))
#coef_df <- coef_df[,]%>%as_tibble()%>%mutate(variables=rownames(coef_df))
coef_df <- tidy(felm.00)[6:19,]
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
event_df <- data.frame(time = 1:nrow(coef_df),
coef = coef_df$estimate,
se = coef_df$std.error)
event_df<-rbind(event_df,c("time"=3.5,"coef"=0,"se"=0))
event_df<-arrange(event_df,time)
# Calculate confidence intervals
event_df$ci_upper <- event_df$coef + 1.96 * event_df$se
event_df$ci_lower <- event_df$coef - 1.96 * event_df$se
# Extract dates from row names of coef_df
##dates <- as.Date(paste0(row.names(coef_df),"0101"), format = "treat:YEAR%Y%m%d")
dates<-seq.Date(from = as.Date("2001-01-01"),as.Date("2015-01-01"),by="year")
# Define start and end dates for plot
start_date <- as.Date("2001-01-01")
end_date <- as.Date("2015-01-01")
# Create sequence of dates for x-axis
dates_seq <- seq(from = start_date, to = end_date, by = "year")
# Subset event_df to only include dates after or equal to start_date
event_df_sub <- event_df[dates >= start_date, ]
pl<-ggplot(event_df, aes(x = dates, y = coef)) +
geom_point() +geom_line()+
#geom_errorbar(aes(ymin = ci_lower, ymax = ci_upper), width = 0.2) +
geom_ribbon(aes(ymin = ci_lower, ymax = ci_upper), alpha = 0.2) +
geom_hline(yintercept = 0, linetype = "dashed", color = "red") +
geom_vline(xintercept = as.Date("2005-01-01"), linetype = "dashed", color = "blue") +
scale_x_date(date_labels = "%Y", limits = c(start_date, end_date), breaks = "1 year") +
labs(x = "Year", y = "Coefficient")+ #title = "Fixed effect of RENT_0") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+theme_bw()
pl

Rent 1
felm.01<-felm(log(RENT_1)~treat+Price+Unemployee.Rate+
Personal.Income+Resident.Population+
treat:(d.2001+d.2002+d.2003+
d.2005+d.2006+d.2007+d.2008+
d.2009+d.2010+d.2011+d.2012+
d.2013+d.2014+d.2015)|MSA+YEAR|0|MSA,
data = RENT.merge1)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
summary(felm.01)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
##
## Call:
## felm(formula = log(RENT_1) ~ treat + Price + Unemployee.Rate + Personal.Income + Resident.Population + treat:(d.2001 + d.2002 + d.2003 + d.2005 + d.2006 + d.2007 + d.2008 + d.2009 + d.2010 + d.2011 + d.2012 + d.2013 + d.2014 + d.2015) | MSA + YEAR | 0 | MSA, data = RENT.merge1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.20465 -0.03133 -0.00177 0.03118 0.33066
##
## Coefficients:
## Estimate Cluster s.e. t value Pr(>|t|)
## treat NaN 0.000e+00 NaN NaN
## Price 6.290e-04 1.165e-04 5.400 1.75e-07 ***
## Unemployee.Rate 1.742e-02 2.248e-03 7.749 3.58e-13 ***
## Personal.Income 3.709e-06 1.514e-06 2.450 0.015088 *
## Resident.Population -4.208e-05 3.509e-05 -1.199 0.231788
## treat:d.2001 -2.243e-03 6.634e-03 -0.338 0.735589
## treat:d.2002 1.194e-02 3.747e-03 3.185 0.001661 **
## treat:d.2003 1.437e-03 2.919e-03 0.492 0.623054
## treat:d.2005 4.742e-02 2.210e-02 2.146 0.032998 *
## treat:d.2006 1.231e-01 4.631e-02 2.658 0.008453 **
## treat:d.2007 1.131e-01 4.725e-02 2.394 0.017543 *
## treat:d.2008 1.185e-01 4.024e-02 2.944 0.003592 **
## treat:d.2009 1.641e-01 3.825e-02 4.289 2.70e-05 ***
## treat:d.2010 1.814e-01 3.367e-02 5.389 1.85e-07 ***
## treat:d.2011 1.885e-01 3.149e-02 5.987 8.83e-09 ***
## treat:d.2012 1.501e-01 3.176e-02 4.726 4.12e-06 ***
## treat:d.2013 1.738e-01 3.409e-02 5.097 7.51e-07 ***
## treat:d.2014 1.341e-01 3.834e-02 3.498 0.000569 ***
## treat:d.2015 1.128e-01 3.368e-02 3.350 0.000952 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0532 on 2973 degrees of freedom
## Multiple R-squared(full model): 0.9465 Adjusted R-squared: 0.9421
## Multiple R-squared(proj model): 0.1317 Adjusted R-squared: 0.05924
## F-statistic(full model, *iid*):212.3 on 248 and 2973 DF, p-value: < 2.2e-16
## F-statistic(proj model): 22.74 on 19 and 216 DF, p-value: < 2.2e-16
#coef_df <- coeftest(felm.01,vcov. = vcovHC(felm.01,type = "HC1"))
#coef_df <- coef_df[,]%>%as_tibble()%>%mutate(variables=rownames(coef_df))
coef_df <- tidy(felm.01)[6:19,]
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
event_df <- data.frame(time = 1:nrow(coef_df),
coef = coef_df$estimate,
se = coef_df$std.error)
event_df<-rbind(event_df,c("time"=3.5,"coef"=0,"se"=0))
event_df<-arrange(event_df,time)
# Calculate confidence intervals
event_df$ci_upper <- event_df$coef + 1.96 * event_df$se
event_df$ci_lower <- event_df$coef - 1.96 * event_df$se
# Extract dates from row names of coef_df
##dates <- as.Date(paste0(row.names(coef_df),"0101"), format = "treat:YEAR%Y%m%d")
dates<-seq.Date(from = as.Date("2001-01-01"),as.Date("2015-01-01"),by="year")
# Define start and end dates for plot
start_date <- as.Date("2001-01-01")
end_date <- as.Date("2015-01-01")
# Create sequence of dates for x-axis
dates_seq <- seq(from = start_date, to = end_date, by = "year")
# Subset event_df to only include dates after or equal to start_date
event_df_sub <- event_df[dates >= start_date, ]
pl<-ggplot(event_df, aes(x = dates, y = coef)) +
geom_point() +geom_line()+
#geom_errorbar(aes(ymin = ci_lower, ymax = ci_upper), width = 0.2) +
geom_ribbon(aes(ymin = ci_lower, ymax = ci_upper), alpha = 0.2) +
geom_hline(yintercept = 0, linetype = "dashed", color = "red") +
geom_vline(xintercept = as.Date("2005-01-01"), linetype = "dashed", color = "blue") +
scale_x_date(date_labels = "%Y", limits = c(start_date, end_date), breaks = "1 year") +
labs(x = "Year", y = "Coefficient")+ #title = "Fixed effect of RENT_1") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+theme_bw()
pl

Rent 2
felm.02<-felm(log(RENT_2)~treat+Price+Unemployee.Rate+
Personal.Income+Resident.Population+
treat:(d.2001+d.2002+d.2003+
d.2005+d.2006+d.2007+d.2008+
d.2009+d.2010+d.2011+d.2012+
d.2013+d.2014+d.2015)|MSA+YEAR|0|MSA,
data = RENT.merge1)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
summary(felm.02)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
##
## Call:
## felm(formula = log(RENT_2) ~ treat + Price + Unemployee.Rate + Personal.Income + Resident.Population + treat:(d.2001 + d.2002 + d.2003 + d.2005 + d.2006 + d.2007 + d.2008 + d.2009 + d.2010 + d.2011 + d.2012 + d.2013 + d.2014 + d.2015) | MSA + YEAR | 0 | MSA, data = RENT.merge1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.167925 -0.030814 -0.001612 0.030462 0.293484
##
## Coefficients:
## Estimate Cluster s.e. t value Pr(>|t|)
## treat NaN 0.000e+00 NaN NaN
## Price 5.039e-04 1.117e-04 4.509 1.07e-05 ***
## Unemployee.Rate 1.502e-02 2.152e-03 6.981 3.56e-11 ***
## Personal.Income 2.482e-06 1.372e-06 1.809 0.071902 .
## Resident.Population -5.901e-05 3.618e-05 -1.631 0.104373
## treat:d.2001 7.816e-04 6.529e-03 0.120 0.904820
## treat:d.2002 1.278e-02 3.273e-03 3.906 0.000125 ***
## treat:d.2003 2.157e-03 2.336e-03 0.923 0.356856
## treat:d.2005 2.819e-02 1.977e-02 1.426 0.155367
## treat:d.2006 1.028e-01 4.394e-02 2.340 0.020171 *
## treat:d.2007 9.486e-02 4.503e-02 2.107 0.036284 *
## treat:d.2008 1.017e-01 3.815e-02 2.667 0.008236 **
## treat:d.2009 1.452e-01 3.655e-02 3.971 9.74e-05 ***
## treat:d.2010 1.649e-01 3.252e-02 5.071 8.50e-07 ***
## treat:d.2011 1.726e-01 3.076e-02 5.612 6.11e-08 ***
## treat:d.2012 1.250e-01 3.261e-02 3.832 0.000167 ***
## treat:d.2013 1.591e-01 3.712e-02 4.285 2.75e-05 ***
## treat:d.2014 1.218e-01 4.179e-02 2.914 0.003947 **
## treat:d.2015 1.005e-01 3.482e-02 2.886 0.004296 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.05202 on 2973 degrees of freedom
## Multiple R-squared(full model): 0.9442 Adjusted R-squared: 0.9395
## Multiple R-squared(proj model): 0.1046 Adjusted R-squared: 0.02987
## F-statistic(full model, *iid*):202.7 on 248 and 2973 DF, p-value: < 2.2e-16
## F-statistic(proj model): 23.73 on 19 and 216 DF, p-value: < 2.2e-16
#coef_df <- coeftest(felm.02,vcov. = vcovHC(felm.02,type = "HC1"))
#coef_df <- coef_df[,]%>%as_tibble()%>%mutate(variables=rownames(coef_df))
coef_df <- tidy(felm.02)[6:19,]
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
event_df <- data.frame(time = 1:nrow(coef_df),
coef = coef_df$estimate,
se = coef_df$std.error)
event_df<-rbind(event_df,c("time"=3.5,"coef"=0,"se"=0))
event_df<-arrange(event_df,time)
# Calculate confidence intervals
event_df$ci_upper <- event_df$coef + 1.96 * event_df$se
event_df$ci_lower <- event_df$coef - 1.96 * event_df$se
# Extract dates from row names of coef_df
##dates <- as.Date(paste0(row.names(coef_df),"0101"), format = "treat:YEAR%Y%m%d")
dates<-seq.Date(from = as.Date("2001-01-01"),as.Date("2015-01-01"),by="year")
# Define start and end dates for plot
start_date <- as.Date("2001-01-01")
end_date <- as.Date("2015-01-01")
# Create sequence of dates for x-axis
dates_seq <- seq(from = start_date, to = end_date, by = "year")
# Subset event_df to only include dates after or equal to start_date
event_df_sub <- event_df[dates >= start_date, ]
pl<-ggplot(event_df, aes(x = dates, y = coef)) +
geom_point() +geom_line()+
#geom_errorbar(aes(ymin = ci_lower, ymax = ci_upper), width = 0.2) +
geom_ribbon(aes(ymin = ci_lower, ymax = ci_upper), alpha = 0.2) +
geom_hline(yintercept = 0, linetype = "dashed", color = "red") +
geom_vline(xintercept = as.Date("2005-01-01"), linetype = "dashed", color = "blue") +
scale_x_date(date_labels = "%Y", limits = c(start_date, end_date), breaks = "1 year") +
labs(x = "Year", y = "Coefficient")+ #title = "Fixed effect of RENT_2") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+theme_bw()
pl

Rent 3
felm.03<-felm(log(RENT_3)~treat+Price+Unemployee.Rate+
Personal.Income+Resident.Population+
treat:(d.2001+d.2002+d.2003+
d.2005+d.2006+d.2007+d.2008+
d.2009+d.2010+d.2011+d.2012+
d.2013+d.2014+d.2015)|MSA+YEAR|0|MSA,
data = RENT.merge1)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
summary(felm.03)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
##
## Call:
## felm(formula = log(RENT_3) ~ treat + Price + Unemployee.Rate + Personal.Income + Resident.Population + treat:(d.2001 + d.2002 + d.2003 + d.2005 + d.2006 + d.2007 + d.2008 + d.2009 + d.2010 + d.2011 + d.2012 + d.2013 + d.2014 + d.2015) | MSA + YEAR | 0 | MSA, data = RENT.merge1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.183806 -0.033039 -0.001461 0.032035 0.238102
##
## Coefficients:
## Estimate Cluster s.e. t value Pr(>|t|)
## treat NaN 0.000e+00 NaN NaN
## Price 4.841e-04 1.093e-04 4.430 1.50e-05 ***
## Unemployee.Rate 1.362e-02 2.391e-03 5.697 3.96e-08 ***
## Personal.Income 1.751e-06 1.544e-06 1.134 0.258010
## Resident.Population -7.541e-05 4.154e-05 -1.815 0.070888 .
## treat:d.2001 1.750e-03 7.046e-03 0.248 0.804044
## treat:d.2002 1.409e-02 3.229e-03 4.364 1.98e-05 ***
## treat:d.2003 3.143e-03 2.439e-03 1.289 0.198925
## treat:d.2005 -3.690e-02 1.302e-02 -2.833 0.005042 **
## treat:d.2006 4.484e-02 4.387e-02 1.022 0.307849
## treat:d.2007 3.779e-02 4.476e-02 0.844 0.399429
## treat:d.2008 4.466e-02 3.886e-02 1.149 0.251729
## treat:d.2009 8.632e-02 3.733e-02 2.312 0.021712 *
## treat:d.2010 1.074e-01 3.469e-02 3.094 0.002234 **
## treat:d.2011 1.152e-01 3.373e-02 3.417 0.000757 ***
## treat:d.2012 7.001e-02 3.058e-02 2.290 0.023007 *
## treat:d.2013 8.632e-02 3.665e-02 2.355 0.019405 *
## treat:d.2014 4.999e-02 4.027e-02 1.241 0.215863
## treat:d.2015 2.868e-02 3.135e-02 0.915 0.361222
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.05444 on 2973 degrees of freedom
## Multiple R-squared(full model): 0.9449 Adjusted R-squared: 0.9403
## Multiple R-squared(proj model): 0.07094 Adjusted R-squared: -0.006557
## F-statistic(full model, *iid*):205.6 on 248 and 2973 DF, p-value: < 2.2e-16
## F-statistic(proj model): 15.24 on 19 and 216 DF, p-value: < 2.2e-16
#coef_df <- coeftest(felm.03,vcov. = vcovHC(felm.03,type = "HC1"))
#coef_df <- coef_df[,]%>%as_tibble()%>%mutate(variables=rownames(coef_df))
coef_df <- tidy(felm.03)[6:19,]
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
event_df <- data.frame(time = 1:nrow(coef_df),
coef = coef_df$estimate,
se = coef_df$std.error)
event_df<-rbind(event_df,c("time"=3.5,"coef"=0,"se"=0))
event_df<-arrange(event_df,time)
# Calculate confidence intervals
event_df$ci_upper <- event_df$coef + 1.96 * event_df$se
event_df$ci_lower <- event_df$coef - 1.96 * event_df$se
# Extract dates from row names of coef_df
##dates <- as.Date(paste0(row.names(coef_df),"0101"), format = "treat:YEAR%Y%m%d")
dates<-seq.Date(from = as.Date("2001-01-01"),as.Date("2015-01-01"),by="year")
# Define start and end dates for plot
start_date <- as.Date("2001-01-01")
end_date <- as.Date("2015-01-01")
# Create sequence of dates for x-axis
dates_seq <- seq(from = start_date, to = end_date, by = "year")
# Subset event_df to only include dates after or equal to start_date
event_df_sub <- event_df[dates >= start_date, ]
pl<-ggplot(event_df, aes(x = dates, y = coef)) +
geom_point() +geom_line()+
#geom_errorbar(aes(ymin = ci_lower, ymax = ci_upper), width = 0.2) +
geom_ribbon(aes(ymin = ci_lower, ymax = ci_upper), alpha = 0.2) +
geom_hline(yintercept = 0, linetype = "dashed", color = "red") +
geom_vline(xintercept = as.Date("2005-01-01"), linetype = "dashed", color = "blue") +
scale_x_date(date_labels = "%Y", limits = c(start_date, end_date), breaks = "1 year") +
labs(x = "Year", y = "Coefficient")+ #title = "Fixed effect of RENT_3") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+theme_bw()
pl

Rent 4
felm.04<-felm(log(RENT_4)~treat+Price+Unemployee.Rate+
Personal.Income+Resident.Population+
treat:(d.2001+d.2002+d.2003+
d.2005+d.2006+d.2007+d.2008+
d.2009+d.2010+d.2011+d.2012+
d.2013+d.2014+d.2015)|MSA+YEAR|0|MSA,
data = RENT.merge1)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
summary(felm.04)
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
##
## Call:
## felm(formula = log(RENT_4) ~ treat + Price + Unemployee.Rate + Personal.Income + Resident.Population + treat:(d.2001 + d.2002 + d.2003 + d.2005 + d.2006 + d.2007 + d.2008 + d.2009 + d.2010 + d.2011 + d.2012 + d.2013 + d.2014 + d.2015) | MSA + YEAR | 0 | MSA, data = RENT.merge1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.22538 -0.03951 -0.00011 0.03889 0.24607
##
## Coefficients:
## Estimate Cluster s.e. t value Pr(>|t|)
## treat NaN 0.000e+00 NaN NaN
## Price 5.579e-04 1.261e-04 4.424 1.54e-05 ***
## Unemployee.Rate 1.422e-02 2.826e-03 5.030 1.03e-06 ***
## Personal.Income 2.197e-06 1.553e-06 1.415 0.158456
## Resident.Population -5.515e-05 4.626e-05 -1.192 0.234562
## treat:d.2001 -2.059e-02 2.459e-02 -0.837 0.403383
## treat:d.2002 1.271e-02 3.339e-03 3.806 0.000184 ***
## treat:d.2003 2.591e-03 2.416e-03 1.073 0.284584
## treat:d.2005 -1.406e-02 3.417e-02 -0.412 0.681027
## treat:d.2006 4.776e-02 5.507e-02 0.867 0.386760
## treat:d.2007 4.026e-02 5.581e-02 0.721 0.471503
## treat:d.2008 4.613e-02 5.121e-02 0.901 0.368680
## treat:d.2009 8.798e-02 4.986e-02 1.764 0.079062 .
## treat:d.2010 1.076e-01 4.644e-02 2.316 0.021497 *
## treat:d.2011 1.155e-01 4.545e-02 2.541 0.011750 *
## treat:d.2012 7.992e-02 4.705e-02 1.699 0.090849 .
## treat:d.2013 1.041e-01 5.176e-02 2.012 0.045472 *
## treat:d.2014 6.753e-02 5.714e-02 1.182 0.238535
## treat:d.2015 4.680e-02 4.305e-02 1.087 0.278189
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.06609 on 2973 degrees of freedom
## Multiple R-squared(full model): 0.9314 Adjusted R-squared: 0.9256
## Multiple R-squared(proj model): 0.0544 Adjusted R-squared: -0.02448
## F-statistic(full model, *iid*):162.7 on 248 and 2973 DF, p-value: < 2.2e-16
## F-statistic(proj model): 19.86 on 19 and 216 DF, p-value: < 2.2e-16
#coef_df <- coeftest(felm.04,vcov. = vcovHC(felm.04,type = "HC1"))
#coef_df <- coef_df[,]%>%as_tibble()%>%mutate(variables=rownames(coef_df))
coef_df <- tidy(felm.04)[6:19,]
## Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
## rank-deficient or indefinite
event_df <- data.frame(time = 1:nrow(coef_df),
coef = coef_df$estimate,
se = coef_df$std.error)
event_df<-rbind(event_df,c("time"=3.5,"coef"=0,"se"=0))
event_df<-arrange(event_df,time)
# Calculate confidence intervals
event_df$ci_upper <- event_df$coef + 1.96 * event_df$se
event_df$ci_lower <- event_df$coef - 1.96 * event_df$se
# Extract dates from row names of coef_df
##dates <- as.Date(paste0(row.names(coef_df),"0101"), format = "treat:YEAR%Y%m%d")
dates<-seq.Date(from = as.Date("2001-01-01"),as.Date("2015-01-01"),by="year")
# Define start and end dates for plot
start_date <- as.Date("2001-01-01")
end_date <- as.Date("2015-01-01")
# Create sequence of dates for x-axis
dates_seq <- seq(from = start_date, to = end_date, by = "year")
# Subset event_df to only include dates after or equal to start_date
event_df_sub <- event_df[dates >= start_date, ]
pl<-ggplot(event_df, aes(x = dates, y = coef)) +
geom_point() +geom_line()+
#geom_errorbar(aes(ymin = ci_lower, ymax = ci_upper), width = 0.2) +
geom_ribbon(aes(ymin = ci_lower, ymax = ci_upper), alpha = 0.2) +
geom_hline(yintercept = 0, linetype = "dashed", color = "red") +
geom_vline(xintercept = as.Date("2005-01-01"), linetype = "dashed", color = "blue") +
scale_x_date(date_labels = "%Y", limits = c(start_date, end_date), breaks = "1 year") +
labs(x = "Year", y = "Coefficient")+ #title = "Fixed effect of RENT_4") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+theme_bw()
pl
