rm(list=ls())
library(stargazer)
library(plyr)
library(lfe)
library(zoo)
library(scales)
library(rdrobust)
library(data.table)
library(ggplot2)
library(dplyr)

note =c("Fixed Effects: census tract, listing month, ownership cohort","Standard Errors clustered by census tract")
output.type="text"
printtable <- function(reg,column.labels,note,lines) {
  stargazer(reg,type=output.type,no.space = TRUE,omit.stat = c("f","rsq","ser"),notes= note,column.labels = column.labels, dep.var.labels = "",dep.var.labels.include = FALSE,add.lines = lines)
}


zdata <- readRDS(file="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Projects/Sunk Cost/Processed Data/zillow_ztrax_Mar2019_5.rds")
zdata[,Selling_premium:=zdata$sales_price/zdata$adj_purch_price]
zdata[,Renter_fraction:=zdata$renters/zdata$totalpopulation]
zdata[,Purchase_price:=SalesPriceAmount_prev]
zdata[,Listing_price:=listing_amount]
zdata[,Selling_price:=sales_price]
zdata[,Listing_premium:=list_premium]
zdata[,Property_tax_last_year:=prop_tax_prev_year]
zdata[,Property_tax_rate_last_year:=prop_tax_rate]

zdata_reg <- zdata[zdata$ListingYear>2013 & zdata$Listing_premium<1.5 & zdata$Listing_premium>0.8 & zdata$ownership_years>=2 & zdata$house_age>0 ]
zdata_reg[,ownership_cohort:=ntile(zdata_reg$ownership_years,10)]
zdata_reg[,Time_on_market:=as.numeric(zdata_reg$sale_date)-as.numeric(zdata_reg$listed_date)+1]


mtg30 <- read.csv(file="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Projects/Sunk Cost/Processed Data/MORTGAGE30US.csv",stringsAsFactors = FALSE)
names(mtg30)[1] = "PurchaseMonth"
mtg30$PurchaseMonth <- as.Date(mtg30$PurchaseMonth)

zdata_reg <- merge(zdata_reg,mtg30,by="PurchaseMonth",all.x = TRUE)
zdata_reg <- data.table(mutate(zdata_reg,min_asmt=pmin(assesment_2007,assesment_2008,assesment_2009,assesment_2010,assesment_2011,assesment_2012,na.rm = TRUE)))
zdata_reg[,affected_by_prop_8_2:=ifelse(zdata_reg$min_asmt>0 & !is.na(zdata_reg$min_asmt) & zdata_reg$PurchaseYear<2007 & zdata_reg$min_asmt<zdata_reg$Purchase_price,1,0)]

zdata_reg[,zip_list_month:=paste(zdata_reg$zip,zdata_reg$ListingMonth)]
zdata_reg[,tract_list_month:=paste(zdata_reg$GEOID,zdata_reg$ListingMonth)]
zdata_reg[,zip_sale_month:=sapply(zdata_reg$sale_date,function(x) substr(x,1,7))]
zdata_reg[,zip_sale_month:=paste(zdata_reg$zip,zdata_reg$zip_sale_month)]

zdata_reg[,Tax_rate:=zdata_reg$prop_tax_rate]
zdata_reg[,Ownership_years:=zdata_reg$ownership_years]
zdata_reg[,Adj_purch_price:=zdata_reg$adj_purch_price]
zdata_reg[,Bedrooms:=zdata_reg$beds]
zdata_reg[,Bathrooms:=zdata_reg$baths]
zdata_reg[,HPI_purchase:=zdata_reg$purchase_hpi]

zdata_reg[,nominal_loss:=ifelse(zdata_reg$purchase_hpi>zdata_reg$listing_hpi,zdata_reg$Purchase_price-zdata_reg$Adj_purch_price,1)]
zdata_reg[,nominal_gain:=ifelse(zdata_reg$purchase_hpi<zdata_reg$listing_hpi,zdata_reg$Adj_purch_price-zdata_reg$Purchase_price,1)]

zdata_reg[,purchase_time_cat:=as.factor(ifelse(zdata_reg$PurchaseYear<2008,"<2008",ifelse(zdata_reg$PurchaseYear<2012,"2008-2011",">2011")))]

zdata_reg[,discount:=(zdata_reg$listing_amount-zdata_reg$sales_price)/zdata_reg$listing_amount]

zdata_reg[,zip_purch_year_list_year:=paste(zdata_reg$zip,zdata_reg$purchase_list_year)]
zdata_reg[,county:=sapply(zdata_reg$GEOID,function(x) substr(x,1,5))]
zdata_reg[,county_purch_year_list_year:=paste(zdata_reg$county,zdata_reg$purchase_list_year)]
zdata_reg[,purchase_month_no:=as.numeric(format(zdata_reg$PurchaseMonth,"%m"))]

1 Table 1: Descriptive Statistics

stargazer(zdata_reg[zdata_reg$PurchaseYear<2008,c("Purchase_price","adj_purch_price","Listing_price","Listing_premium",
                       "Selling_premium","Property_tax_last_year","Property_tax_rate_last_year",
                       "affected_by_prop_8","purchase_hpi","hpi_inflation","ownership_years",
                       "beds","baths","sqft","LotSizeSquareFeet","house_age","LTV_prev",
                       "avg_school_rating","avg_school_distance","totalpopulation","medianage","medianhouseholdincome","Renter_fraction")],type=output.type,summary.stat = c("mean","sd","p25","median","p75","n"),digits = 4)
## 
## ===================================================================================================
## Statistic                       Mean       St. Dev.     Pctl(25)      Median      Pctl(75)     N   
## ---------------------------------------------------------------------------------------------------
## Purchase_price              510,230.6000 466,700.4000   253,500      403,500      627,000    22,487
## adj_purch_price             675,184.2000 636,420.8000 352,604.0000 528,036.0000 788,393.6000 22,487
## Listing_price               714,460.2000 665,120.6000   379,000      559,000      819,000    22,487
## Listing_premium                1.0735       0.1506       0.9643       1.0497       1.1596    22,487
## Selling_premium                1.0544       1.0508       0.9403       1.0211       1.1227    22,487
## Property_tax_last_year       6,228.2170   5,428.6750   3,236.0000   5,012.0000   7,515.7400  22,487
## Property_tax_rate_last_year    0.0097       0.0029       0.0079       0.0096       0.0112    22,487
## affected_by_prop_8             0.4608       0.4985       0.0000       0.0000       1.0000    22,026
## purchase_hpi                433,884.9000 278,683.8000   242,300      380,200      559,400    22,487
## hpi_inflation                  1.4539       0.6303       0.9907       1.2514       1.7566    22,487
## ownership_years               12.6099       2.8492         11           12           14      22,487
## beds                           3.4247       0.8780       3.0000       3.0000       4.0000    22,484
## baths                          2.5144       1.0439       2.0000       2.0000       3.0000    22,394
## sqft                         2,030.6010    895.3042    1,413.0000   1,829.0000   2,442.0000  22,460
## LotSizeSquareFeet           17,299.9000  135,446.4000  5,600.0000   7,196.0000  10,018.0000  21,291
## house_age                     38.1602      22.9571         18           33           55      22,487
## LTV_prev                       0.6190       0.3554       0.4642       0.7812       0.8000    22,458
## avg_school_rating              6.9516       2.0253       5.3333       7.3333       8.6667    22,463
## avg_school_distance            1.4524       1.2997       0.8000       1.1667       1.7000    22,469
## totalpopulation              5,881.6000   2,976.9320   4,081.0000   5,366.0000   6,801.0000  22,479
## medianage                     40.3807       7.9782      34.7000      39.5000      45.1000    22,477
## medianhouseholdincome       82,688.1500  32,702.6400  58,540.5000  77,292.0000  101,590.0000 22,476
## Renter_fraction                0.3200       0.1710       0.1895       0.2912       0.4278    22,477
## ---------------------------------------------------------------------------------------------------
CA_all <- readRDS(file="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Projects/Sunk Cost/Processed Data/perv_transactions/CA_prev_transaction_merged_2.rds")
CA_all[,House_age:=CA_all$Sale_year-CA_all$YearBuilt]
CA_all[,nominal_loss:=ifelse(CA_all$HPI_purchase>CA_all$HPI_sale,CA_all$Purchase_price-CA_all$Adj_purch_price,1)]
CA_all[,zip_sale_month:=paste(CA_all$zip,CA_all$Sale_month)]
CA_all[,Sale_price:=CA_all$SalesPriceAmount_sale]
IL <- readRDS(file="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Projects/Sunk Cost/Processed Data/perv_transactions/IL_prev_transaction_merged.rds")
NY <- readRDS(file="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Projects/Sunk Cost/Processed Data/perv_transactions/NY_prev_transaction_merged.rds")

prev_trans <- rbind(IL,NY)
prev_trans[,House_age:=prev_trans$Sale_year-prev_trans$YearBuilt]
prev_trans[,Sale_price:=prev_trans$SalesPriceAmount_sale]
prev_trans[,State:=sapply(prev_trans$FIPS, function(x) substr(as.character(x),1,nchar(x)-3))]

prev_trans[,zip_sale_month:=paste(prev_trans$zip,prev_trans$Sale_month)]

prev_trans[,nominal_loss:=ifelse(prev_trans$HPI_purchase>prev_trans$HPI_sale,prev_trans$Purchase_price-prev_trans$Adj_purch_price,1)]

rm(list=c("IL","AZ","NV","OR","FL","NY"))
CA <- readRDS(file="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Projects/Sunk Cost/Processed Data/all_homes_prev/CA_all_homes_prev.rds")
IL <- readRDS(file="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Projects/Sunk Cost/Processed Data/all_homes_prev/IL_all_homes_prev.rds")
NY <- readRDS(file="C:/Users/dratnadiwakara2/Documents/OneDrive - Louisiana State University/Projects/Sunk Cost/Processed Data/all_homes_prev/NY_all_homes_prev.rds")


all_homes_prev <- rbind(CA,IL)
# all_homes_prev <- rbind(all_homes_prev,IL)
all_homes_prev <- rbind(all_homes_prev,NY)
all_homes_prev[,Ownership_years:=2016-all_homes_prev$Purchase_year]
all_homes_prev <- all_homes_prev[all_homes_prev$Ownership_years>2]

all_homes_prev[,tax_rate_2014:=all_homes_prev$tax_2014/all_homes_prev$Adj_purch_price]
all_homes_prev[,tax_rate_2015:=all_homes_prev$tax_2015/all_homes_prev$Adj_purch_price]
all_homes_prev[,tax_rate_2016:=all_homes_prev$tax_2016/all_homes_prev$Adj_purch_price]
all_homes_prev<-all_homes_prev[(all_homes_prev$tax_rate_2015>0 & all_homes_prev$tax_rate_2015<0.1) | (all_homes_prev$tax_rate_2016>0 & all_homes_prev$tax_rate_2016<0.1)| (all_homes_prev$tax_rate_2014>0 & all_homes_prev$tax_rate_2014<0.1)]

all_homes_prev[,nominal_loss:=ifelse(all_homes_prev$HPI_purchase>all_homes_prev$HPI_asmt,all_homes_prev$SalesPriceAmount-all_homes_prev$Adj_purch_price,1)]

all_homes_prev[,House_age:=2016-all_homes_prev$YearBuilt]

rm(list=c("IL","AZ","NV","OR","FL","NY"))

1.1 Table 2: Effect of Years of ownership on Property tax rate (Regression)

Sample: All homes in CA, IL, and NY for which purchase transaction details and property tax amount paid in 2016 (or 2014 for IL) are available and purchase year is less than 2008. Intra-family transfers and forclosure sales were excluded.

all_homes_prev[,tax_rate:=ifelse(all_homes_prev$State %in% c("CA","NY"),all_homes_prev$tax_rate_2016,ifelse(all_homes_prev$State=="AZ",all_homes_prev$tax_rate_2015,ifelse(all_homes_prev$State %in% c("IL"),all_homes_prev$tax_rate_2014,NA)))]

regs <- list()
regs[[1]] <- felm(as.formula(paste("I(tax_rate*100)~Ownership_years+log(Adj_purch_price)+log(nominal_loss)+Bedrooms+Bathrooms+log(House_age)|zip|0|zip")),data=all_homes_prev[all_homes_prev$State=="CA" & all_homes_prev$Purchase_year<2008 & all_homes_prev$House_age>0])
regs[[2]] <- felm(as.formula(paste("I(tax_rate*100)~Ownership_years+log(Adj_purch_price)+log(nominal_loss)+Bedrooms+Bathrooms+log(House_age)|zip|0|zip")),data=all_homes_prev[all_homes_prev$State=="IL" & all_homes_prev$Purchase_year<2008])
regs[[3]] <- felm(as.formula(paste("I(tax_rate*100)~Ownership_years+log(Adj_purch_price)+log(nominal_loss)+log(House_age)|zip|0|zip")),data=all_homes_prev[all_homes_prev$State=="NY" & all_homes_prev$Purchase_year<2008 ])

printtable(regs,column.labels = c("CA","IL","NY"),note="",
           lines=list(c("FE:","Zip","Zip","Zip"),c("Cluster:","Zip","Zip","Zip")))
## 
## ==================================================
##                           Dependent variable:     
##                      -----------------------------
##                         CA        IL        NY    
##                         (1)       (2)       (3)   
## --------------------------------------------------
## Ownership_years      -0.053***   0.004    -0.002  
##                       (0.001)   (0.002)   (0.002) 
## log(Adj_purch_price) -0.621*** -0.183*** -0.665***
##                       (0.017)   (0.030)   (0.051) 
## log(nominal_loss)     -0.0003    0.001    0.002*  
##                       (0.001)   (0.001)   (0.001) 
## Bedrooms             0.025***    0.006            
##                       (0.002)   (0.010)           
## Bathrooms            0.069***  0.260***           
##                       (0.003)   (0.015)           
## log(House_age)       -0.203*** -0.079*** -0.250***
##                       (0.010)   (0.015)   (0.024) 
## --------------------------------------------------
## FE:                     Zip       Zip       Zip   
## Cluster:                Zip       Zip       Zip   
## Observations         1,722,228  532,796   99,191  
## Adjusted R2            0.359     0.444     0.232  
## ==================================================
## Note:                  *p<0.1; **p<0.05; ***p<0.01
## 

1.2 Table 3: First Stage: Effect of Years of Ownership on Tax Rate

Using zillow sample.

regs <- list()

controls = "log(adj_purch_price)+log(nominal_loss)+beds+baths+log(sqft)+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev"
fe = "|zip_list_month|"
cluster = "|zip"
instruments = "ownership_years" #
endo_var = "Property_tax_rate_last_year"



regs <- list()
regs[[1]] <- felm(as.formula(paste("I(prop_tax_rate*100)~ownership_years+",controls,fe,"0",cluster,sep="")),data=zdata_reg[zdata_reg$PurchaseYear<2008 ])
regs[[2]] <- felm(as.formula(paste("I(prop_tax_rate*100)~ownership_years+",controls,"+medianage+log(medianhouseholdincome)+Renter_fraction",fe,"0",cluster,sep="")),data=zdata_reg[zdata_reg$PurchaseYear<2008 ])
regs[[3]] <- felm(as.formula(paste("I(prop_tax_rate*100)~ownership_years+",controls,"|tract_list_month|","0",cluster,sep="")),data=zdata_reg[zdata_reg$PurchaseYear<2008 ])

printtable(regs,column.labels = c("1996-2007", "1996-2007","1996-2007","All"),note="",
           lines=list(c("FE:","Zip x Month","Zip x Month","Tract x Month","Zip x Sale Month"),c("Cluster:","Zip","Zip","Zip","Zip")))
## 
## ================================================================
##                                     Dependent variable:         
##                            -------------------------------------
##                             1996-2007   1996-2007    1996-2007  
##                                (1)         (2)          (3)     
## ----------------------------------------------------------------
## ownership_years             -0.054***   -0.054***    -0.052***  
##                              (0.001)     (0.001)      (0.003)   
## log(adj_purch_price)        -0.286***   -0.299***    -0.416***  
##                              (0.017)     (0.018)      (0.060)   
## log(nominal_loss)           -0.002**    -0.002**      -0.002    
##                              (0.001)     (0.001)      (0.002)   
## beds                        0.029***    0.030***       0.025    
##                              (0.004)     (0.004)      (0.016)   
## baths                        0.010*      0.010*       0.028*    
##                              (0.006)     (0.006)      (0.014)   
## log(sqft)                   0.089***    0.089***       0.127    
##                              (0.017)     (0.017)      (0.080)   
## avg_school_rating           0.016***    0.011***       0.022    
##                              (0.003)     (0.003)      (0.019)   
## avg_school_distance          0.008*      0.008**       0.006    
##                              (0.004)     (0.004)      (0.019)   
## walk_score                 -0.0004***    -0.0001      -0.0003   
##                             (0.0001)    (0.0001)      (0.001)   
## log(house_age)              -0.096***   -0.094***    -0.111***  
##                              (0.008)     (0.008)      (0.029)   
## log(LotSizeSquareFeet)       0.013**    0.013***       0.023    
##                              (0.005)     (0.005)      (0.022)   
## LTV_prev                    0.027***    0.026***       0.025    
##                              (0.007)     (0.006)      (0.024)   
## medianage                                 0.001                 
##                                          (0.001)                
## log(medianhouseholdincome)              0.099***                
##                                          (0.016)                
## Renter_fraction                          0.066**                
##                                          (0.031)                
## ----------------------------------------------------------------
## FE:                        Zip x Month Zip x Month Tract x Month
## Cluster:                       Zip         Zip          Zip     
## Observations                 20,367      20,360       20,367    
## Adjusted R2                   0.590       0.593        0.607    
## ================================================================
## Note:                                *p<0.1; **p<0.05; ***p<0.01
## 

1.3 Table 4: Panel A : Direct impact of Z (Years of Ownership) on Y (Quality): ZTRAX Data

This table is based on ZTRAX data. Samples consists of all homes sold in 2015 and 2016 and purchased before 2008. Sample is restricted to the homes for which both the sale details and purchase details are available. Intra-family transfers and foreclosure sales were excluded. If ‘years of ownership’ has a negative direct impact on the quality of the home we should see negative and significant coefficients for IL and NY. FL and TX were exceluded due to property tax system in FL is similar to CA and unavailability of transaction prices respectively.

To address ‘Ref 1: Comment 2’, the table was split in to two panels. Panel A uses data from IL and NY no restriction on year of purchase. Panel B illustrate the same point using CA data for 2009 to 2012 period. This period for CA was choosen since the house prices were stable during this period, we can isolate the direct effect of ownership years.

regs <- list()
regs[[1]] <- felm(as.formula(paste("log(Sale_price)~Ownership_years+","log(Adj_purch_price)+log(nominal_loss)+Bedrooms+Bathrooms+log(House_age)+BuildingAreaSqFt","|zip_sale_month|","0","|zip",sep="")),data=prev_trans[prev_trans$State %in% c("17") & House_age>0 & Ownership_years>=2 ])
regs[[2]] <- felm(as.formula(paste("log(Sale_price)~Ownership_years+","log(Adj_purch_price)+log(nominal_loss)+Bedrooms+Bathrooms+log(House_age)+BuildingAreaSqFt","|zip_sale_month|","0","|zip",sep="")),data=prev_trans[prev_trans$State=="36" & House_age>0 & Ownership_years>=2])


printtable(regs,column.labels = c("IL","NY"),note="",
           lines=list(c("FE:","Zip x Month","Zip x Month","Zip x Month","Zip x Sale Month"),c("Cluster:","Zip","Zip","Zip","Zip")))
## 
## =================================================
##                          Dependent variable:     
##                      ----------------------------
##                            IL            NY      
##                           (1)            (2)     
## -------------------------------------------------
## Ownership_years         -0.0004        -0.001    
##                         (0.001)        (0.002)   
## log(Adj_purch_price)    0.435***      0.058***   
##                         (0.040)        (0.004)   
## log(nominal_loss)      -0.002***       -0.0003   
##                         (0.001)        (0.003)   
## Bedrooms                 0.005        0.052***   
##                         (0.007)        (0.011)   
## Bathrooms               0.058***      0.186***   
##                         (0.019)        (0.015)   
## log(House_age)         -0.045***      -0.139***  
##                         (0.009)        (0.013)   
## BuildingAreaSqFt       0.0002***      0.0001***  
##                         (0.0001)      (0.00002)  
## -------------------------------------------------
## FE:                   Zip x Month    Zip x Month 
## Cluster:                  Zip            Zip     
## Observations            132,814        278,266   
## Adjusted R2              0.771          0.234    
## =================================================
## Note:                 *p<0.1; **p<0.05; ***p<0.01
## 

1.4 Table 4: Panel B: Direct impact of Z (Years of Ownership) on Y (List Price) CA (2009-2012): Zillow Sample

For the homes purchased between 2009 and 2012, there is no variation in the property tax rate in 2016. Therefore column (2) captures the direct impact of ‘years of ownership’ on listing price.

regs <- list()

controls = "log(adj_purch_price)+log(nominal_loss)+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev"
fe = "|zip_list_month|"
cluster = "|zip"
instruments = "ownership_years" #
endo_var = "Property_tax_rate_last_year"



regs <- list()
regs[[1]] <- felm(as.formula(paste("log(Listing_price)~ownership_years+",controls,fe,"0",cluster,sep="")),data=zdata_reg[zdata_reg$PurchaseMonth>="2009-04-01" & zdata_reg$PurchaseMonth<="2012-09-01"])
regs[[2]] <- felm(as.formula(paste("log(SalesPriceAmount_sale)~Ownership_years+","log(Adj_purch_price)+log(nominal_loss)+Bedrooms+Bathrooms+log(House_age)+BuildingAreaSqFt","|zip_sale_month|","0","|zip",sep="")),data=CA_all[CA_all$Purchase_year>2008 &  CA_all$Purchase_year<2013 & CA_all$Sale_year>2015 & CA_all$House_age>1 ])

printtable(regs,column.labels = c("log(Listing price)","log(Sales price)"),note="",
           lines=list(c("FE:","Zip x Month","Zip x Month","Zip x Month","Zip x Sale Month"),c("Cluster:","Zip","Zip","Zip","Zip")))
## 
## ==========================================================
##                                Dependent variable:        
##                        -----------------------------------
##                        log(Listing price) log(Sales price)
##                               (1)               (2)       
## ----------------------------------------------------------
## ownership_years             0.003**                       
##                             (0.001)                       
## log(adj_purch_price)        0.625***                      
##                             (0.017)                       
## Ownership_years                                0.002      
##                                               (0.002)     
## log(Adj_purch_price)                          0.436***    
##                                               (0.021)     
## log(nominal_loss)            0.013             -0.005     
##                             (0.009)           (0.010)     
## beds                         0.003                        
##                             (0.004)                       
## baths                       0.022***                      
##                             (0.005)                       
## sqft                       0.0001***                      
##                            (0.00001)                      
## avg_school_rating           0.006***                      
##                             (0.002)                       
## avg_school_distance          0.001                        
##                             (0.002)                       
## walk_score                  -0.00001                      
##                             (0.0001)                      
## log(house_age)              0.025***                      
##                             (0.004)                       
## log(LotSizeSquareFeet)      0.031***                      
##                             (0.004)                       
## LTV_prev                    -0.015**                      
##                             (0.006)                       
## Bedrooms                                      0.018***    
##                                               (0.005)     
## Bathrooms                                      0.012*     
##                                               (0.007)     
## log(House_age)                                0.018***    
##                                               (0.006)     
## BuildingAreaSqFt                             0.0002***    
##                                              (0.00001)    
## ----------------------------------------------------------
## FE:                       Zip x Month       Zip x Month   
## Cluster:                      Zip               Zip       
## Observations                 13,190            24,355     
## Adjusted R2                  0.977             0.828      
## ==========================================================
## Note:                          *p<0.1; **p<0.05; ***p<0.01
## 

2 Table 5: Effect on Listing price (Sample: Homes purchased before 2008)

controls = "log(adj_purch_price)+log(1+gainloss)*gain+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev+medianage+log(medianhouseholdincome)+Renter_fraction"
fe = "|zip_list_month|"
cluster = "|zip"
instruments = "ownership_years" #
endo_var = "Property_tax_rate_last_year"

zd <- zdata_reg[zdata_reg$PurchaseYear<2008]
zd[,proptaxratebin:=ntile(Property_tax_rate_last_year,10)]
zd[,total_taxes_paid:=prop_tax_prev_year*ownership_years*0.9]
zd[,proptaxamountbin:=ntile(total_taxes_paid,10)]
zd <- zd[,gainloss:=abs(adj_purch_price-Purchase_price)]
zd <- zd[,gain:=ifelse(adj_purch_price>Purchase_price,1,0)]

2.1 Main Results

Added an additional column (1) to show that listing price increases monotonically with property tax rate. Bins are based on property tax rate deciles.

Perhaps we can add a figure showing the monotonic relationship?

Added census tract level controls to address ‘Ref 1: Comment 1 (c)’.
Added the difference between purchase price and adjusted purchase price interacted with a dummy indicating whether the seller is likely to sell for a gain or a loss instead of nominal loss.

regs <- list()
regs[[1]] <- felm(as.formula(paste("log(Listing_price)~factor(proptaxratebin)+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[2]] <- felm(as.formula(paste("log(Listing_price)~Property_tax_rate_last_year+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[3]] <- felm(as.formula(paste("log(Listing_price)~",controls,fe,"(",endo_var,"~",instruments,")",cluster,sep="")),data=zd)
regs[[4]] <- felm(as.formula(paste("log(Listing_price)~",controls,"|tract_list_month|","(",endo_var,"~",instruments,")","|GEOID",sep="")),data=zd)


condf <- list(
  c("Cond. F. Stat","","",round(condfstat(regs[[3]])[[1]],2),round(condfstat(regs[[4]])[[1]],2)),
  c("Fixed Effects","Zip X Month","Zip x Month","Zip x Month","Tract X Month"),
  c("Cluster","Zip","Zip","zip","Tract")
  )

.coef_plot_1reg(regs[[1]],"factor(proptaxratebin)",1)+labs(y="Coefficient on Tax Rate Decile",x="Tax Rate Decile")

printtable(regs,column.labels = c("OLS","OLS","IV","IV","IV"),note="",lines=condf)
## 
## ====================================================================================
##                                                   Dependent variable:               
##                                    -------------------------------------------------
##                                        OLS         OLS         IV           IV      
##                                        (1)         (2)         (3)          (4)     
## ------------------------------------------------------------------------------------
## factor(proptaxratebin)2              0.009**                                        
##                                      (0.005)                                        
## factor(proptaxratebin)3             0.015***                                        
##                                      (0.005)                                        
## factor(proptaxratebin)4             0.025***                                        
##                                      (0.005)                                        
## factor(proptaxratebin)5             0.038***                                        
##                                      (0.005)                                        
## factor(proptaxratebin)6             0.049***                                        
##                                      (0.005)                                        
## factor(proptaxratebin)7             0.053***                                        
##                                      (0.005)                                        
## factor(proptaxratebin)8             0.076***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)9             0.096***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)10            0.125***                                        
##                                      (0.007)                                        
## Property_tax_rate_last_year                     11.855***                           
##                                                  (0.674)                            
## log(adj_purch_price)                0.639***    0.634***    0.616***     0.582***   
##                                      (0.014)     (0.014)     (0.015)      (0.021)   
## log(1 + gainloss)                   0.012***    0.012***    0.012***     0.013***   
##                                      (0.002)     (0.002)     (0.002)      (0.003)   
## gain                                 0.067**    0.088***    0.146***     0.129***   
##                                      (0.029)     (0.028)     (0.032)      (0.043)   
## beds                                 0.0003       0.001       0.002        0.004    
##                                      (0.002)     (0.002)     (0.002)      (0.003)   
## baths                                 0.003       0.003       0.003        0.001    
##                                      (0.002)     (0.002)     (0.002)      (0.004)   
## sqft                                0.0001***   0.0001***   0.0001***    0.0001***  
##                                     (0.00000)   (0.00000)   (0.00001)    (0.00001)  
## avg_school_rating                   0.007***    0.008***    0.009***      0.010**   
##                                      (0.002)     (0.002)     (0.002)      (0.004)   
## avg_school_distance                  -0.002      -0.002      -0.002        0.007    
##                                      (0.002)     (0.002)     (0.002)      (0.004)   
## walk_score                         -0.0002***  -0.0002***  -0.0002***    -0.001***  
##                                     (0.0001)    (0.0001)    (0.0001)     (0.0002)   
## log(house_age)                      0.015***    0.013***     0.008*       -0.002    
##                                      (0.004)     (0.004)     (0.004)      (0.006)   
## log(LotSizeSquareFeet)              0.029***    0.029***    0.029***     0.033***   
##                                      (0.004)     (0.004)     (0.004)      (0.006)   
## LTV_prev                            -0.011***   -0.013***   -0.012***    -0.011**   
##                                      (0.004)     (0.004)     (0.004)      (0.005)   
## medianage                           0.001***    0.001***    0.001***                
##                                     (0.0003)    (0.0003)    (0.0003)      (0.000)   
## log(medianhouseholdincome)          0.031***    0.032***    0.038***                
##                                      (0.008)     (0.008)     (0.009)      (0.000)   
## Renter_fraction                       0.018       0.019       0.022                 
##                                      (0.014)     (0.014)     (0.014)      (0.000)   
## log(1 + gainloss):gain              -0.007***   -0.009***   -0.015***    -0.013***  
##                                      (0.003)     (0.003)     (0.003)      (0.004)   
## `Property_tax_rate_last_year(fit)`                          6.441***     9.967***   
##                                                              (1.402)      (2.389)   
## ------------------------------------------------------------------------------------
## Cond. F. Stat                                                 91.68        33.55    
## Fixed Effects                      Zip X Month Zip x Month Zip x Month Tract X Month
## Cluster                                Zip         Zip         zip         Tract    
## Observations                         20,360      20,360      20,360       20,360    
## Adjusted R2                           0.972       0.972       0.972        0.975    
## ====================================================================================
## Note:                                                    *p<0.1; **p<0.05; ***p<0.01
## 

2.2 Ref 1: Comment 1 (a)

“It is not immediately apparent that the effective tax rate in the year before the listing is the appropriate proxy for tax-related sunk costs. It would seem that the total property taxes paid until the sale of the house is a better measure of sunk cost. Nonetheless, the authors do find that property taxes paid in the most recent year is positively associated with the listing price. Do we interpret the results as being driven by”salient" sunk costs? Can you repeat the tests with total taxes paid as the main independent variable? In any case, further analysis, or some discussion to clarify this issue would be helpful"

Using property taxes since purchase could be problematic for the IV. For example take two identical homes purchased in 2003 (individual A) and 2005 (individual B) in the same neighborhood. If the house prices were increasing between 2003 and 2005, the annual tax paid by the individual B would be higher than individual A. If both the homes were sold in 2016, the total taxes paid by both the individuals A and B could be the same since individual A paid a lower amount for longer period and B paid a higher amount for a shorter period. It could even be that A paid a higher amount of taxes compared B. So the instrument, ownership years, would not satisfy the monotoncity assumption. However, we ran the OLS with the estimated total taxes paid since purchase as the main variable of interest.

regs <- list()
regs[[1]] <- felm(as.formula(paste("log(Listing_price)~log(total_taxes_paid)+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[2]] <- felm(as.formula(paste("log(Listing_price)~log(total_taxes_paid)+",controls,"|tract_list_month|","0",cluster,sep="")),data=zd)
regs[[3]] <- felm(as.formula(paste("log(Listing_price)~factor(proptaxamountbin)+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[4]] <- felm(as.formula(paste("log(Listing_price)~factor(proptaxamountbin)+",controls,"|tract_list_month|","0",cluster,sep="")),data=zd)


condf <- list(
  c("Cond. F. Stat",""),
  c("Fixed Effects","Zip X Month","Tract X Month","Zip x Month","Tract X Month"),
  c("Cluster","Zip","Tract","zip","Tract")
  )
printtable(regs,column.labels = c("OLS","OLS","OLS","OLS"),note="",lines=condf)
## 
## ==============================================================================
##                                            Dependent variable:                
##                            ---------------------------------------------------
##                                OLS          OLS          OLS          OLS     
##                                (1)          (2)          (3)          (4)     
## ------------------------------------------------------------------------------
## log(total_taxes_paid)       0.070***     0.064***                             
##                              (0.006)      (0.018)                             
## factor(proptaxamountbin)2                             0.030***       0.022    
##                                                        (0.005)      (0.019)   
## factor(proptaxamountbin)3                             0.041***       0.025    
##                                                        (0.006)      (0.021)   
## factor(proptaxamountbin)4                             0.057***      0.044**   
##                                                        (0.006)      (0.022)   
## factor(proptaxamountbin)5                             0.056***      0.046**   
##                                                        (0.007)      (0.023)   
## factor(proptaxamountbin)6                             0.060***      0.047**   
##                                                        (0.007)      (0.024)   
## factor(proptaxamountbin)7                             0.064***      0.061**   
##                                                        (0.008)      (0.026)   
## factor(proptaxamountbin)8                             0.065***      0.057**   
##                                                        (0.008)      (0.029)   
## factor(proptaxamountbin)9                             0.094***      0.082**   
##                                                        (0.010)      (0.033)   
## factor(proptaxamountbin)10                            0.139***     0.119***   
##                                                        (0.012)      (0.040)   
## log(adj_purch_price)        0.548***     0.500***     0.561***     0.510***   
##                              (0.014)      (0.043)      (0.014)      (0.044)   
## log(1 + gainloss)           0.014***      0.015**     0.014***      0.015**   
##                              (0.002)      (0.007)      (0.002)      (0.007)   
## gain                        0.227***     0.240***     0.234***     0.244***   
##                              (0.029)      (0.089)      (0.029)      (0.089)   
## beds                          0.001        0.004        0.002        0.005    
##                              (0.002)      (0.008)      (0.002)      (0.008)   
## baths                         0.002       0.0003        0.002       -0.001    
##                              (0.002)      (0.008)      (0.002)      (0.008)   
## sqft                        0.0001***    0.0001***    0.0001***    0.0001***  
##                             (0.00000)    (0.00002)    (0.00000)    (0.00002)  
## avg_school_rating           0.008***       0.012      0.009***       0.012    
##                              (0.002)      (0.010)      (0.002)      (0.009)   
## avg_school_distance          -0.001        0.007       -0.001        0.007    
##                              (0.002)      (0.010)      (0.002)      (0.010)   
## walk_score                 -0.0002***     -0.001     -0.0002***     -0.001    
##                             (0.0001)     (0.0004)     (0.0001)     (0.0004)   
## log(house_age)               0.007*       -0.008        0.005       -0.009    
##                              (0.004)      (0.014)      (0.004)      (0.014)   
## log(LotSizeSquareFeet)      0.029***      0.033**     0.029***      0.033**   
##                              (0.004)      (0.015)      (0.004)      (0.015)   
## LTV_prev                    -0.015***     -0.013      -0.013***     -0.011    
##                              (0.004)      (0.012)      (0.004)      (0.013)   
## medianage                   0.002***                  0.002***                
##                             (0.0003)      (0.000)     (0.0003)      (0.000)   
## log(medianhouseholdincome)  0.037***                  0.040***                
##                              (0.009)      (0.000)      (0.009)      (0.000)   
## Renter_fraction               0.021                     0.022                 
##                              (0.015)      (0.000)      (0.015)      (0.000)   
## log(1 + gainloss):gain      -0.024***    -0.025***    -0.025***    -0.025***  
##                              (0.003)      (0.008)      (0.003)      (0.008)   
## ------------------------------------------------------------------------------
## Cond. F. Stat                                                                 
## Fixed Effects              Zip X Month Tract X Month Zip x Month Tract X Month
## Cluster                        Zip         Tract         zip         Tract    
## Observations                 20,360       20,360       20,360       20,360    
## Adjusted R2                   0.972        0.975        0.971        0.975    
## ==============================================================================
## Note:                                              *p<0.1; **p<0.05; ***p<0.01
## 

2.3 Ref 1: Comment 1 (b)

“Is it possible that the sunk cost driving the result is a function of the initial purchase price and not the effective tax rate? It seems that under proposition 13, an effective tax rate increase is determined by the price at which the house was purchased. So, a home that was purchased recently is likely to incur higher taxes compared to a similar house in the same neighborhood purchased earlier. To the extent that the effective tax rate and purchase price are positively correlated, it is difficult to disentangle the effect of tax rates and initial purchase price on listing price. So, an alternate interpretation for the paper’s main results could be that the initial purchase price drives the choice of the listing price. To fix ideas, again, let us compare two similar houses (A and B) in the same neighborhood currently listed for sale. House A was purchased three years ago at $400,000, while house B was purchased ten years ago at $300,000. Under proposition 13, house A is likely to attract higher property tax as well. If the listing price of A is higher than that of B, it could be driven by the seller A’s focus on higher taxes or higher purchase priceor a combination of both. In either case, the central message of the paper remains the same. However, it is worth spending a paragraph to clarify and discuss this issue. Alternatively, they can easily control for the initial purchase price in the regressions.”

Since we use zip code * year fixed effects, adding purchase price would absorb most of the variation in property tax rate due to differences in ownership year, and the instrument becomes weak. We show that OLS results are robust with the purchase price as a control variable.

regs <- list()
regs[[1]] <- felm(as.formula(paste("log(Listing_price)~Property_tax_rate_last_year+log(Purchase_price)+log(hpi_inflation)+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev+medianage+log(medianhouseholdincome)+Renter_fraction",fe,"0",cluster,sep="")),data=zd)
regs[[2]] <- felm(as.formula(paste("log(Listing_price)~Property_tax_rate_last_year+log(Purchase_price)+log(hpi_inflation)+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev+medianage+log(medianhouseholdincome)+Renter_fraction","|tract_list_month|","0","|GEOID",sep="")),data=zd)
regs[[3]] <- felm(as.formula(paste("log(Listing_price)~factor(proptaxratebin)+log(Purchase_price)+log(hpi_inflation)+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev+medianage+log(medianhouseholdincome)+Renter_fraction",fe,"0",cluster,sep="")),data=zd)
regs[[4]] <- felm(as.formula(paste("log(Listing_price)~factor(proptaxratebin)+log(Purchase_price)+log(hpi_inflation)+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev+medianage+log(medianhouseholdincome)+Renter_fraction","|tract_list_month|","0","|GEOID",sep="")),data=zd)


condf <- list(
  # c("Cond. F. Stat","","",round(condfstat(regs[[3]])[[1]],2),round(condfstat(regs[[4]])[[1]],2)),
  c("Fixed Effects","Zip X Month","Tract X Month","Zip x Month","Tract X Month"),
  c("Cluster","Zip","Tract","zip","Tract")
  )
printtable(regs,column.labels = c("OLS","OLS","OLS","OLS","IV"),note="",lines=condf)
## 
## ===============================================================================
##                                             Dependent variable:                
##                             ---------------------------------------------------
##                                 OLS          OLS          OLS          OLS     
##                                 (1)          (2)          (3)          (4)     
## -------------------------------------------------------------------------------
## Property_tax_rate_last_year  12.790***    11.467***                            
##                               (0.765)      (1.113)                             
## factor(proptaxratebin)2                                 0.010**       0.006    
##                                                         (0.005)      (0.008)   
## factor(proptaxratebin)3                                0.016***       0.013    
##                                                         (0.005)      (0.009)   
## factor(proptaxratebin)4                                0.027***     0.029***   
##                                                         (0.005)      (0.009)   
## factor(proptaxratebin)5                                0.041***     0.037***   
##                                                         (0.005)      (0.009)   
## factor(proptaxratebin)6                                0.052***     0.052***   
##                                                         (0.006)      (0.009)   
## factor(proptaxratebin)7                                0.057***     0.052***   
##                                                         (0.006)      (0.010)   
## factor(proptaxratebin)8                                0.080***     0.067***   
##                                                         (0.007)      (0.010)   
## factor(proptaxratebin)9                                0.101***     0.082***   
##                                                         (0.007)      (0.011)   
## factor(proptaxratebin)10                               0.133***     0.114***   
##                                                         (0.008)      (0.012)   
## log(Purchase_price)          0.639***     0.591***     0.646***     0.591***   
##                               (0.015)      (0.020)      (0.015)      (0.020)   
## log(hpi_inflation)           0.646***     0.590***     0.657***     0.591***   
##                               (0.015)      (0.022)      (0.015)      (0.022)   
## beds                           0.001        0.004       0.0001        0.003    
##                               (0.002)      (0.003)      (0.002)      (0.004)   
## baths                          0.003        0.002        0.003        0.001    
##                               (0.002)      (0.004)      (0.002)      (0.004)   
## sqft                         0.0001***    0.0001***    0.0001***    0.0001***  
##                              (0.00000)    (0.00001)    (0.00000)    (0.00001)  
## avg_school_rating            0.008***      0.009**     0.007***      0.008*    
##                               (0.002)      (0.004)      (0.002)      (0.004)   
## avg_school_distance           -0.002        0.006       -0.002        0.006    
##                               (0.002)      (0.005)      (0.002)      (0.005)   
## walk_score                   -0.0002**    -0.001***   -0.0002***    -0.001***  
##                              (0.0001)     (0.0002)     (0.0001)     (0.0002)   
## log(house_age)               0.012***      -0.002      0.014***      -0.002    
##                               (0.004)      (0.006)      (0.004)      (0.006)   
## log(LotSizeSquareFeet)       0.028***     0.032***     0.028***     0.032***   
##                               (0.004)      (0.006)      (0.004)      (0.006)   
## LTV_prev                     -0.015***    -0.013**     -0.013***    -0.011**   
##                               (0.004)      (0.005)      (0.004)      (0.005)   
## medianage                    0.001***                  0.001***                
##                              (0.0003)      (0.000)     (0.0003)      (0.000)   
## log(medianhouseholdincome)   0.032***                  0.031***                
##                               (0.008)      (0.000)      (0.008)      (0.000)   
## Renter_fraction                0.019                     0.018                 
##                               (0.015)      (0.000)      (0.014)      (0.000)   
## -------------------------------------------------------------------------------
## Fixed Effects               Zip X Month Tract X Month Zip x Month Tract X Month
## Cluster                         Zip         Tract         zip         Tract    
## Observations                  20,360       20,360       20,360       20,360    
## Adjusted R2                    0.972        0.975        0.972        0.975    
## ===============================================================================
## Note:                                               *p<0.1; **p<0.05; ***p<0.01
## 

2.4 Ref 1: Comment 4 (g)

“Are the baseline results robust to controlling for “purchase year” fixed effects?"

When we add purchase year fixed effects to the IV specification, it absorbs the variation in property tax due to ownership years and first stage is weak. OLS with purchase year fixed effects work

regs <- list()
regs[[1]] <- felm(as.formula(paste("log(Listing_price)~Property_tax_rate_last_year+",controls,"|zip_list_month+PurchaseYear|","0",cluster,sep="")),data=zd)
regs[[2]] <- felm(as.formula(paste("log(Listing_price)~Property_tax_rate_last_year+",controls,"|tract_list_month+PurchaseYear|","0","|GEOID",sep="")),data=zd)
regs[[3]] <- felm(as.formula(paste("log(Listing_price)~factor(proptaxratebin)+",controls,"|zip_list_month+PurchaseYear|","0",cluster,sep="")),data=zd)

regs[[4]] <- felm(as.formula(paste("log(Listing_price)~factor(proptaxratebin)+",controls,"|tract_list_month+PurchaseYear|","0","|GEOID",sep="")),data=zd)
condf <- list(
 # c("Cond. F. Stat","","",round(condfstat(regs[[3]])[[1]],2),round(condfstat(regs[[4]])[[1]],2)),
  c("Fixed Effects","Zip X Month, Prch. Yr","Tract x Month, Prch. Yr","Zip x Month, Prch. Yr","Tract X Month, Prch. Yr","Tract X Month"),
  c("Cluster","Zip","Tract","Zip","Tract","Tract")
  )
printtable(regs,column.labels = c("OLS","OLS","OLS","OLS","IV"),note="",lines=condf)
## 
## =======================================================================================================================
##                                                                 Dependent variable:                                    
##                             -------------------------------------------------------------------------------------------
##                                      OLS                    OLS                    OLS                    OLS          
##                                      (1)                    (2)                    (3)                    (4)          
## -----------------------------------------------------------------------------------------------------------------------
## Property_tax_rate_last_year       13.067***              11.414***                                                     
##                                    (0.751)                (1.083)                                                      
## factor(proptaxratebin)2                                                         0.014***                 0.006         
##                                                                                  (0.005)                (0.008)        
## factor(proptaxratebin)3                                                         0.023***                 0.012         
##                                                                                  (0.005)                (0.009)        
## factor(proptaxratebin)4                                                         0.036***               0.029***        
##                                                                                  (0.005)                (0.009)        
## factor(proptaxratebin)5                                                         0.050***               0.038***        
##                                                                                  (0.006)                (0.009)        
## factor(proptaxratebin)6                                                         0.062***               0.053***        
##                                                                                  (0.006)                (0.009)        
## factor(proptaxratebin)7                                                         0.067***               0.054***        
##                                                                                  (0.006)                (0.010)        
## factor(proptaxratebin)8                                                         0.090***               0.069***        
##                                                                                  (0.006)                (0.010)        
## factor(proptaxratebin)9                                                         0.110***               0.083***        
##                                                                                  (0.007)                (0.011)        
## factor(proptaxratebin)10                                                        0.140***               0.113***        
##                                                                                  (0.008)                (0.012)        
## log(adj_purch_price)              0.646***               0.597***               0.650***               0.595***        
##                                    (0.015)                (0.020)                (0.015)                (0.020)        
## log(1 + gainloss)                 0.012***               0.014***               0.013***               0.013***        
##                                    (0.002)                (0.003)                (0.002)                (0.003)        
## gain                              0.183***               0.193***               0.167***               0.169***        
##                                    (0.034)                (0.047)                (0.034)                (0.047)        
## beds                                0.001                  0.004                 0.0002                  0.004         
##                                    (0.002)                (0.003)                (0.002)                (0.003)        
## baths                               0.003                  0.002                  0.003                  0.001         
##                                    (0.002)                (0.004)                (0.002)                (0.004)        
## sqft                              0.0001***              0.0001***              0.0001***              0.0001***       
##                                   (0.00000)              (0.00001)              (0.00000)              (0.00001)       
## avg_school_rating                 0.008***                0.010**               0.007***                0.009**        
##                                    (0.002)                (0.004)                (0.002)                (0.004)        
## avg_school_distance                -0.002                  0.006                 -0.002                  0.006         
##                                    (0.002)                (0.005)                (0.002)                (0.005)        
## walk_score                        -0.0002**              -0.001***             -0.0002***              -0.001***       
##                                   (0.0001)               (0.0002)               (0.0001)               (0.0002)        
## log(house_age)                    0.014***                -0.0003               0.015***                -0.001         
##                                    (0.004)                (0.006)                (0.004)                (0.006)        
## log(LotSizeSquareFeet)            0.028***               0.032***               0.028***               0.032***        
##                                    (0.004)                (0.006)                (0.004)                (0.006)        
## LTV_prev                          -0.014***              -0.012**               -0.012***               -0.011*        
##                                    (0.004)                (0.005)                (0.004)                (0.005)        
## medianage                         0.001***                                      0.001***                               
##                                   (0.0003)                (0.000)               (0.0003)                (0.000)        
## log(medianhouseholdincome)        0.031***                                      0.030***                               
##                                    (0.008)                (0.000)                (0.008)                (0.000)        
## Renter_fraction                     0.016                                         0.015                                
##                                    (0.014)                (0.000)                (0.014)                (0.000)        
## log(1 + gainloss):gain            -0.020***              -0.020***              -0.018***              -0.018***       
##                                    (0.003)                (0.005)                (0.003)                (0.005)        
## -----------------------------------------------------------------------------------------------------------------------
## Fixed Effects               Zip X Month, Prch. Yr Tract x Month, Prch. Yr Zip x Month, Prch. Yr Tract X Month, Prch. Yr
## Cluster                              Zip                   Tract                   Zip                   Tract         
## Observations                       20,360                 20,360                 20,360                 20,360         
## Adjusted R2                         0.972                  0.976                  0.973                  0.976         
## =======================================================================================================================
## Note:                                                                                       *p<0.1; **p<0.05; ***p<0.01
## 

2.5 Ref 2: Comment 2

2.5.1 Hedonic model

CA_all[,listing_hpi:=HPI_sale]
CA_all[,purchase_hpi:=HPI_purchase]
CA_all[,beds:=Bedrooms]
CA_all[,baths:=Bathrooms]
CA_all[,house_age:=House_age]
CA_all[,LotSizeSquareFeet:=Lot_sqft]
CA_all[,sqft:=BuildingAreaSqFt]
CA_all[,hpi_inflation:=HPI_sale/HPI_purchase]
CA_all[,yr:=Sale_year]
CA_all[,zip_yr:=paste(zip,yr)]

temp <- CA_all[Sale_year>=2012 & house_age>0  & Sale_price>100000 & Sale_price<2000000]

library(fixest)
r <- feols(data=temp,log(Sale_price)~log(listing_hpi)+beds+baths+log(house_age)+log(LotSizeSquareFeet)+log(sqft)|yr+zip)


summary(r)
## OLS estimation, Dep. Var.: log(Sale_price)
## Observations: 382,546 
## Fixed-effects: yr: 5,  zip: 1,223
## Standard-errors: Clustered (yr) 
##                        Estimate Std. Error t value   Pr(>|t|)    
## log(listing_hpi)       0.752593   0.021873 34.4070 0.00000426 ***
## beds                   0.019903   0.001023 19.4560 0.00004100 ***
## baths                  0.000234   0.002287  0.1025 0.92329300    
## log(house_age)         0.007293   0.002062  3.5369 0.02408100 *  
## log(LotSizeSquareFeet) 0.007837   0.001202  6.5196 0.00285800 ** 
## log(sqft)              0.716468   0.018234 39.2920 0.00000251 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Log-likelihood: -17,533.96   Adj. R2: 0.82542 
##                            R2-Within: 0.52247
temp[,predprice:=exp(predict(r,newdata = temp))]
temp[,Sale_price:=floor(Sale_price/1000)*1000]
temp <- temp[,.(predprice=mean(predprice,na.rm=T),.N),by=Sale_price]

2.5.1.1 Predictability of Hedonic model

ggplot(temp[N>10],aes(x=Sale_price,y=predprice))+geom_point()+geom_smooth(method="lm")+theme_minimal()+labs(x="Sales price",y="Predicted sales price")

2.5.1.2 Predictability of Adj. Purch. Price

temp <- CA_all[Sale_year>=2012 & house_age>0  & Sale_price>100000 & Sale_price<2000000 & Adj_purch_price<2000000]
temp[,Sale_price:=floor(Sale_price/1000)*1000]
temp <- temp[,.(Adj_purch_price=mean(Adj_purch_price,na.rm=T),.N),by=Sale_price]

ggplot(temp[N>10 ],aes(x=Sale_price,y=Adj_purch_price))+geom_point()+geom_smooth(method="lm")+theme_minimal()+labs(x="Sales price",y="Adjusted purchase price")

2.5.2 Predicted Price as a control

controls = "log(predictedhouseprice)+log(1+gainloss)*gain+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev+medianage+log(medianhouseholdincome)+Renter_fraction"
zd[,yr:=ifelse(ListingYear>2016,2016,ListingYear)]
zd[,predictedhouseprice:=exp(predict(r,newdata = zd))]
zd[,lp:=Listing_price/predictedhouseprice]
zd <- zd[,gainloss:=abs(predictedhouseprice-Purchase_price)]
zd <- zd[,gain:=ifelse(predictedhouseprice>Purchase_price,1,0)]
regs <- list()
regs[[1]] <- felm(as.formula(paste("log(Listing_price)~factor(proptaxratebin)+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[2]] <- felm(as.formula(paste("log(Listing_price)~Property_tax_rate_last_year+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[3]] <- felm(as.formula(paste("log(Listing_price)~",controls,fe,"(",endo_var,"~",instruments,")",cluster,sep="")),data=zd)
regs[[4]] <- felm(as.formula(paste("log(Listing_price)~",controls,"|tract_list_month|","(",endo_var,"~",instruments,")","|GEOID",sep="")),data=zd)


condf <- list(
  c("Cond. F. Stat","","",round(condfstat(regs[[3]])[[1]],2),round(condfstat(regs[[4]])[[1]],2)),
  c("Fixed Effects","Zip X Month","Zip x Month","Zip x Month","Tract X Month"),
  c("Cluster","Zip","Zip","zip","Tract")
  )
printtable(regs,column.labels = c("OLS","OLS","IV","IV","IV"),note="",lines=condf)
## 
## ====================================================================================
##                                                   Dependent variable:               
##                                    -------------------------------------------------
##                                        OLS         OLS         IV           IV      
##                                        (1)         (2)         (3)          (4)     
## ------------------------------------------------------------------------------------
## factor(proptaxratebin)2             0.059***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)3             0.082***                                        
##                                      (0.007)                                        
## factor(proptaxratebin)4             0.089***                                        
##                                      (0.007)                                        
## factor(proptaxratebin)5             0.096***                                        
##                                      (0.007)                                        
## factor(proptaxratebin)6             0.101***                                        
##                                      (0.008)                                        
## factor(proptaxratebin)7             0.097***                                        
##                                      (0.008)                                        
## factor(proptaxratebin)8             0.116***                                        
##                                      (0.008)                                        
## factor(proptaxratebin)9             0.117***                                        
##                                      (0.009)                                        
## factor(proptaxratebin)10            0.122***                                        
##                                      (0.010)                                        
## Property_tax_rate_last_year                     8.855***                            
##                                                  (0.920)                            
## log(predictedhouseprice)            0.697***    0.677***    0.697***     0.699***   
##                                      (0.031)     (0.030)     (0.035)      (0.053)   
## log(1 + gainloss)                   0.028***    0.029***    0.030***     0.024***   
##                                      (0.004)     (0.004)     (0.004)      (0.004)   
## gain                                0.203***    0.257***    0.226***      0.127**   
##                                      (0.037)     (0.036)     (0.042)      (0.051)   
## beds                                0.021***    0.021***    0.021***     0.025***   
##                                      (0.003)     (0.003)     (0.003)      (0.004)   
## baths                               -0.043***   -0.040***   -0.042***    -0.042***  
##                                      (0.005)     (0.005)     (0.005)      (0.007)   
## sqft                                0.0001***   0.0001***   0.0001***    0.0001***  
##                                     (0.00001)   (0.00001)   (0.00001)    (0.00001)  
## avg_school_rating                   0.011***    0.011***    0.011***      0.009**   
##                                      (0.002)     (0.002)     (0.002)      (0.005)   
## avg_school_distance                  -0.001      -0.002      -0.002        0.005    
##                                      (0.002)     (0.002)     (0.002)      (0.005)   
## walk_score                         -0.0003***  -0.0003***  -0.0003***    -0.001***  
##                                     (0.0001)    (0.0001)    (0.0001)     (0.0002)   
## log(house_age)                      -0.057***   -0.053***   -0.052***    -0.062***  
##                                      (0.005)     (0.005)     (0.005)      (0.007)   
## log(LotSizeSquareFeet)              0.041***    0.042***    0.042***     0.044***   
##                                      (0.005)     (0.005)     (0.005)      (0.008)   
## LTV_prev                            -0.012***   -0.012***   -0.012***    -0.015**   
##                                      (0.004)     (0.004)     (0.004)      (0.006)   
## medianage                           0.002***    0.002***    0.002***                
##                                     (0.0004)    (0.0004)    (0.0004)      (0.000)   
## log(medianhouseholdincome)          0.053***    0.056***    0.052***                
##                                      (0.010)     (0.010)     (0.010)      (0.000)   
## Renter_fraction                      0.036**     0.040**     0.038**                
##                                      (0.017)     (0.017)     (0.017)      (0.000)   
## log(1 + gainloss):gain              -0.021***   -0.027***   -0.024***    -0.013***  
##                                      (0.004)     (0.004)     (0.004)      (0.005)   
## `Property_tax_rate_last_year(fit)`                          12.595***    17.194***  
##                                                              (2.226)      (3.446)   
## ------------------------------------------------------------------------------------
## Cond. F. Stat                                                 78.85        28.81    
## Fixed Effects                      Zip X Month Zip x Month Zip x Month Tract X Month
## Cluster                                Zip         Zip         zip         Tract    
## Observations                         20,360      20,360      20,360       20,360    
## Adjusted R2                           0.965       0.965       0.965        0.969    
## ====================================================================================
## Note:                                                    *p<0.1; **p<0.05; ***p<0.01
## 

2.5.3 Listing premium as dep var

controls = "log(1+gainloss)*gain+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev+medianage+log(medianhouseholdincome)+Renter_fraction"

regs <- list()
regs[[1]] <- felm(as.formula(paste("log(lp)~factor(proptaxratebin)+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[2]] <- felm(as.formula(paste("log(lp)~Property_tax_rate_last_year+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[3]] <- felm(as.formula(paste("log(lp)~",controls,fe,"(",endo_var,"~",instruments,")",cluster,sep="")),data=zd)
regs[[4]] <- felm(as.formula(paste("log(lp)~",controls,"|tract_list_month|","(",endo_var,"~",instruments,")","|GEOID",sep="")),data=zd)


condf <- list(
  c("Cond. F. Stat","","",round(condfstat(regs[[3]])[[1]],2),round(condfstat(regs[[4]])[[1]],2)),
  c("Fixed Effects","Zip X Month","Zip x Month","Zip x Month","Tract X Month"),
  c("Cluster","Zip","Zip","zip","Tract")
  )
printtable(regs,column.labels = c("OLS","OLS","IV","IV","IV"),note="",lines=condf)
## 
## ====================================================================================
##                                                   Dependent variable:               
##                                    -------------------------------------------------
##                                        OLS         OLS         IV           IV      
##                                        (1)         (2)         (3)          (4)     
## ------------------------------------------------------------------------------------
## factor(proptaxratebin)2             0.086***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)3             0.118***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)4             0.128***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)5             0.140***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)6             0.149***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)7             0.148***                                        
##                                      (0.007)                                        
## factor(proptaxratebin)8             0.174***                                        
##                                      (0.007)                                        
## factor(proptaxratebin)9             0.182***                                        
##                                      (0.007)                                        
## factor(proptaxratebin)10            0.201***                                        
##                                      (0.008)                                        
## Property_tax_rate_last_year                     15.788***                           
##                                                  (0.823)                            
## log(1 + gainloss)                   0.026***    0.027***    0.029***     0.025***   
##                                      (0.004)     (0.004)     (0.004)      (0.005)   
## gain                                0.175***    0.244***    0.186***      0.108**   
##                                      (0.037)     (0.037)     (0.042)      (0.053)   
## beds                                0.029***    0.030***    0.029***     0.034***   
##                                      (0.003)     (0.003)     (0.003)      (0.005)   
## baths                               -0.064***   -0.063***   -0.064***    -0.062***  
##                                      (0.004)     (0.004)     (0.004)      (0.005)   
## sqft                                -0.00000    -0.00000    -0.00000     -0.00001   
##                                     (0.00001)   (0.00001)   (0.00001)    (0.00001)  
## avg_school_rating                   0.007***    0.008***    0.007***       0.005    
##                                      (0.002)     (0.002)     (0.002)      (0.005)   
## avg_school_distance                  -0.001      -0.002      -0.003        0.005    
##                                      (0.002)     (0.002)     (0.002)      (0.006)   
## walk_score                           -0.0001     -0.0001     -0.0001     -0.0005**  
##                                     (0.0001)    (0.0001)    (0.0001)     (0.0002)   
## log(house_age)                      -0.076***   -0.072***   -0.068***    -0.075***  
##                                      (0.005)     (0.005)     (0.005)      (0.007)   
## log(LotSizeSquareFeet)              0.030***    0.030***    0.032***     0.035***   
##                                      (0.004)     (0.004)     (0.004)      (0.006)   
## LTV_prev                            -0.012***   -0.011***   -0.012***    -0.016**   
##                                      (0.004)     (0.004)     (0.004)      (0.007)   
## medianage                           0.001***    0.001***    0.001***                
##                                     (0.0004)    (0.0004)    (0.0004)      (0.000)   
## log(medianhouseholdincome)           0.021**    0.023***     0.020**                
##                                      (0.008)     (0.008)     (0.009)      (0.000)   
## Renter_fraction                       0.010       0.013       0.013                 
##                                      (0.016)     (0.016)     (0.017)      (0.000)   
## log(1 + gainloss):gain              -0.016***   -0.023***   -0.018***     -0.009*   
##                                      (0.004)     (0.004)     (0.004)      (0.005)   
## `Property_tax_rate_last_year(fit)`                          22.191***    27.038***  
##                                                              (1.992)      (2.819)   
## ------------------------------------------------------------------------------------
## Cond. F. Stat                                                106.45        43.21    
## Fixed Effects                      Zip X Month Zip x Month Zip x Month Tract X Month
## Cluster                                Zip         Zip         zip         Tract    
## Observations                         20,360      20,360      20,360       20,360    
## Adjusted R2                           0.668       0.656       0.652        0.689    
## ====================================================================================
## Note:                                                    *p<0.1; **p<0.05; ***p<0.01
## 

2.5.4 Listing premium based on adj. purch price as dep var

zd[,lp:=Listing_price/Adj_purch_price]


controls = "log(1+gainloss)*gain+beds+baths+sqft+avg_school_rating+avg_school_distance+walk_score+log(house_age)+log(LotSizeSquareFeet)+LTV_prev+medianage+log(medianhouseholdincome)+Renter_fraction"

regs <- list()
regs[[1]] <- felm(as.formula(paste("log(lp)~factor(proptaxratebin)+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[2]] <- felm(as.formula(paste("log(lp)~Property_tax_rate_last_year+",controls,fe,"0",cluster,sep="")),data=zd)
regs[[3]] <- felm(as.formula(paste("log(lp)~",controls,fe,"(",endo_var,"~",instruments,")",cluster,sep="")),data=zd)
regs[[4]] <- felm(as.formula(paste("log(lp)~",controls,"|tract_list_month|","(",endo_var,"~",instruments,")","|GEOID",sep="")),data=zd)


condf <- list(
  c("Cond. F. Stat","","",round(condfstat(regs[[3]])[[1]],2),round(condfstat(regs[[4]])[[1]],2)),
  c("Fixed Effects","Zip X Month","Zip x Month","Zip x Month","Tract X Month"),
  c("Cluster","Zip","Zip","zip","Tract")
  )
printtable(regs,column.labels = c("OLS","OLS","IV","IV","IV"),note="",lines=condf)
## 
## ====================================================================================
##                                                   Dependent variable:               
##                                    -------------------------------------------------
##                                        OLS         OLS         IV           IV      
##                                        (1)         (2)         (3)          (4)     
## ------------------------------------------------------------------------------------
## factor(proptaxratebin)2             0.017***                                        
##                                      (0.005)                                        
## factor(proptaxratebin)3             0.024***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)4             0.043***                                        
##                                      (0.005)                                        
## factor(proptaxratebin)5             0.065***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)6             0.085***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)7             0.100***                                        
##                                      (0.006)                                        
## factor(proptaxratebin)8             0.134***                                        
##                                      (0.007)                                        
## factor(proptaxratebin)9             0.175***                                        
##                                      (0.007)                                        
## factor(proptaxratebin)10            0.240***                                        
##                                      (0.008)                                        
## Property_tax_rate_last_year                     23.644***                           
##                                                  (0.702)                            
## log(1 + gainloss)                    -0.003*    -0.004**    -0.004**      -0.003    
##                                      (0.002)     (0.002)     (0.002)      (0.003)   
## gain                                -0.104***   -0.120***   -0.129***    -0.134***  
##                                      (0.023)     (0.023)     (0.025)      (0.041)   
## beds                                 -0.001      -0.0002     -0.0002       0.003    
##                                      (0.002)     (0.002)     (0.002)      (0.003)   
## baths                               -0.00004     -0.0003     -0.0004      -0.001    
##                                      (0.001)     (0.001)     (0.001)      (0.004)   
## sqft                                -0.00000    -0.00000    -0.00000     -0.00001*  
##                                     (0.00000)   (0.00000)   (0.00000)    (0.00001)  
## avg_school_rating                    0.0003       0.001       0.001       0.0001    
##                                      (0.002)     (0.002)     (0.002)      (0.005)   
## avg_school_distance                  -0.002      -0.002      -0.002        0.006    
##                                      (0.002)     (0.002)     (0.002)      (0.006)   
## walk_score                          -0.00004    -0.00003    -0.00003      -0.0002   
##                                     (0.0001)    (0.0001)    (0.0001)     (0.0002)   
## log(house_age)                      0.032***    0.030***    0.031***     0.025***   
##                                      (0.004)     (0.004)     (0.004)      (0.006)   
## log(LotSizeSquareFeet)              0.007***     0.006**     0.006**      0.009**   
##                                      (0.002)     (0.002)     (0.002)      (0.004)   
## LTV_prev                            -0.011***   -0.016***   -0.016***    -0.015**   
##                                      (0.004)     (0.004)     (0.004)      (0.006)   
## medianage                            0.00001     0.0001      0.0001                 
##                                     (0.0003)    (0.0003)    (0.0003)      (0.000)   
## log(medianhouseholdincome)          -0.022***   -0.023***   -0.023***               
##                                      (0.008)     (0.009)     (0.009)      (0.000)   
## Renter_fraction                      -0.028*     -0.028*     -0.028*                
##                                      (0.015)     (0.015)     (0.015)      (0.000)   
## log(1 + gainloss):gain              0.012***    0.013***    0.014***     0.016***   
##                                      (0.002)     (0.002)     (0.002)      (0.004)   
## `Property_tax_rate_last_year(fit)`                          24.636***    30.675***  
##                                                              (1.499)      (2.357)   
## ------------------------------------------------------------------------------------
## Cond. F. Stat                                                106.45        43.21    
## Fixed Effects                      Zip X Month Zip x Month Zip x Month Tract X Month
## Cluster                                Zip         Zip         zip         Tract    
## Observations                         20,360      20,360      20,360       20,360    
## Adjusted R2                           0.239       0.223       0.223        0.281    
## ====================================================================================
## Note:                                                    *p<0.1; **p<0.05; ***p<0.01
## 

3 Using June Cutoff for assessment of new purchases

3.1 2016 assesssment of homes purchased in 2015

Assessment value of properties purchased after June 1st in a given year is reset to the purchase price in the subsequent year. Depending on whether the buyer purchased the home just before the June 1st or just after, there is a small difference in the property tax paid in subsequent years, all else equal.

rdd_tax <- readRDS("C:/Users/dratnadiwakara2/Documents/Research/UH computer27/sunkcost_2019/asmt_tax_2016_CA.rds")
rdd_tax[,x:=as.numeric(rdd_tax$DocumentDate)]
rdd_tax[,purch_week:=as.numeric(strftime(rdd_tax$DocumentDate,format="%V"))-19]

# t <- rdd_tax[sample(1:nrow(rdd_tax),size = 20000),]
rdd_tax <- rdd_tax[rdd_tax$asmt_sales>=1]
rdd_tax <- rdd_tax[rdd_tax$asmt_sales>=0.9 & rdd_tax$asmt_sales<1.02 & rdd_tax$purch_week<30 & rdd_tax$tax_sales>0]

rdd_tax <- rdd_tax[,.(asmt_sales=mean(asmt_sales)),by=list(purch_week)]
# rdplot(rdd_tax$asmt_sales,rdd_tax$purch_week,p=1,c=20)

ggplot(rdd_tax,aes(x=purch_week,y=asmt_sales)) + geom_point() + 
  xlab("Purchase week (Weeks since June 01 2015)")+
  ylab("2016 Asmt. Value/2015 Purchase Price")+
  theme_minimal()+
  geom_vline(xintercept = 0)

3.2 Discoutinuity around June 01 (RD Plots)

temp <- zdata_reg[zdata_reg$ownership_years>2] #zdata_reg[zdata_reg$PurchaseYear %in% 2009:2012 & zdata_reg$ownership_years>1]

temp[,impliedtax:=Purchase_price*(1.02)^(ownership_years)*0.015]
temp[,lowtax:=ifelse(impliedtax>prop_tax_prev_year,1,0)]

temp[,purch_month_no:=as.numeric(format(temp$PurchaseMonth,"%m"))]
temp[,sale_month_no:=as.numeric(format(temp$sale_date,"%m"))]
temp <- temp[!is.na(temp$adj_purch_price) & !is.na(temp$GEOID)]
temp[,zip_purch_list:=paste(temp$zip,temp$purchase_list_year)]

adj_proptax <- felm(Property_tax_rate_last_year~log(adj_purch_price)|zip_purch_list,data=temp)
adj_proptax_resid <- data.frame(adj_proptax$residuals)
names(adj_proptax_resid) <- c("adj_proptax_resid")

adj_list <- felm(log(Listing_price)~log(adj_purch_price)|zip_purch_list,data=temp)
adj_list_resid <- data.frame(adj_list$residuals)
names(adj_list_resid) <- c("adj_list_resid")

adj_sale <- felm(log(Selling_price)~log(adj_purch_price)|zip_purch_list,data=temp)
adj_sale_resid <- data.frame(adj_sale$residuals)
names(adj_sale_resid) <- c("adj_sale_resid")

adj_purch <- felm(log(Purchase_price)~0|zip_purch_list,data=temp)
adj_purch_resid <- data.frame(adj_purch$residuals)
names(adj_purch_resid) <- c("adj_purch_resid")


temp <- cbind(temp,adj_proptax_resid)
temp <- cbind(temp,adj_list_resid)
temp <- cbind(temp,adj_sale_resid)
temp <- cbind(temp,adj_purch_resid)

temp[,DocumentDate_prev:=as.Date(temp$DocumentDate_prev,origin = "1970-01-01")]
temp[,purch_week:=as.numeric(strftime(temp$DocumentDate_prev,format="%V"))-20]
# temp<-temp[temp$purch_week<31]

temp[,postJune:=ifelse(purch_week>-2,1,0)]

3.3 Regression

3.3.1 Linear running variable

regs = list()
regs[[1]] = felm(Property_tax_rate_last_year~postJune+purch_week+log(adj_purch_price)+sqft+log(house_age)+beds+baths|zip_purch_list|0|zip,data=temp)
regs[[2]] = felm(log(Listing_price)~postJune+purch_week+log(adj_purch_price)+sqft+log(house_age)+beds+baths|zip_purch_list|0|zip,data=temp)
regs[[3]] = felm(log(Selling_price)~postJune+purch_week+log(adj_purch_price)+sqft+log(house_age)+beds+baths|zip_purch_list|0|zip,data=temp)
regs[[4]] = felm(log(Purchase_price)~postJune+purch_week+sqft+log(house_age)+beds+baths|zip_purch_list|0|zip,data=temp)
.printtable(regs,column.labels = c("Tax Rate","log(Listing price)","log(Selling price)","log(Purchase price)"))
## 
## =========================================================================================
##                                              Dependent variable:                         
##                      --------------------------------------------------------------------
##                       Tax Rate  log(Listing price) log(Selling price) log(Purchase price)
##                         (1)            (2)                (3)                 (4)        
## -----------------------------------------------------------------------------------------
## postJune             -0.0002***     -0.016***          -0.018***           0.027***      
##                      (0.00004)       (0.002)            (0.006)             (0.005)      
## purch_week           0.00001***     0.0004***            0.0003             0.0001       
##                      (0.00000)       (0.0001)           (0.0002)           (0.0002)      
## log(adj_purch_price) -0.002***       0.774***           0.750***                         
##                       (0.0001)       (0.011)            (0.012)                          
## sqft                  0.00000*       0.00000            0.00000             0.00001      
##                      (0.00000)      (0.00000)          (0.00000)           (0.00001)     
## log(house_age)       -0.001***       0.015***           0.016***           -0.118***     
##                       (0.0001)       (0.003)            (0.004)             (0.016)      
## beds                 0.0003***       0.026***           0.019***           0.114***      
##                      (0.00003)       (0.004)            (0.006)             (0.020)      
## baths                0.0001***       0.028***           0.021**            0.118***      
##                      (0.00004)       (0.010)            (0.010)             (0.037)      
## -----------------------------------------------------------------------------------------
##                                                                                          
## Observations           47,521         47,521             47,521             47,521       
## Adjusted R2            0.576          0.969              0.808               0.871       
## =========================================================================================
## Note:                                                         *p<0.1; **p<0.05; ***p<0.01
## 

3.3.2 Quadratic running variable

regs = list()
regs[[1]] = felm(Property_tax_rate_last_year~postJune+purch_week+I(purch_week^2)+log(adj_purch_price)+sqft+log(house_age)+beds+baths|zip_purch_list|0|zip,data=temp)
regs[[2]] = felm(log(Listing_price)~postJune+purch_week+I(purch_week^2)+log(adj_purch_price)+sqft+log(house_age)+beds+baths|zip_purch_list|0|zip,data=temp)
regs[[3]] = felm(log(Selling_price)~postJune+purch_week+I(purch_week^2)+log(adj_purch_price)+sqft+log(house_age)+beds+baths|zip_purch_list|0|zip,data=temp)
regs[[4]] = felm(log(Purchase_price)~postJune+purch_week+I(purch_week^2)+sqft+log(house_age)+beds+baths|zip_purch_list|0|zip,data=temp)
.printtable(regs,column.labels = c("Tax Rate","log(Listing price)","log(Selling price)","log(Purchase price)"))
## 
## ========================================================================================
##                                              Dependent variable:                        
##                      -------------------------------------------------------------------
##                      Tax Rate  log(Listing price) log(Selling price) log(Purchase price)
##                         (1)           (2)                (3)                 (4)        
## ----------------------------------------------------------------------------------------
## postJune             -0.0001**     -0.008***            -0.008             0.010*       
##                      (0.00004)      (0.003)            (0.007)             (0.006)      
## purch_week            0.00000       -0.0002            -0.0003            0.001***      
##                      (0.00000)      (0.0001)           (0.0003)           (0.0003)      
## I(purch_week2)       0.00000*      0.00002***         0.00003**          -0.00004***    
##                      (0.00000)     (0.00000)          (0.00001)           (0.00001)     
## log(adj_purch_price) -0.002***      0.774***           0.751***                         
##                      (0.0001)       (0.011)            (0.012)                          
## sqft                 0.00000*       0.00000            0.00000             0.00001      
##                      (0.00000)     (0.00000)          (0.00000)           (0.00001)     
## log(house_age)       -0.001***      0.015***           0.016***           -0.119***     
##                      (0.0001)       (0.003)            (0.004)             (0.016)      
## beds                 0.0003***      0.026***           0.019***           0.114***      
##                      (0.00003)      (0.004)            (0.006)             (0.020)      
## baths                0.0001***      0.028***           0.020**            0.118***      
##                      (0.00004)      (0.010)            (0.010)             (0.037)      
## ----------------------------------------------------------------------------------------
##                                                                                         
## Observations          47,521         47,521             47,521             47,521       
## Adjusted R2            0.576         0.969              0.808               0.871       
## ========================================================================================
## Note:                                                        *p<0.1; **p<0.05; ***p<0.01
## 

3.4 RD Plots

rdplotdata <- temp[purch_week<=20,.(adj_proptax_resid=mean(adj_proptax_resid,na.rm=T),
                      adj_list_resid=mean(adj_list_resid,na.rm=T),
                      adj_sale_resid=mean(adj_sale_resid,na.rm=T),
                      adj_purch_resid=mean(adj_purch_resid,na.rm=T)),                   by=(purch_week)]

rdplotdata[,postJune:=ifelse(purch_week>0,1,0)]

r <- lm(adj_proptax_resid~purch_week+postJune,data=rdplotdata)
rdplotdata[,predtax:=predict(r,rdplotdata)]

r <- lm(adj_list_resid~purch_week+postJune,data=rdplotdata)
rdplotdata[,predlist:=predict(r,rdplotdata)]

r <- lm(adj_sale_resid~purch_week+postJune,data=rdplotdata)
rdplotdata[,predsale:=predict(r,rdplotdata)]

r <- lm(adj_purch_resid~purch_week+postJune,data=rdplotdata)
rdplotdata[,predpurch:=predict(r,rdplotdata)]

3.4.1 Property tax

ggplot(rdplotdata)+geom_point(aes(x=purch_week,y=adj_proptax_resid))+
  geom_line(data=rdplotdata[postJune==0],aes(x=purch_week,y=predtax),color="dodgerblue4",size=1)+
  geom_line(data=rdplotdata[postJune==1],aes(x=purch_week,y=predtax),color="dodgerblue2",size=1)+theme_minimal()+labs(x="Weeks since June 01",y="Property tax residual")

3.4.2 Listing price

ggplot(rdplotdata)+geom_point(aes(x=purch_week,y=adj_list_resid))+
  geom_line(data=rdplotdata[postJune==0],aes(x=purch_week,y=predlist),color="dodgerblue4",size=1)+
  geom_line(data=rdplotdata[postJune==1],aes(x=purch_week,y=predlist),color="dodgerblue2",size=1)+theme_minimal()+labs(x="Weeks since June 01",y="List price residual")

3.4.3 Selling price

ggplot(rdplotdata)+geom_point(aes(x=purch_week,y=adj_sale_resid))+
  geom_line(data=rdplotdata[postJune==0],aes(x=purch_week,y=predsale),color="dodgerblue4",size=1)+
  geom_line(data=rdplotdata[postJune==1],aes(x=purch_week,y=predsale),color="dodgerblue2",size=1)+theme_minimal()+labs(x="Weeks since June 01",y="Selling price residual")

3.4.4 Purchase price

ggplot(rdplotdata)+geom_point(aes(x=purch_week,y=adj_purch_resid))+
  geom_line(data=rdplotdata[postJune==0],aes(x=purch_week,y=predpurch),color="dodgerblue4",size=1)+
  geom_line(data=rdplotdata[postJune==1],aes(x=purch_week,y=predpurch),color="dodgerblue2",size=1)+theme_minimal()+labs(x="Weeks since June 01",y="Purchase price residual")