#knitr::opts_chunk$set(echo=TRUE, warning = FALSE, message = FALSE, results = 'hide', include=TRUE, fig.keep = 'all')
## SET UP ##
#Setup for our analysis, including necessary packages.
rm(list = ls())
setwd("~/Documents/UPenn/Penn 2022 Spring/Planning by Numbers/Final")
library(tidyverse)
library(tidycensus)
library(ggplot2)
library(dplyr)
library(data.table)
require("ggrepel")
library(hrbrthemes)
library(viridis)
library(ggridges)
library(lubridate)
library(tigris)
library(gganimate)
library(riem)
library(gridExtra)
library(knitr)
library(kableExtra)
library(mapview)
library(ggcorrplot)
library(RColorBrewer)
library(stargazer)
library(correlationfunnel)
library(tidyquant)
library(plotly)
library(shiny)
library(bslib)
library(shinydashboard)
library(DT)
library(car)
library(AICcmodavg)
library(corrplot)
library(ggthemes)
library(mlogit)
library(gmodels)
library(MASS)
library(class)
library(classInt)
library(sf)
library(BAMMtools)
library(magrittr)
library(Hmisc)
library(forcats)
library(ComplexHeatmap)
library(correlation)
library(sandwich)
library(msm)
require(plotly)
options(scipen=999)
plotTheme <- theme(panel.background = element_rect(fill = "grey91", colour = "grey91", size = 0.5, linetype = "solid"),
panel.grid.major = element_line(size = 0.5, linetype = 'solid', colour = "white"),
panel.grid.minor = element_line(size = 0.25, linetype = 'solid', colour = "white"),
text = element_text(family = "Comic Sans MS"),
axis.title = element_text(size = 12, lineheight = .9),
plot.title = element_text(size=15, face = "bold", hjust = 0.5),
plot.background = element_blank())
dat <- read.csv("505Final_Master_CityData_NoNYC.csv")
dat2 <- read.csv("505Final_Master_CityData_Full30.csv")
datDis <- read.csv("505Final_Master_CityData_NoNYC_DiscreteNames.csv")
datDisNZero <- read.csv("505Final_Master_CityData_NoNYC_DiscreteNames_NoZeros.csv")Challenging Beginnings
We approached this project wanting to investigate a topic relevant and pressing to the City of Philadelphia. Over the course of our research, we stumbled upon the subject of tangled titles– a topic particularly relevant to Philadelphia. Two percent of Philadelphia’s residential properties (around 10,400) are considered to have tangled titles. A tangled title occurs when the ownership of a property is in question or unknown, which typically occurs following the death of the original deed holder and heirs are either also deceased or deed is unable to automatically transfer. A tangled title has serious implications for an individual’s ability to take advantage of the benefits of home ownership. If one isn’t listed on the deed, they cannot: sell the house, take out loans, apply for homeowner’s insurance or be eligible for various state and city policies designed to help homeowners, particularly lower income homeowners. After conducting cursory research on the topic, we identified two research papers: one written by Pew in 2021, and one by Philly VIP in 2007– both of which built and estimated properties with tangled titles in Philadelphia. After attempting to duplicate their methods, we realized some of the underlying data needed to build out using datasets that had restricted access or required purchase. Specifically, both research papers relied on accessing the Social Security Administration’s Master Death File. We then reached out to both Pew and Philly VIP with hopes of accessing either of their datasets, if building our own was unfeasible. Unfortunately, after a conversation with the researchers that conducted the Pew study, we determined that accessing this dataset would be too costly for the scope of this class.
We decided then to pivot to another research question we were interested in exploring for this project. Covid-19 saw the federal government and many cities introduce unprecedented eviction protection policies to mitigate the rise in evictions during the pandemic. Eviction Lab, based out of Princeton University and run by Matthew Desmond (author of Evicted), compiled these policies into ‘Policy Scorecards’ for each state. Eviction Lab’s ‘Policy Scorecard’ broke 23 eviction policies into 5 policy groups: Initiation of Eviction, Court Process, Enforcement of Eviction Order, Short-Term Supports, and Tenancy Protection Measures (See table below). Using these policy groupings and scores as our basis we began to build out our data set.
Research Questions
We were interested in exploring the relationships between specific Covid-related eviction policies, demographics of the cities impacted by these policies, and overall eviction filing rates over the course of our study period: March 2020 to July 2021. Specific questions we had were:
Did any individual policies show statistically significant relationships with the number of overall eviction filings?
Did any of the 5 policy groups show statistically significant relationships with the number of overall eviction filings?
Were there measurable demographic factors in the cities studied that also showed statistically significant relationships with eviction filings?
How do the significant variables identified in our research impact or predict future eviction filing rates?
Methods
We coded policies from Eviction Lab’s ‘Policy Scorecard’ for cities with publicly accessible and uniform eviction filing data within our study period, which resulted in 30 cities. For these 30 cities, we then used ACS and Decennial census data, along with CDC Covid-19 death data to create our demographic variables which included Political Party of City Government, Gender of Mayor, Median Rent, Median Household Income, Total City Population, Largest Racial Group, Total Covid Deaths during our study period. We merged all data in R and completed a series of correlation tests, eventually performing a series of multivariate linear regressions to develop models with our statistically significant variables. Using those models, we built a series of prediction plots displaying different policy and demographic combination scenarios in order to further investigate the relationship between our variables and eviction filings.
Findings
Due to the limited availability of comprehensive eviction data, we present the following ‘findings’ with heavy caution that our observations should only guide and inspire future lines of inquiry on this subject and are not indeed to be viewed as conclusive. We identified the following potential relationships with eviction filing rates through our modeling and predictive scenario plots.
Among just the demographic variables and eviction filing rates, we determined that the number of total Covid-related deaths experienced by a city and the city’s median rent price displayed the best fit to overall eviction filing rates.
Eviction filings are associated with an increase of just over 4 filings for every unit increase in Covid-related death experienced by a city.
We found that as Covid-related deaths increased in a city, eviction filing rates also increased. While a disturbing statistic as one would hope areas that were particularly hurt by Covid would be more conservative in eviction practices— this relationship is most likely due to larger populations experiencing more Covid deaths and more evictions than smaller cities with smaller populations, as this positive relationship occurred even after both variables were log transformed.
Eviction filings are associated with a decrease of 11 filings for every unit increase in Median Rent.
Surprisingly, we observed that eviction filings have a negative association, i.e., are expected to decrease as median rents rise. This counters the simple logic that eviction filings, which are often due to financial insecurity and lack of payment, would occur at a greater rate in areas where median rents are higher. While clearly an area for more study, we hypothesize that this relationship could be due to the tendency for more affluent areas to have more progressive eviction policies.
Among the policy variables, we determined that the policies of IOE: No filing if tenant has COVID-19 hardship, IOE: No Filing for Nonpayment, CP: Eviction Records Sealed, EEO: No Removal of Tenant for Nonpayment, EEO: No Removal if Tenant has Covid19 Hardship, and STS: Free Utility Re-connection to display a relationship with overall eviction filings.
The policy variables showing the greatest positive relationship with eviction filings were CP: Eviction Records Sealed and IOE: No Filing for Non-Payment.
The policy variables with the greatest negative relationship with eviction filings were EEO: No Removal for Nonpayment and IOE: No Filing if Tenant has Covid19 Hardship.
It is reasonable to assume that policies preventing the actual removal of a tenant or filing of an eviction would have a negative association with overall eviction filing rates.
We hypothesize that this could be due to the vast majority of tenants vulnerable to eviction in these cities were impacted directly by Covid and qualified for Covid-related protections, particularly given our study period covered the peak of Covid cases in the US. However, we were surprised to see that policies that sealed eviction records and that prevented filings in cases of non-payment were positively associated with eviction filings. While we do not believe that this is a direct relationship, we believe this could be related to this policy’s lack of direct impact on actual eviction filings. We also wonder if it could be, for lack of a better term, a ‘red herring’ policy that is politically tolerable due to its weak nature. We theorize that if a state or city wished to pass eviction and housing stability policies without immediately impacting potential evictions filled, such a policy could be one way of pacifying the demands of more progressive constituents. Upon combining policy and demographic variables we determined, unsurprisingly, based on the coefficients and variables identified in the previous two models, that Covid-related deaths, sealed eviction records, and no tenant removal for nonpayment were most significant.
We also evaluated policy type by group. From this, we determined that yet again Covid death rates had a statistically significant relationship with eviction filings, along with the policy groups of EEO: Enforcement of Eviction Order and TPM: Tenancy Preservation Measure.While EEO policies had a negative association with filing rates, TPM policies had, surprisingly, a positive relationship with filings. We hypothesize that this is due to the more general housing security-related characteristics of TPM policies, such as no late fees, and their lack of direct relationship with actual filings.
Lastly, we developed a series of prediction scenarios based on our models to explore these relationships outlined above in further detail.
In scenario 1, when plotting the relationship between median rent prices and filings over Covid death rates, we observed that has filings were highest in cities where median rents were lowest. Yet, the death rates were actually higher in these cities with higher rents and lower eviction filings. Thus, we have now expanded our hypothesis that larger cities with typically higher rents, larger populations, more dense living conditions, and often higher Covid death rates are more likely to have fewer eviction filings due to their more progressive policy landscape.
In scenario 2, which explored our policy and demographic model, we observed an overall confirmation of our initial observations that policies preventing the removal of tenants due to nonpayment lead to the lowest rate of filings, while policies targeting the sealing of eviction records are associated with higher rates of filings. The Covid death rate was uniform between the three scenarios; however, it was notability lowest in cities that had both policy types in place.
For scenario 3, we explored the impact of our policy group model. We observed that unsurprisingly cities with no EEO or TPM policies displayed significantly higher eviction filings, whereas there was almost no discernible difference between cities that had the mean and max number of policies within these two groups. The Covid death rates were predicted to be approximately the same for all three scenarios.
Future Direction
The greatest shortcoming of our research was the overall lack of data and consistency in reporting of eviction filings by cities and municipalities. There are no uniform policies or laws for the reporting of eviction data between cities or states.This lack of uniformity and overall transparency makes it exceedingly difficult for researchers, advocates, and policymakers to understand the overall eviction landscape occurring in a certain region or across the U.S. This also makes it difficult to understand the impact of eviction and housing security policies various states and cities have implemented in response to the economic insecurity triggered by Covid-19. To better analyze the impact of such policies and their effectiveness in reducing eviction filings in cities, it is imperative for states and municipalities to create uniform and publicly accessible reporting procedures. While a complicated and deeply personal issue, high rates of evictions have impacts that extend far beyond the evicted household and have serious ramifications for the overall health and well-being of communities.
Link to Corresponding Final Slide Deck
| INITIATION OF EVICTION | COURT PROCESS | ENFORCEMENT OF EVICTION ORDER | SHORT-TERM SUPPORTS | TENANCY PRESERVATION MEASURES |
|---|---|---|---|---|
|
|
|
|
|
30 cities with corresponding demographic and eviction policy scores and binary policy grading.
head(dat2,20)Removed NYC due to heavy skew and insufficient data.
DT::datatable(
dat,
options = list(scrollX = TRUE)
)Select tabs to switch between variable types.
Includes political party of local government, gender of mayor, median rent, median household income, total city population, total Covid19 deaths, majority black cities, majority white cities & average monthly pre-Covid filings by city.
##make binary race variables
#PP_Dem PP_Repub PP_Indep MayorGend MedRent MedHHIncome TotCitPop CovidDeath Largest_Racial_Group MajorWhite MajorBlack TotalSP_Filings AvgSP_Filings AvgPreSP_Filings
colnamCleaningDemo <- c("PP_Dem", "PP_Repub", "PP_Indep", "MayorGend", "MedRent", "MedHHIncome", "TotCitPop", "CovidDeath", "MajorWhite", "MajorBlack", "TotalSP_Filings", "AvgPreSP_Filings")
clean_datDemo <- dat[ , which(names(dat) %in% colnamCleaningDemo)]
head(clean_datDemo)Attributes of eviction moratorium policy coded into binary form and fall within five main buckets of policy type: Initiation of Eviction (IOE), Court Process (CP), Enforcement of Eviction Order (EEO), Short-Term Supports (STS) & Tenancy Preservation Measures (TPM).
colnamCleaningPLCY <- c("TotalSP_Filings", "State_Score", "IOE_NoNotice", "IOE_NoFilingC19", "IOE_NoFilingNonP", "IOE_NoFilingEmerg", "IOE_CARES", "CP_HearSusp", "CP_JudgPos", "CP_DeadlineEx", "CP_EviSealed", "EEO_NoRemC19", "EEO_NoRemNonP", "EEO_NoRemEmerg", "STS_MortExt", "STS_NoUtDis", "STS_FreeUt", "STS_GraceP", "STS_NoReport", "STS_ForMort", "TPM_NoFee", "TPM_HouseStab", "TPM_NoRentRaise", "TPM_Legal")
clean_datPLCY <- dat[ , which(names(dat) %in% colnamCleaningPLCY)]
head(clean_datPLCY)colnamCleaningCat <- c("TotalSP_Filings", "City", "State", "PoliticParty", "PP_Dem", "PP_Repub", "PP_Indep", "MayorGend", "MajorWhite", "MajorBlack", "IOE_NoNotice", "IOE_NoFilingC19", "IOE_NoFilingNonP", "IOE_NoFilingEmerg", "IOE_CARES", "CP_HearSusp", "CP_JudgPos", "CP_DeadlineEx", "CP_EviSealed", "EEO_NoRemC19", "EEO_NoRemNonP", "EEO_NoRemEmerg", "STS_MortExt", "STS_NoUtDis", "STS_FreeUt", "STS_GraceP", "STS_NoReport", "STS_ForMort", "TPM_NoFee", "TPM_HouseStab", "TPM_NoRentRaise", "TPM_Legal")
clean_datPLCYCat <- dat[ , which(names(dat) %in% colnamCleaningCat)]Checking for skew. As number of data points is so small the risk of skew is high. Will take the log of any variables displaying a skew.
#number of bins: sqrt(#of data points)
#bin width: (max-min) / #of bins
#number of data points: 29 --> 5
#max 1657 min 797 -->
qplot(dat$MedRent,
geom="histogram",
binwidth = 250,
main = "Median Gross Rent",
xlab = "$$$",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotTheme#number of bins: sqrt(#of data points)
#bin width: (max-min) / #of bins
#number of data points: 29 --> 5
#max 1657 min 797 -->
##max=97539 min=43258 --> 54281
qplot(dat$MedHHIncome,
geom="histogram",
binwidth = 10856,
main = "Median Household Income",
xlab = "$$$",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotThemeTotal City Population is skewed. Take log to make more even distribution.
#number of bins: sqrt(#of data points)
#bin width: (max-min) / #of bins
## max=8804190; min=70720 = 2233860
qplot(dat$TotCitPop,
geom="histogram",
binwidth = 480000,
main = "Total City Population",
xlab = "Population",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotThemedat$TotCitPopLog <- log(dat$TotCitPop)
datDisNZero$TotCitPopLog <- log(datDisNZero$TotCitPop)
qplot(dat$TotCitPopLog,
geom="histogram",
binwidth = 1,
main = "Log of Total City Population",
xlab = "Population",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotThemeData shows skew. Take log.
#29046.0-280=
qplot(dat$CovidDeath,
geom="histogram",
binwidth = 2150,
main = "Covid Deaths",
xlab = "Death",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotThemedat$CovidDeathLog <- log(dat$CovidDeath)
datDisNZero$CovidDeathLog <- log(datDisNZero$CovidDeath)
qplot(dat$CovidDeathLog,
geom="histogram",
binwidth = 1,
main = "Log of Covid Deaths",
xlab = "Death",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotThemeData shows skew. Take log.
#29046.0-280=
qplot(dat$AvgPreSP_Filings,
geom="histogram",
binwidth = 2150,
main = "PreCovid Eviction Filings",
xlab = "Filings",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotThemedat$AvgPreSP_FilingsLog <- log(dat$AvgPreSP_Filings)
qplot(dat$AvgPreSP_FilingsLog,
geom="histogram",
binwidth = 1,
main = "Log Transformed PreCovid Eviction Filings",
xlab = "Filings",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotThemeData shows skew. Take log.
qplot(dat$TotalSP_Filings,
geom="histogram",
binwidth = 7000,
main = "Total Filings During Covid",
xlab = "Filings",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotTheme#slight skew, try log
dat$TotalSP_FilingsLog <- log(dat$TotalSP_Filings)
datDisNZero$TotalSP_FilingsLog <- log(datDisNZero$TotalSP_Filings)
#log plot
qplot(dat$TotalSP_FilingsLog,
geom="histogram",
binwidth = 1,
main = "Log of Total Filings During Covid",
xlab = "Filings",
fill=I("violetred3"),
col=I("violetred3"),
alpha=I(.3)) + plotTheme#create clean demographic data table with log variables
colnamCleaningDemoLog <- c("PP_Dem", "PP_Repub", "PP_Indep", "MayorGend", "MedRent", "MedHHIncome", "TotCitPopLog", "CovidDeathLog", "MajorWhite", "MajorBlack", "TotalSP_FilingsLog", "AvgPreSP_FilingsLog")
clean_datDemoLog <- dat[ , which(names(dat) %in% colnamCleaningDemoLog)]ggplot(dat,
aes(x=State, y=TotalSP_FilingsLog)) +
geom_boxplot(fill="purple", alpha=0.2) +
geom_jitter(color="gray50", size=0.4, alpha=0.9) +
ggtitle("Spread of Total Filing Rate by State") +
xlab("STATE") + ylab("Total Filings")+ plotTheme + theme(axis.text.x = element_text(angle = 45, hjust=1))ggplot(dat, aes(x = CovidDeathLog,
y = TotalSP_FilingsLog)) +
geom_point(size=5, shape=8, color="cyan3") +
geom_text_repel(aes(label = City), family = "Comic Sans MS", size = 3) +
theme(legend.position = "bottom", text = element_text(family = "Comic Sans MS")) +
ggtitle("Covid Deaths vs. Total Eviction Filings by City") +
xlab("Covid Deaths") + ylab("Eviction Filings") + plotThemeSelect tabs to view corr values, heatmap, p-value table for demographic variables.
cortableDemo <- cor(clean_datDemo)
#round(cortableDemo, 2)
res2 <- rcorr(as.matrix(clean_datDemo))
#res2
df.res2.r=data.frame(res2$r)
df.res2.p=data.frame(res2$P)
DT::datatable(
df.res2.r,
options = list(scrollX = TRUE))N = cor(clean_datDemo)
col1<- colorRampPalette(c("chartreuse4", "lightgoldenrod", "blueviolet"))(15)
heatmap(x = N, col = col1, symm = TRUE)DT::datatable(
df.res2.p,
options = list(scrollX = TRUE))#**Matrix of Correlations and P-values of Demographic Variables**Statistically significant variables are displayed using Hierarchical Cluster Analysis.
#flattenCorrMatrix(res2$r, res2$P)
# mat : is a matrix of data
# ... : further arguments to pass to the native R cor.test function
cor.mtest <- function(mat, ...) {
mat <- as.matrix(mat)
n <- ncol(mat)
p.mat<- matrix(NA, n, n)
diag(p.mat) <- 0
for (i in 1:(n - 1)) {
for (j in (i + 1):n) {
tmp <- cor.test(mat[, i], mat[, j], ...)
p.mat[i, j] <- p.mat[j, i] <- tmp$p.value
}
}
colnames(p.mat) <- rownames(p.mat) <- colnames(mat)
p.mat
}
p.mat <- cor.mtest(clean_datDemo)
# matrix of the p-value of the correlation
corrplot(N, method="color", col=col1,
type="upper", order="hclust", family = "Comic Sans MS",
number.cex = 0.9, hclust.method = "complete",
addCoef.col = "black",
tl.col="black", tl.srt=45,
p.mat = p.mat, sig.level = 0.1, insig = "blank",
diag=FALSE) + plotThemeCorrelation between Demographic Variables and Score by Policy Type Grouping
#create clean demographic data table with variables and policy groupings
colnamCleaningDemoPlcyG <- c("PP_Dem", "PP_Repub", "PP_Indep", "MayorGend", "MedRent", "MedHHIncome", "TotCitPop", "CovidDeath", "MajorWhite", "MajorBlack", "TotalSP_Filings", "AvgPreSP_Filings", "SUM_IOE", "SUM_CP", "SUM_EEO", "SUM_STS", "SUM_TPM")
clean_datDemoPlcyG <- dat[ , which(names(dat) %in% colnamCleaningDemoPlcyG)]
cortableDemoPLCY <- cor(clean_datDemoPlcyG)
#round(cortableDemoPLCY, 2)
N2 = cor(clean_datDemoPlcyG)
col2<- colorRampPalette(c("maroon4", "paleturquoise", "indianred2"))(15)
heatmap(x = N2, col = col2, symm = TRUE)Table of Correlation Values
DT::datatable(
cortableDemoPLCY,
options = list(scrollX = TRUE))Categorical Variables as Function of Total Filings
Using variables with highest correlation and lowest p-values.
Model 1A: Eviction Filings vs. Variables Displaying Correlation
mod1a <- lm(TotalSP_Filings ~ PoliticParty + MayorGend + Largest_Racial_Group + TotCitPop + CovidDeath + MedHHIncome + MedRent, data = datDisNZero)
summary(mod1a)##
## Call:
## lm(formula = TotalSP_Filings ~ PoliticParty + MayorGend + Largest_Racial_Group +
## TotCitPop + CovidDeath + MedHHIncome + MedRent, data = datDisNZero)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10436 -3776 0 3720 10538
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 14947.7363558 7690.8641760 1.944 0.06615 .
## PoliticPartyIndependent 9248.2673818 7284.3131902 1.270 0.21880
## PoliticPartyRepublican 731.7956028 4167.5876527 0.176 0.86238
## MayorGendMale -994.7987145 3733.6970282 -0.266 0.79263
## Largest_Racial_GroupWhite 1177.3478172 4692.0142704 0.251 0.80443
## TotCitPop 0.0001194 0.0032718 0.036 0.97125
## CovidDeath 4.1681735 0.9611617 4.337 0.00032 ***
## MedHHIncome -0.0561253 0.1840384 -0.305 0.76354
## MedRent -9.6367948 9.9028348 -0.973 0.34211
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6566 on 20 degrees of freedom
## Multiple R-squared: 0.7376, Adjusted R-squared: 0.6326
## F-statistic: 7.026 on 8 and 20 DF, p-value: 0.0001962
Order of Significance by Step Through
Backward Selection
Run backward selection for model1A.
Drops Majority White, Total Population, Median Household Income, and Gender of Mayor. Kept Median Rent and Covid Death Rates.
AIC = 508.94
step(mod1a, direction = "backward")## Start: AIC=517.02
## TotalSP_Filings ~ PoliticParty + MayorGend + Largest_Racial_Group +
## TotCitPop + CovidDeath + MedHHIncome + MedRent
##
## Df Sum of Sq RSS AIC
## - TotCitPop 1 57404 862194773 515.02
## - Largest_Racial_Group 1 2714172 864851541 515.11
## - MayorGend 1 3060122 865197491 515.12
## - MedHHIncome 1 4009099 866146468 515.16
## - PoliticParty 2 69596883 931734252 515.27
## - MedRent 1 40821845 902959214 516.36
## <none> 862137369 517.02
## - CovidDeath 1 810671878 1672809247 534.24
##
## Step: AIC=515.02
## TotalSP_Filings ~ PoliticParty + MayorGend + Largest_Racial_Group +
## CovidDeath + MedHHIncome + MedRent
##
## Df Sum of Sq RSS AIC
## - Largest_Racial_Group 1 2713409 864908182 513.11
## - MayorGend 1 3072690 865267463 513.13
## - MedHHIncome 1 4481527 866676301 513.17
## - PoliticParty 2 71250027 933444800 513.33
## - MedRent 1 43971564 906166338 514.47
## <none> 862194773 515.02
## - CovidDeath 1 1818582445 2680777218 545.92
##
## Step: AIC=513.11
## TotalSP_Filings ~ PoliticParty + MayorGend + CovidDeath + MedHHIncome +
## MedRent
##
## Df Sum of Sq RSS AIC
## - MedHHIncome 1 1988844 866897026 511.18
## - MayorGend 1 8227854 873136036 511.39
## - PoliticParty 2 74052270 938960452 511.50
## - MedRent 1 58631299 923539481 513.02
## <none> 864908182 513.11
## - CovidDeath 1 1853076341 2717984523 544.32
##
## Step: AIC=511.18
## TotalSP_Filings ~ PoliticParty + MayorGend + CovidDeath + MedRent
##
## Df Sum of Sq RSS AIC
## - MayorGend 1 13802776 880699801 509.64
## - PoliticParty 2 77384091 944281117 509.66
## <none> 866897026 511.18
## - MedRent 1 142952821 1009849846 513.61
## - CovidDeath 1 2007157470 2874054496 543.94
##
## Step: AIC=509.64
## TotalSP_Filings ~ PoliticParty + CovidDeath + MedRent
##
## Df Sum of Sq RSS AIC
## - PoliticParty 2 106156435 986856236 508.94
## <none> 880699801 509.64
## - MedRent 1 136390504 1017090306 511.81
## - CovidDeath 1 2060112385 2940812186 542.61
##
## Step: AIC=508.94
## TotalSP_Filings ~ CovidDeath + MedRent
##
## Df Sum of Sq RSS AIC
## <none> 986856236 508.94
## - MedRent 1 132279186 1119135422 510.59
## - CovidDeath 1 2283149741 3270005977 541.68
##
## Call:
## lm(formula = TotalSP_Filings ~ CovidDeath + MedRent, data = datDisNZero)
##
## Coefficients:
## (Intercept) CovidDeath MedRent
## 13298.064 4.313 -11.068
#AIC=510.29
#lm(formula = TotalSP_Filings ~ CovidDeath + MedRent, data = dat)Forward Selection of Mod1A
Setting up the forward selection.
fullmodA <- mod1a
intonly <- lm(TotalSP_Filings ~1, data = datDisNZero)
step(intonly, scope=list(lower=intonly, upper=fullmodA), direction="forward")## Start: AIC=539.82
## TotalSP_Filings ~ 1
##
## Df Sum of Sq RSS AIC
## + CovidDeath 1 2165946167 1119135422 510.59
## + TotCitPop 1 946659971 2338421618 531.96
## <none> 3285081589 539.82
## + MayorGend 1 188725376 3096356213 540.10
## + PoliticParty 2 337946517 2947135071 540.67
## + MedHHIncome 1 45542134 3239539454 541.41
## + Largest_Racial_Group 1 40492014 3244589575 541.46
## + MedRent 1 15075611 3270005977 541.68
##
## Step: AIC=510.59
## TotalSP_Filings ~ CovidDeath
##
## Df Sum of Sq RSS AIC
## + MedRent 1 132279186 986856236 508.94
## + MedHHIncome 1 123706013 995429408 509.19
## <none> 1119135422 510.59
## + MayorGend 1 29970174 1089165248 511.80
## + PoliticParty 2 102045116 1017090306 511.81
## + TotCitPop 1 15661243 1103474179 512.18
## + Largest_Racial_Group 1 976 1119134445 512.59
##
## Step: AIC=508.94
## TotalSP_Filings ~ CovidDeath + MedRent
##
## Df Sum of Sq RSS AIC
## <none> 986856236 508.94
## + PoliticParty 2 106156435 880699801 509.64
## + MayorGend 1 42575120 944281117 509.66
## + MedHHIncome 1 23750544 963105692 510.23
## + TotCitPop 1 5643348 981212888 510.77
## + Largest_Racial_Group 1 3858740 982997496 510.83
##
## Call:
## lm(formula = TotalSP_Filings ~ CovidDeath + MedRent, data = datDisNZero)
##
## Coefficients:
## (Intercept) CovidDeath MedRent
## 13298.064 4.313 -11.068
## lm(formula = TotalSP_Filings ~ CovidDeath + MedRent, data = dat)
## data = dat)
#lowest AIC=508.94 The AIC is lowest for TotalSP_Filings ~ CovidDeath + MedRent.
This is now the best model.
Model 2A aka Best Demographics Model
Total Eviction Filings vs. Demographics of Study Cities
mod2a <- lm(formula = TotalSP_Filings ~ CovidDeath + MedRent, data = datDisNZero)
summary(mod2a)##
## Call:
## lm(formula = TotalSP_Filings ~ CovidDeath + MedRent, data = datDisNZero)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11351 -4293 1096 3983 10073
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 13298.0640 6144.4289 2.164 0.0398 *
## CovidDeath 4.3131 0.5561 7.756 0.0000000315 ***
## MedRent -11.0678 5.9286 -1.867 0.0732 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6161 on 26 degrees of freedom
## Multiple R-squared: 0.6996, Adjusted R-squared: 0.6765
## F-statistic: 30.27 on 2 and 26 DF, p-value: 0.0000001623
Model 1B: Eviction Filings vs. Policy Variables
To avoid mistakenly treating the categorical policy data as continuous, all categorical data were converted to descriptive strings (YES/NO).
mod1b <- lm(TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 + IOE_NoFilingNonP +
IOE_NoFilingEmerg + IOE_CARES + CP_HearSusp + CP_JudgPos +
CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP +
EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis + STS_FreeUt + STS_GraceP +
STS_NoReport + STS_ForMort + TPM_NoFee + TPM_HouseStab, data = datDisNZero)
summary(mod1b)##
## Call:
## lm(formula = TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 +
## IOE_NoFilingNonP + IOE_NoFilingEmerg + IOE_CARES + CP_HearSusp +
## CP_JudgPos + CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 +
## EEO_NoRemNonP + EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis +
## STS_FreeUt + STS_GraceP + STS_NoReport + STS_ForMort + TPM_NoFee +
## TPM_HouseStab, data = datDisNZero)
##
## Residuals:
## Min 1Q Median 3Q Max
## -18510.0 -729.5 0.0 729.5 16766.0
##
## Coefficients: (5 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 10943 4008 2.730 0.0172 *
## IOE_NoNoticeYES 2012 14864 0.135 0.8944
## IOE_NoFilingC19YES -30778 15739 -1.956 0.0724 .
## IOE_NoFilingNonPYES 18052 27382 0.659 0.5212
## IOE_NoFilingEmergYES NA NA NA NA
## IOE_CARESYES 4489 11857 0.379 0.7111
## CP_HearSuspYES 1870 17241 0.108 0.9153
## CP_JudgPosYES 4331 12676 0.342 0.7381
## CP_DeadlineExYES -6499 16648 -0.390 0.7026
## CP_EviSealedYES 16288 19014 0.857 0.4071
## EEO_NoRemC19YES 28472 15394 1.850 0.0872 .
## EEO_NoRemNonPYES -29793 27186 -1.096 0.2930
## EEO_NoRemEmergYES 7870 18478 0.426 0.6771
## STS_MortExtYES 3870 14864 0.260 0.7986
## STS_NoUtDisYES -3230 15394 -0.210 0.8371
## STS_FreeUtYES 6313 7762 0.813 0.4307
## STS_GracePYES -1386 10977 -0.126 0.9014
## STS_NoReportYES NA NA NA NA
## STS_ForMortYES NA NA NA NA
## TPM_NoFeeYES NA NA NA NA
## TPM_HouseStabYES NA NA NA NA
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8963 on 13 degrees of freedom
## Multiple R-squared: 0.6821, Adjusted R-squared: 0.3153
## F-statistic: 1.859 on 15 and 13 DF, p-value: 0.1341
Order of Significance by Step Through
Backward Selection
Run backward selection for model1b.
Variables that remain after backward selection are TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt.
AIC = 522.09
step(mod1b, direction = "backward")## Start: AIC=536.58
## TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 + IOE_NoFilingNonP +
## IOE_NoFilingEmerg + IOE_CARES + CP_HearSusp + CP_JudgPos +
## CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP +
## EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis + STS_FreeUt +
## STS_GraceP + STS_NoReport + STS_ForMort + TPM_NoFee + TPM_HouseStab
##
##
## Step: AIC=536.58
## TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 + IOE_NoFilingNonP +
## IOE_NoFilingEmerg + IOE_CARES + CP_HearSusp + CP_JudgPos +
## CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP +
## EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis + STS_FreeUt +
## STS_GraceP + STS_NoReport + STS_ForMort + TPM_NoFee
##
##
## Step: AIC=536.58
## TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 + IOE_NoFilingNonP +
## IOE_NoFilingEmerg + IOE_CARES + CP_HearSusp + CP_JudgPos +
## CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP +
## EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis + STS_FreeUt +
## STS_GraceP + STS_NoReport + STS_ForMort
##
##
## Step: AIC=536.58
## TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 + IOE_NoFilingNonP +
## IOE_NoFilingEmerg + IOE_CARES + CP_HearSusp + CP_JudgPos +
## CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP +
## EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis + STS_FreeUt +
## STS_GraceP + STS_NoReport
##
##
## Step: AIC=536.58
## TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 + IOE_NoFilingNonP +
## IOE_NoFilingEmerg + IOE_CARES + CP_HearSusp + CP_JudgPos +
## CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP +
## EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis + STS_FreeUt +
## STS_GraceP
##
##
## Step: AIC=536.58
## TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 + IOE_NoFilingNonP +
## IOE_CARES + CP_HearSusp + CP_JudgPos + CP_DeadlineEx + CP_EviSealed +
## EEO_NoRemC19 + EEO_NoRemNonP + EEO_NoRemEmerg + STS_MortExt +
## STS_NoUtDis + STS_FreeUt + STS_GraceP
##
## Df Sum of Sq RSS AIC
## - CP_HearSusp 1 944805 1045311668 534.61
## - STS_GraceP 1 1281588 1045648451 534.62
## - IOE_NoNotice 1 1471321 1045838184 534.62
## - STS_NoUtDis 1 3536138 1047903001 534.68
## - STS_MortExt 1 5447553 1049814416 534.73
## - CP_JudgPos 1 9378780 1053745643 534.84
## - IOE_CARES 1 11514926 1055881789 534.90
## - CP_DeadlineEx 1 12241479 1056608342 534.92
## - EEO_NoRemEmerg 1 14573388 1058940251 534.98
## - IOE_NoFilingNonP 1 34914502 1079281365 535.54
## - STS_FreeUt 1 53138625 1097505488 536.02
## - CP_EviSealed 1 58958941 1103325803 536.17
## <none> 1044366863 536.58
## - EEO_NoRemNonP 1 96482040 1140848903 537.14
## - EEO_NoRemC19 1 274802092 1319168955 541.36
## - IOE_NoFilingC19 1 307234314 1351601177 542.06
##
## Step: AIC=534.61
## TotalSP_Filings ~ IOE_NoNotice + IOE_NoFilingC19 + IOE_NoFilingNonP +
## IOE_CARES + CP_JudgPos + CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 +
## EEO_NoRemNonP + EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis +
## STS_FreeUt + STS_GraceP
##
## Df Sum of Sq RSS AIC
## - IOE_NoNotice 1 817961 1046129629 532.63
## - STS_GraceP 1 1281588 1046593256 532.64
## - STS_NoUtDis 1 2874902 1048186569 532.69
## - STS_MortExt 1 4506638 1049818306 532.73
## - IOE_CARES 1 10724710 1056036378 532.90
## - CP_DeadlineEx 1 11917049 1057228717 532.94
## - EEO_NoRemEmerg 1 13693400 1059005068 532.99
## - CP_JudgPos 1 31050846 1076362514 533.46
## - IOE_NoFilingNonP 1 55485371 1100797038 534.11
## - STS_FreeUt 1 63168041 1108479708 534.31
## <none> 1045311668 534.61
## - CP_EviSealed 1 109600426 1154912094 535.50
## - EEO_NoRemNonP 1 113241735 1158553403 535.59
## - EEO_NoRemC19 1 300267121 1345578789 539.93
## - IOE_NoFilingC19 1 347900923 1393212591 540.94
##
## Step: AIC=532.63
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + IOE_CARES +
## CP_JudgPos + CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 +
## EEO_NoRemNonP + EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis +
## STS_FreeUt + STS_GraceP
##
## Df Sum of Sq RSS AIC
## - STS_GraceP 1 588543 1046718172 530.65
## - STS_NoUtDis 1 3527017 1049656646 530.73
## - STS_MortExt 1 3827889 1049957519 530.74
## - IOE_CARES 1 12068377 1058198006 530.96
## - EEO_NoRemEmerg 1 26201682 1072331311 531.35
## - CP_JudgPos 1 35049856 1081179485 531.59
## - CP_DeadlineEx 1 36455956 1082585585 531.62
## - STS_FreeUt 1 62376407 1108506036 532.31
## <none> 1046129629 532.63
## - IOE_NoFilingNonP 1 91863736 1137993365 533.07
## - CP_EviSealed 1 172252777 1218382407 535.05
## - EEO_NoRemNonP 1 316458360 1362587989 538.30
## - EEO_NoRemC19 1 412004711 1458134340 540.26
## - IOE_NoFilingC19 1 457826127 1503955757 541.16
##
## Step: AIC=530.65
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + IOE_CARES +
## CP_JudgPos + CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 +
## EEO_NoRemNonP + EEO_NoRemEmerg + STS_MortExt + STS_NoUtDis +
## STS_FreeUt
##
## Df Sum of Sq RSS AIC
## - STS_NoUtDis 1 3390886 1050109058 528.74
## - STS_MortExt 1 6525497 1053243670 528.83
## - IOE_CARES 1 20149739 1066867912 529.20
## - EEO_NoRemEmerg 1 27909210 1074627383 529.41
## - CP_JudgPos 1 34468831 1081187004 529.59
## - CP_DeadlineEx 1 39613030 1086331203 529.72
## - STS_FreeUt 1 63888027 1110606199 530.37
## <none> 1046718172 530.65
## - IOE_NoFilingNonP 1 104709312 1151427485 531.41
## - CP_EviSealed 1 192165834 1238884007 533.54
## - EEO_NoRemNonP 1 328926866 1375645038 536.57
## - EEO_NoRemC19 1 457213738 1503931910 539.16
## - IOE_NoFilingC19 1 499368721 1546086893 539.96
##
## Step: AIC=528.74
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + IOE_CARES +
## CP_JudgPos + CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 +
## EEO_NoRemNonP + EEO_NoRemEmerg + STS_MortExt + STS_FreeUt
##
## Df Sum of Sq RSS AIC
## - STS_MortExt 1 6735868 1056844926 526.93
## - IOE_CARES 1 21876843 1071985901 527.34
## - EEO_NoRemEmerg 1 40530622 1090639680 527.84
## - CP_JudgPos 1 48691088 1098800146 528.06
## - STS_FreeUt 1 60892958 1111002016 528.38
## <none> 1050109058 528.74
## - CP_DeadlineEx 1 95139580 1145248638 529.26
## - IOE_NoFilingNonP 1 101358870 1151467929 529.41
## - CP_EviSealed 1 198448327 1248557385 531.76
## - EEO_NoRemNonP 1 427023144 1477132203 536.64
## - EEO_NoRemC19 1 471564325 1521673383 537.50
## - IOE_NoFilingC19 1 496413588 1546522647 537.97
##
## Step: AIC=526.93
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + IOE_CARES +
## CP_JudgPos + CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 +
## EEO_NoRemNonP + EEO_NoRemEmerg + STS_FreeUt
##
## Df Sum of Sq RSS AIC
## - IOE_CARES 1 17271737 1074116663 525.40
## - EEO_NoRemEmerg 1 38763134 1095608060 525.97
## - CP_JudgPos 1 51744630 1108589556 526.31
## - STS_FreeUt 1 59176106 1116021032 526.51
## <none> 1056844926 526.93
## - CP_DeadlineEx 1 91416811 1148261737 527.33
## - IOE_NoFilingNonP 1 116895484 1173740410 527.97
## - CP_EviSealed 1 192527826 1249372752 529.78
## - EEO_NoRemNonP 1 447769846 1504614772 535.17
## - EEO_NoRemC19 1 503760851 1560605777 536.23
## - IOE_NoFilingC19 1 524521650 1581366576 536.61
##
## Step: AIC=525.4
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_JudgPos +
## CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP +
## EEO_NoRemEmerg + STS_FreeUt
##
## Df Sum of Sq RSS AIC
## - EEO_NoRemEmerg 1 24594059 1098710722 524.05
## <none> 1074116663 525.40
## - CP_JudgPos 1 86639720 1160756383 525.65
## - CP_DeadlineEx 1 87723284 1161839946 525.67
## - STS_FreeUt 1 97566648 1171683311 525.92
## - CP_EviSealed 1 180054483 1254171145 527.89
## - IOE_NoFilingNonP 1 346126631 1420243294 531.50
## - EEO_NoRemNonP 1 703575072 1777691735 538.01
## - IOE_NoFilingC19 1 932838600 2006955263 541.53
## - EEO_NoRemC19 1 985358599 2059475262 542.27
##
## Step: AIC=524.05
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_JudgPos +
## CP_DeadlineEx + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP +
## STS_FreeUt
##
## Df Sum of Sq RSS AIC
## - CP_DeadlineEx 1 63724969 1162435691 523.69
## - CP_JudgPos 1 73355725 1172066447 523.93
## <none> 1098710722 524.05
## - STS_FreeUt 1 187649016 1286359737 526.63
## - CP_EviSealed 1 252420834 1351131555 528.05
## - IOE_NoFilingNonP 1 438140502 1536851224 531.79
## - EEO_NoRemNonP 1 773937760 1872648481 537.52
## - IOE_NoFilingC19 1 932838600 2031549322 539.88
## - EEO_NoRemC19 1 1046224772 2144935494 541.45
##
## Step: AIC=523.69
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_JudgPos +
## CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt
##
## Df Sum of Sq RSS AIC
## - CP_JudgPos 1 16266402 1178702093 522.09
## <none> 1162435691 523.69
## - STS_FreeUt 1 241345026 1403780717 527.16
## - IOE_NoFilingNonP 1 542760528 1705196219 532.80
## - CP_EviSealed 1 543540689 1705976380 532.81
## - IOE_NoFilingC19 1 932838600 2095274291 538.77
## - EEO_NoRemNonP 1 1002362232 2164797923 539.72
## - EEO_NoRemC19 1 1075711066 2238146757 540.69
##
## Step: AIC=522.09
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_EviSealed +
## EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt
##
## Df Sum of Sq RSS AIC
## <none> 1178702093 522.09
## - STS_FreeUt 1 329338684 1508040778 527.24
## - CP_EviSealed 1 557651625 1736353718 531.32
## - IOE_NoFilingNonP 1 612098053 1790800146 532.22
## - IOE_NoFilingC19 1 932838600 2111540694 537.00
## - EEO_NoRemNonP 1 987978618 2166680712 537.75
## - EEO_NoRemC19 1 1059612218 2238314312 538.69
##
## Call:
## lm(formula = TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP +
## CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt,
## data = datDisNZero)
##
## Coefficients:
## (Intercept) IOE_NoFilingC19YES IOE_NoFilingNonPYES
## 9792 -35267 31520
## CP_EviSealedYES EEO_NoRemC19YES EEO_NoRemNonPYES
## 25204 34112 -36094
## STS_FreeUtYES
## 10682
#TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt
mod1bB <- lm(TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt, data = datDisNZero)Forward Selection of Mod1B
Setting up the forward selection.
Keeps TotalSP_Filings ~ STS_ForMort + CP_EviSealed + IOE_CARES + IOE_NoFilingNonP + EEO_NoRemC19.
AIC = 531.96
fullmodb <- mod1b
intonlyb <- lm(TotalSP_Filings ~1, data = datDisNZero)
step(intonly, scope=list(lower=intonlyb, upper=fullmodb), direction="forward")## Start: AIC=539.82
## TotalSP_Filings ~ 1
##
## Df Sum of Sq RSS AIC
## + STS_ForMort 1 417267911 2867813678 537.88
## + CP_EviSealed 1 317872870 2967208719 538.86
## + STS_FreeUt 1 314770658 2970310931 538.89
## + IOE_NoFilingC19 1 299258834 2985822754 539.05
## <none> 3285081589 539.82
## + STS_GraceP 1 209885643 3075195946 539.90
## + STS_NoReport 1 209885643 3075195946 539.90
## + IOE_NoFilingNonP 1 208930432 3076151157 539.91
## + IOE_NoFilingEmerg 1 208930432 3076151157 539.91
## + STS_NoUtDis 1 133464836 3151616753 540.61
## + IOE_CARES 1 91823092 3193258496 540.99
## + EEO_NoRemC19 1 58432848 3226648740 541.30
## + IOE_NoNotice 1 52397079 3232684510 541.35
## + CP_DeadlineEx 1 52221186 3232860403 541.35
## + STS_MortExt 1 45651898 3239429691 541.41
## + TPM_HouseStab 1 43068262 3242013327 541.43
## + TPM_NoFee 1 22916286 3262165302 541.61
## + CP_HearSusp 1 7877418 3277204170 541.75
## + EEO_NoRemEmerg 1 1117504 3283964085 541.81
## + EEO_NoRemNonP 1 907555 3284174034 541.81
## + CP_JudgPos 1 181505 3284900084 541.81
##
## Step: AIC=537.88
## TotalSP_Filings ~ STS_ForMort
##
## Df Sum of Sq RSS AIC
## + CP_EviSealed 1 467629292 2400184386 534.71
## <none> 2867813678 537.88
## + EEO_NoRemC19 1 159726325 2708087352 538.21
## + IOE_CARES 1 145884674 2721929004 538.36
## + STS_FreeUt 1 110697972 2757115706 538.73
## + STS_NoUtDis 1 96142447 2771671231 538.89
## + STS_GraceP 1 95547159 2772266519 538.89
## + STS_NoReport 1 95547159 2772266519 538.89
## + CP_DeadlineEx 1 59593621 2808220057 539.27
## + CP_JudgPos 1 29941261 2837872417 539.57
## + EEO_NoRemEmerg 1 26226931 2841586746 539.61
## + IOE_NoNotice 1 13361868 2854451810 539.74
## + STS_MortExt 1 11059197 2856754480 539.76
## + TPM_HouseStab 1 9379223 2858434454 539.78
## + TPM_NoFee 1 7639254 2860174424 539.80
## + IOE_NoFilingNonP 1 2100198 2865713480 539.85
## + IOE_NoFilingEmerg 1 2100198 2865713480 539.85
## + EEO_NoRemNonP 1 1998726 2865814951 539.86
## + IOE_NoFilingC19 1 1450300 2866363378 539.86
## + CP_HearSusp 1 291206 2867522471 539.87
##
## Step: AIC=534.71
## TotalSP_Filings ~ STS_ForMort + CP_EviSealed
##
## Df Sum of Sq RSS AIC
## + IOE_CARES 1 217889692 2182294694 533.95
## <none> 2400184386 534.71
## + STS_FreeUt 1 125974071 2274210315 535.15
## + EEO_NoRemC19 1 100281086 2299903300 535.48
## + TPM_NoFee 1 59632564 2340551821 535.98
## + STS_GraceP 1 59308860 2340875525 535.99
## + STS_NoReport 1 59308860 2340875525 535.99
## + IOE_NoFilingNonP 1 34730050 2365454336 536.29
## + IOE_NoFilingEmerg 1 34730050 2365454336 536.29
## + STS_NoUtDis 1 21747134 2378437252 536.45
## + CP_DeadlineEx 1 17051935 2383132450 536.51
## + IOE_NoFilingC19 1 15340915 2384843470 536.53
## + EEO_NoRemNonP 1 8053869 2392130517 536.62
## + IOE_NoNotice 1 7830480 2392353906 536.62
## + CP_HearSusp 1 7070185 2393114201 536.63
## + CP_JudgPos 1 5252186 2394932199 536.65
## + TPM_HouseStab 1 4104538 2396079848 536.66
## + STS_MortExt 1 3564878 2396619508 536.67
## + EEO_NoRemEmerg 1 715711 2399468675 536.71
##
## Step: AIC=533.95
## TotalSP_Filings ~ STS_ForMort + CP_EviSealed + IOE_CARES
##
## Df Sum of Sq RSS AIC
## + IOE_NoFilingNonP 1 161228421 2021066273 533.73
## + IOE_NoFilingEmerg 1 161228421 2021066273 533.73
## <none> 2182294694 533.95
## + EEO_NoRemC19 1 135975259 2046319434 534.09
## + STS_FreeUt 1 128759876 2053534817 534.19
## + IOE_NoFilingC19 1 59070989 2123223705 535.16
## + CP_HearSusp 1 54753472 2127541222 535.22
## + STS_GraceP 1 25106288 2157188405 535.62
## + STS_NoReport 1 25106288 2157188405 535.62
## + TPM_HouseStab 1 23892472 2158402222 535.63
## + CP_DeadlineEx 1 21897128 2160397565 535.66
## + TPM_NoFee 1 18523778 2163770916 535.71
## + IOE_NoNotice 1 10559456 2171735238 535.81
## + CP_JudgPos 1 7414348 2174880346 535.86
## + STS_NoUtDis 1 7268928 2175025765 535.86
## + EEO_NoRemEmerg 1 4630040 2177664654 535.89
## + EEO_NoRemNonP 1 1376156 2180918538 535.94
## + STS_MortExt 1 41 2182294653 535.95
##
## Step: AIC=533.73
## TotalSP_Filings ~ STS_ForMort + CP_EviSealed + IOE_CARES + IOE_NoFilingNonP
##
## Df Sum of Sq RSS AIC
## + EEO_NoRemC19 1 246026750 1775039523 531.96
## + EEO_NoRemEmerg 1 205311689 1815754584 532.62
## + STS_FreeUt 1 167336112 1853730161 533.22
## <none> 2021066273 533.73
## + EEO_NoRemNonP 1 96066249 1925000023 534.32
## + IOE_NoNotice 1 57841056 1963225216 534.89
## + STS_MortExt 1 15346438 2005719835 535.51
## + CP_JudgPos 1 12544188 2008522084 535.55
## + TPM_NoFee 1 11795453 2009270820 535.56
## + CP_HearSusp 1 2901204 2018165069 535.69
## + STS_NoUtDis 1 893848 2020172425 535.72
## + TPM_HouseStab 1 668811 2020397462 535.72
## + STS_GraceP 1 344688 2020721584 535.72
## + STS_NoReport 1 344688 2020721584 535.72
## + IOE_NoFilingC19 1 151686 2020914587 535.73
## + CP_DeadlineEx 1 8476 2021057797 535.73
##
## Step: AIC=531.96
## TotalSP_Filings ~ STS_ForMort + CP_EviSealed + IOE_CARES + IOE_NoFilingNonP +
## EEO_NoRemC19
##
## Df Sum of Sq RSS AIC
## <none> 1775039523 531.96
## + IOE_NoNotice 1 98969766 1676069757 532.30
## + IOE_NoFilingC19 1 90103401 1684936122 532.45
## + STS_FreeUt 1 56652366 1718387156 533.02
## + TPM_HouseStab 1 29974854 1745064668 533.47
## + CP_DeadlineEx 1 26734185 1748305337 533.52
## + EEO_NoRemEmerg 1 21582505 1753457017 533.61
## + EEO_NoRemNonP 1 18474863 1756564660 533.66
## + CP_HearSusp 1 12957607 1762081915 533.75
## + STS_MortExt 1 10168472 1764871050 533.80
## + STS_NoUtDis 1 9775375 1765264148 533.80
## + TPM_NoFee 1 3336649 1771702873 533.91
## + STS_GraceP 1 321240 1774718282 533.96
## + STS_NoReport 1 321240 1774718282 533.96
## + CP_JudgPos 1 22662 1775016861 533.96
##
## Call:
## lm(formula = TotalSP_Filings ~ STS_ForMort + CP_EviSealed + IOE_CARES +
## IOE_NoFilingNonP + EEO_NoRemC19, data = datDisNZero)
##
## Coefficients:
## (Intercept) STS_ForMortYES CP_EviSealedYES
## 11300 -5703 27075
## IOE_CARESYES IOE_NoFilingNonPYES EEO_NoRemC19YES
## 11070 -9803 6396
mod1bF <- lm(formula = TotalSP_Filings ~ STS_ForMort + CP_EviSealed + IOE_CARES +
IOE_NoFilingNonP + EEO_NoRemC19, data = datDisNZero)The AIC is lowest for variables identified in the backward selection.
This is the best model.
Model 2B
Adjusted R2 is okay at 0.54. P-value = 0.00045, can reject null hypothesis.
mod2b <- lm(formula = TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP +
CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt,
data = datDisNZero)
summary(mod2b)##
## Call:
## lm(formula = TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP +
## CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt,
## data = datDisNZero)
##
## Residuals:
## Min 1Q Median 3Q Max
## -16725 -2507 0 2394 18551
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9792 2293 4.270 0.000312 ***
## IOE_NoFilingC19YES -35267 8452 -4.173 0.000396 ***
## IOE_NoFilingNonPYES 31520 9325 3.380 0.002697 **
## CP_EviSealedYES 25204 7812 3.226 0.003885 **
## EEO_NoRemC19YES 34112 7670 4.447 0.000202 ***
## EEO_NoRemNonPYES -36094 8405 -4.294 0.000294 ***
## STS_FreeUtYES 10682 4308 2.479 0.021307 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7320 on 22 degrees of freedom
## Multiple R-squared: 0.6412, Adjusted R-squared: 0.5433
## F-statistic: 6.552 on 6 and 22 DF, p-value: 0.0004465
Combine Best Models: Binary and Continuous
Model 1C
#mod2b <- lm(formula = TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt, data = datDisNZero)
#mod2a <- lm(formula = TotalSP_Filings ~ CovidDeath + MedRent, data = datDisNZero)
mod1c <- lm(TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt + CovidDeath + MedRent,
data = datDisNZero)
summary(mod1c)##
## Call:
## lm(formula = TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP +
## CP_EviSealed + EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt +
## CovidDeath + MedRent, data = datDisNZero)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10049.3 -3600.7 36.3 2789.0 9527.7
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8164.6800 5664.5157 1.441 0.1650
## IOE_NoFilingC19YES -7542.0980 8228.9257 -0.917 0.3703
## IOE_NoFilingNonPYES 7646.7157 8256.7377 0.926 0.3654
## CP_EviSealedYES 15687.1782 5860.4291 2.677 0.0145 *
## EEO_NoRemC19YES 7428.4187 7801.3388 0.952 0.3524
## EEO_NoRemNonPYES -15199.1106 7319.6015 -2.076 0.0510 .
## STS_FreeUtYES 3813.4207 3356.5544 1.136 0.2693
## CovidDeath 3.8363 0.7837 4.895 0.0000875 ***
## MedRent -3.4382 6.0779 -0.566 0.5779
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5174 on 20 degrees of freedom
## Multiple R-squared: 0.837, Adjusted R-squared: 0.7719
## F-statistic: 12.84 on 8 and 20 DF, p-value: 0.000002337
Backward Selection on Model 1C
Backward Selection: TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP + CovidDeath
AIC = 496.21
step(mod1c, direction = "backward")## Start: AIC=503.2
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_EviSealed +
## EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt + CovidDeath +
## MedRent
##
## Df Sum of Sq RSS AIC
## - MedRent 1 8565687 543907474 501.66
## - IOE_NoFilingC19 1 22485327 557827114 502.40
## - IOE_NoFilingNonP 1 22958000 558299787 502.42
## - EEO_NoRemC19 1 24269209 559610996 502.49
## - STS_FreeUt 1 34549615 569891402 503.02
## <none> 535341787 503.20
## - EEO_NoRemNonP 1 115415098 650756885 506.86
## - CP_EviSealed 1 191792655 727134442 510.08
## - CovidDeath 1 641441987 1176783774 524.04
##
## Step: AIC=501.66
## TotalSP_Filings ~ IOE_NoFilingC19 + IOE_NoFilingNonP + CP_EviSealed +
## EEO_NoRemC19 + EEO_NoRemNonP + STS_FreeUt + CovidDeath
##
## Df Sum of Sq RSS AIC
## - IOE_NoFilingNonP 1 21550148 565457622 500.79
## - EEO_NoRemC19 1 21865710 565773184 500.81
## - IOE_NoFilingC19 1 24075280 567982754 500.92
## - STS_FreeUt 1 34440739 578348213 501.44
## <none> 543907474 501.66
## - EEO_NoRemNonP 1 116792284 660699758 505.30
## - CP_EviSealed 1 200540784 744448258 508.76
## - CovidDeath 1 634794619 1178702093 522.09
##
## Step: AIC=500.79
## TotalSP_Filings ~ IOE_NoFilingC19 + CP_EviSealed + EEO_NoRemC19 +
## EEO_NoRemNonP + STS_FreeUt + CovidDeath
##
## Df Sum of Sq RSS AIC
## - EEO_NoRemC19 1 1623733 567081355 498.87
## - IOE_NoFilingC19 1 2534692 567992315 498.92
## - STS_FreeUt 1 19030422 584488044 499.75
## <none> 565457622 500.79
## - CP_EviSealed 1 184501778 749959400 506.98
## - EEO_NoRemNonP 1 228511264 793968886 508.63
## - CovidDeath 1 1225342524 1790800146 532.22
##
## Step: AIC=498.87
## TotalSP_Filings ~ IOE_NoFilingC19 + CP_EviSealed + EEO_NoRemNonP +
## STS_FreeUt + CovidDeath
##
## Df Sum of Sq RSS AIC
## - IOE_NoFilingC19 1 1151837 568233192 496.93
## - STS_FreeUt 1 18934633 586015989 497.83
## <none> 567081355 498.87
## - CP_EviSealed 1 184360736 751442092 505.04
## - EEO_NoRemNonP 1 331223122 898304477 510.21
## - CovidDeath 1 1674757508 2241838863 536.73
##
## Step: AIC=496.93
## TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP + STS_FreeUt +
## CovidDeath
##
## Df Sum of Sq RSS AIC
## - STS_FreeUt 1 25555749 593788940 496.21
## <none> 568233192 496.93
## - CP_EviSealed 1 183614390 751847582 503.05
## - EEO_NoRemNonP 1 456708964 1024942156 512.04
## - CovidDeath 1 1805117951 2373351143 536.39
##
## Step: AIC=496.21
## TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP + CovidDeath
##
## Df Sum of Sq RSS AIC
## <none> 593788940 496.21
## - CP_EviSealed 1 160507506 754296446 501.15
## - EEO_NoRemNonP 1 434777737 1028566677 510.14
## - CovidDeath 1 2350406194 2944195135 540.64
##
## Call:
## lm(formula = TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP +
## CovidDeath, data = datDisNZero)
##
## Coefficients:
## (Intercept) CP_EviSealedYES EEO_NoRemNonPYES CovidDeath
## 4421.164 13276.751 -8457.219 4.482
Forward identifies the same model.
TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP + CovidDeath is the best combined model.
fullmodc <- mod1c
intonlyc <- lm(TotalSP_Filings ~1, data = datDisNZero)
step(intonly, scope=list(lower=intonlyc, upper=fullmodc), direction="forward")## Start: AIC=539.82
## TotalSP_Filings ~ 1
##
## Df Sum of Sq RSS AIC
## + CovidDeath 1 2165946167 1119135422 510.59
## + CP_EviSealed 1 317872870 2967208719 538.86
## + STS_FreeUt 1 314770658 2970310931 538.89
## + IOE_NoFilingC19 1 299258834 2985822754 539.05
## <none> 3285081589 539.82
## + IOE_NoFilingNonP 1 208930432 3076151157 539.91
## + EEO_NoRemC19 1 58432848 3226648740 541.30
## + MedRent 1 15075611 3270005977 541.68
## + EEO_NoRemNonP 1 907555 3284174034 541.81
##
## Step: AIC=510.59
## TotalSP_Filings ~ CovidDeath
##
## Df Sum of Sq RSS AIC
## + EEO_NoRemNonP 1 364838976 754296446 501.15
## + EEO_NoRemC19 1 205572617 913562805 506.70
## + MedRent 1 132279186 986856236 508.94
## + IOE_NoFilingNonP 1 106305878 1012829544 509.69
## + CP_EviSealed 1 90568744 1028566677 510.14
## <none> 1119135422 510.59
## + IOE_NoFilingC19 1 62673513 1056461909 510.92
## + STS_FreeUt 1 14517426 1104617995 512.21
##
## Step: AIC=501.15
## TotalSP_Filings ~ CovidDeath + EEO_NoRemNonP
##
## Df Sum of Sq RSS AIC
## + CP_EviSealed 1 160507506 593788940 496.21
## <none> 754296446 501.15
## + MedRent 1 14158159 740138287 502.60
## + STS_FreeUt 1 2448864 751847582 503.05
## + IOE_NoFilingNonP 1 1282444 753014002 503.10
## + EEO_NoRemC19 1 980409 753316037 503.11
## + IOE_NoFilingC19 1 452 754295994 503.15
##
## Step: AIC=496.21
## TotalSP_Filings ~ CovidDeath + EEO_NoRemNonP + CP_EviSealed
##
## Df Sum of Sq RSS AIC
## <none> 593788940 496.21
## + STS_FreeUt 1 25555749 568233192 496.93
## + MedRent 1 12619001 581169939 497.58
## + IOE_NoFilingC19 1 7772952 586015989 497.83
## + IOE_NoFilingNonP 1 3781961 590006980 498.02
## + EEO_NoRemC19 1 322654 593466286 498.19
##
## Call:
## lm(formula = TotalSP_Filings ~ CovidDeath + EEO_NoRemNonP + CP_EviSealed,
## data = datDisNZero)
##
## Coefficients:
## (Intercept) CovidDeath EEO_NoRemNonPYES CP_EviSealedYES
## 4421.164 4.482 -8457.219 13276.751
#lm(formula = TotalSP_Filings ~ CovidDeath + EEO_NoRemNonP + CP_EviSealed, data = datDisNZero)Model 2C: Best Combined Model
Adjusted R-squared: 0.7976
p-value: 0.000000001938
Can reject null hypothesis. Model is of decent fit.
mod2c <- lm(formula = TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP +
CovidDeath, data = datDisNZero)
summary(mod2c)##
## Call:
## lm(formula = TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP +
## CovidDeath, data = datDisNZero)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10814.9 -4045.1 674.2 2962.6 9517.9
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4421.1637 1432.0211 3.087 0.004890 **
## CP_EviSealedYES 13276.7508 5107.2860 2.600 0.015440 *
## EEO_NoRemNonPYES -8457.2191 1976.6964 -4.278 0.000242 ***
## CovidDeath 4.4819 0.4505 9.948 0.000000000356 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4874 on 25 degrees of freedom
## Multiple R-squared: 0.8192, Adjusted R-squared: 0.7976
## F-statistic: 37.77 on 3 and 25 DF, p-value: 0.000000001938
ALT MODEL: Evaluating Policy Type Groupings and Demographics on Eviction Filing Rates
Policies are grouped by Initiation of Eviction (IOE), Court Process (CP), Enforcement of Eviction Order (EEO), Short-Term Supports (STS) & Tenancy Preservation Measures (TPM).
Model1 ALT
Adjusted R-squared: 0.7391
p-value: 0.0002924
mod1alt <- lm(formula = TotalSP_Filings ~ SUM_IOE + SUM_CP + SUM_EEO + SUM_STS + SUM_TPM + PoliticParty + MayorGend + MedRent + MedHHIncome + TotCitPop + CovidDeath + Largest_Racial_Group, data = datDisNZero)
summary(mod1alt)##
## Call:
## lm(formula = TotalSP_Filings ~ SUM_IOE + SUM_CP + SUM_EEO + SUM_STS +
## SUM_TPM + PoliticParty + MayorGend + MedRent + MedHHIncome +
## TotCitPop + CovidDeath + Largest_Racial_Group, data = datDisNZero)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7924 -2540 0 2638 10604
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9546.850533 7391.345217 1.292 0.2160
## SUM_IOE 579.234448 953.913487 0.607 0.5528
## SUM_CP 35.007194 1437.545787 0.024 0.9809
## SUM_EEO -4343.555563 1677.222062 -2.590 0.0205 *
## SUM_STS -237.517060 2158.107351 -0.110 0.9138
## SUM_TPM 4477.862303 3394.076482 1.319 0.2068
## PoliticPartyIndependent 6359.711248 9567.429726 0.665 0.5163
## PoliticPartyRepublican 2151.504307 3741.826075 0.575 0.5738
## MayorGendMale -5515.715085 3585.785918 -1.538 0.1448
## MedRent -15.505667 11.611228 -1.335 0.2017
## MedHHIncome 0.253729 0.198001 1.281 0.2195
## TotCitPop 0.004163 0.003655 1.139 0.2725
## CovidDeath 4.316904 0.815110 5.296 0.0000897 ***
## Largest_Racial_GroupWhite -3887.518030 5822.014650 -0.668 0.5145
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5533 on 15 degrees of freedom
## Multiple R-squared: 0.8602, Adjusted R-squared: 0.7391
## F-statistic: 7.101 on 13 and 15 DF, p-value: 0.0002924
Backward Selection
Backward selection identifies TotalSP_Filings ~ SUM_EEO + SUM_TPM + CovidDeath as best model using policy categories as determinants for eviction filing rates.
AIC=497.99
step(mod1alt, direction = "backward")## Start: AIC=508.75
## TotalSP_Filings ~ SUM_IOE + SUM_CP + SUM_EEO + SUM_STS + SUM_TPM +
## PoliticParty + MayorGend + MedRent + MedHHIncome + TotCitPop +
## CovidDeath + Largest_Racial_Group
##
## Df Sum of Sq RSS AIC
## - PoliticParty 2 20819408 480021931 506.04
## - SUM_CP 1 18154 459220678 506.75
## - SUM_STS 1 370814 459573338 506.78
## - SUM_IOE 1 11287657 470490180 507.46
## - Largest_Racial_Group 1 13649327 472851851 507.60
## <none> 459202523 508.75
## - TotCitPop 1 39719553 498922076 509.16
## - MedHHIncome 1 50271084 509473607 509.77
## - SUM_TPM 1 53285768 512488291 509.94
## - MedRent 1 54593086 513795610 510.01
## - MayorGend 1 72434913 531637436 511.00
## - SUM_EEO 1 205315925 664518449 517.47
## - CovidDeath 1 858667489 1317870012 537.33
##
## Step: AIC=506.04
## TotalSP_Filings ~ SUM_IOE + SUM_CP + SUM_EEO + SUM_STS + SUM_TPM +
## MayorGend + MedRent + MedHHIncome + TotCitPop + CovidDeath +
## Largest_Racial_Group
##
## Df Sum of Sq RSS AIC
## - SUM_CP 1 7300846 487322778 504.48
## - SUM_STS 1 10289257 490311188 504.65
## - Largest_Racial_Group 1 12252850 492274781 504.77
## - SUM_IOE 1 30228011 510249943 505.81
## <none> 480021931 506.04
## - TotCitPop 1 49033588 529055519 506.86
## - MedHHIncome 1 58259757 538281689 507.36
## - MayorGend 1 77053209 557075141 508.36
## - MedRent 1 97239608 577261540 509.39
## - SUM_TPM 1 177522760 657544691 513.17
## - SUM_EEO 1 211136438 691158370 514.61
## - CovidDeath 1 945022480 1425044412 535.60
##
## Step: AIC=504.48
## TotalSP_Filings ~ SUM_IOE + SUM_EEO + SUM_STS + SUM_TPM + MayorGend +
## MedRent + MedHHIncome + TotCitPop + CovidDeath + Largest_Racial_Group
##
## Df Sum of Sq RSS AIC
## - SUM_STS 1 7802379 495125157 502.94
## - Largest_Racial_Group 1 30537390 517860168 504.24
## - SUM_IOE 1 32182714 519505492 504.33
## <none> 487322778 504.48
## - TotCitPop 1 44777049 532099827 505.03
## - MedHHIncome 1 63013108 550335886 506.00
## - MayorGend 1 80135052 567457830 506.89
## - MedRent 1 91047304 578370081 507.44
## - SUM_TPM 1 170833508 658156285 511.19
## - SUM_EEO 1 207813153 695135931 512.78
## - CovidDeath 1 973386727 1460709505 534.31
##
## Step: AIC=502.94
## TotalSP_Filings ~ SUM_IOE + SUM_EEO + SUM_TPM + MayorGend + MedRent +
## MedHHIncome + TotCitPop + CovidDeath + Largest_Racial_Group
##
## Df Sum of Sq RSS AIC
## - Largest_Racial_Group 1 23234132 518359289 502.27
## - SUM_IOE 1 28329455 523454612 502.55
## <none> 495125157 502.94
## - TotCitPop 1 55005268 550130425 503.99
## - MedHHIncome 1 56134917 551260074 504.05
## - MedRent 1 86544515 581669671 505.61
## - MayorGend 1 103316986 598442143 506.43
## - SUM_TPM 1 163077259 658202415 509.19
## - SUM_EEO 1 392548350 887673507 517.87
## - CovidDeath 1 989176221 1484301377 532.78
##
## Step: AIC=502.27
## TotalSP_Filings ~ SUM_IOE + SUM_EEO + SUM_TPM + MayorGend + MedRent +
## MedHHIncome + TotCitPop + CovidDeath
##
## Df Sum of Sq RSS AIC
## - SUM_IOE 1 25716015 544075304 501.67
## - MedHHIncome 1 32905226 551264515 502.05
## <none> 518359289 502.27
## - TotCitPop 1 44453003 562812292 502.65
## - MedRent 1 64068064 582427353 503.65
## - MayorGend 1 80352981 598712270 504.45
## - SUM_TPM 1 140586794 658946083 507.23
## - SUM_EEO 1 369350685 887709974 515.87
## - CovidDeath 1 1027976514 1546335803 531.96
##
## Step: AIC=501.67
## TotalSP_Filings ~ SUM_EEO + SUM_TPM + MayorGend + MedRent + MedHHIncome +
## TotCitPop + CovidDeath
##
## Df Sum of Sq RSS AIC
## - MedHHIncome 1 21894587 565969891 500.82
## - TotCitPop 1 22200713 566276017 500.83
## <none> 544075304 501.67
## - MedRent 1 42626075 586701379 501.86
## - MayorGend 1 66819674 610894979 503.03
## - SUM_TPM 1 126025902 670101206 505.71
## - SUM_EEO 1 371304197 915379501 514.76
## - CovidDeath 1 1076756815 1620832120 531.33
##
## Step: AIC=500.82
## TotalSP_Filings ~ SUM_EEO + SUM_TPM + MayorGend + MedRent + TotCitPop +
## CovidDeath
##
## Df Sum of Sq RSS AIC
## - TotCitPop 1 10689987 576659878 499.36
## - MedRent 1 21048167 587018058 499.87
## <none> 565969891 500.82
## - MayorGend 1 45325739 611295631 501.05
## - SUM_TPM 1 107834911 673804803 503.87
## - SUM_EEO 1 352842137 918812028 512.87
## - CovidDeath 1 1336222830 1902192722 533.97
##
## Step: AIC=499.36
## TotalSP_Filings ~ SUM_EEO + SUM_TPM + MayorGend + MedRent + CovidDeath
##
## Df Sum of Sq RSS AIC
## - MedRent 1 16254584 592914462 498.16
## - MayorGend 1 37916407 614576286 499.21
## <none> 576659878 499.36
## - SUM_TPM 1 97145802 673805680 501.87
## - SUM_EEO 1 342800395 919460273 510.89
## - CovidDeath 1 2392758539 2969418417 544.89
##
## Step: AIC=498.16
## TotalSP_Filings ~ SUM_EEO + SUM_TPM + MayorGend + CovidDeath
##
## Df Sum of Sq RSS AIC
## - MayorGend 1 38441809 631356271 497.99
## <none> 592914462 498.16
## - SUM_TPM 1 85033277 677947739 500.05
## - SUM_EEO 1 496215364 1089129826 513.80
## - CovidDeath 1 2392437242 2985351704 543.04
##
## Step: AIC=497.99
## TotalSP_Filings ~ SUM_EEO + SUM_TPM + CovidDeath
##
## Df Sum of Sq RSS AIC
## <none> 631356271 497.99
## - SUM_TPM 1 110816168 742172439 500.68
## - SUM_EEO 1 485889622 1117245893 512.54
## - CovidDeath 1 2570029300 3201385571 543.07
##
## Call:
## lm(formula = TotalSP_Filings ~ SUM_EEO + SUM_TPM + CovidDeath,
## data = datDisNZero)
##
## Coefficients:
## (Intercept) SUM_EEO SUM_TPM CovidDeath
## 3100.344 -3633.506 3537.386 5.182
Forward Selection
Backward selected model is best as Political Party of city government has a heavy skew towards the democrat party.
Forward Selection: TotalSP_Filings ~ CovidDeath + SUM_EEO + PoliticParty
AIC=497.32
fullmodalt <- mod1alt
intonlyalt <- lm(TotalSP_Filings ~1, data = datDisNZero)
step(intonly, scope=list(lower=intonlyalt, upper=fullmodalt), direction="forward")## Start: AIC=539.82
## TotalSP_Filings ~ 1
##
## Df Sum of Sq RSS AIC
## + CovidDeath 1 2165946167 1119135422 510.59
## + TotCitPop 1 946659971 2338421618 531.96
## + SUM_STS 1 244486064 3040595525 539.57
## <none> 3285081589 539.82
## + MayorGend 1 188725376 3096356213 540.10
## + SUM_IOE 1 154879424 3130202165 540.41
## + PoliticParty 2 337946517 2947135071 540.67
## + SUM_TPM 1 57017627 3228063961 541.31
## + MedHHIncome 1 45542134 3239539454 541.41
## + Largest_Racial_Group 1 40492014 3244589575 541.46
## + MedRent 1 15075611 3270005977 541.68
## + SUM_EEO 1 7636852 3277444736 541.75
## + SUM_CP 1 1137631 3283943958 541.81
##
## Step: AIC=510.59
## TotalSP_Filings ~ CovidDeath
##
## Df Sum of Sq RSS AIC
## + SUM_EEO 1 376962983 742172439 500.68
## + SUM_STS 1 271147380 847988041 504.54
## + SUM_CP 1 153860168 965275253 508.30
## + MedRent 1 132279186 986856236 508.94
## + MedHHIncome 1 123706013 995429408 509.19
## <none> 1119135422 510.59
## + SUM_IOE 1 68073520 1051061902 510.77
## + MayorGend 1 29970174 1089165248 511.80
## + PoliticParty 2 102045116 1017090306 511.81
## + TotCitPop 1 15661243 1103474179 512.18
## + SUM_TPM 1 1889529 1117245893 512.54
## + Largest_Racial_Group 1 976 1119134445 512.59
##
## Step: AIC=500.68
## TotalSP_Filings ~ CovidDeath + SUM_EEO
##
## Df Sum of Sq RSS AIC
## + PoliticParty 2 166274094 575898344 497.32
## + SUM_TPM 1 110816168 631356271 497.99
## + MayorGend 1 64224700 677947739 500.05
## <none> 742172439 500.68
## + SUM_STS 1 15575910 726596529 502.06
## + Largest_Racial_Group 1 10187939 731984500 502.28
## + MedHHIncome 1 7221021 734951418 502.39
## + SUM_IOE 1 6145251 736027187 502.43
## + TotCitPop 1 5415108 736757331 502.46
## + SUM_CP 1 3476026 738696413 502.54
## + MedRent 1 3278027 738894412 502.55
##
## Step: AIC=497.32
## TotalSP_Filings ~ CovidDeath + SUM_EEO + PoliticParty
##
## Df Sum of Sq RSS AIC
## <none> 575898344 497.32
## + SUM_TPM 1 22803387 553094957 498.15
## + MayorGend 1 21447273 554451072 498.22
## + SUM_CP 1 9912994 565985350 498.82
## + Largest_Racial_Group 1 6004117 569894227 499.02
## + MedRent 1 1172307 574726037 499.26
## + SUM_IOE 1 648338 575250006 499.29
## + TotCitPop 1 283702 575614642 499.31
## + MedHHIncome 1 169748 575728596 499.31
## + SUM_STS 1 43980 575854364 499.32
##
## Call:
## lm(formula = TotalSP_Filings ~ CovidDeath + SUM_EEO + PoliticParty,
## data = datDisNZero)
##
## Coefficients:
## (Intercept) CovidDeath SUM_EEO
## 4641.931 4.655 -3178.062
## PoliticPartyIndependent PoliticPartyRepublican
## 13361.696 1714.045
Best Alt Model: Policy type groups and demographic attributes most impacting eviction rates
Adjusted R-squared: 0.7847
p-value: 0.000000004146
Can reject null hypothesis.
summary(mod2alt <- lm(TotalSP_Filings ~ SUM_EEO + SUM_TPM + CovidDeath, data=datDisNZero))##
## Call:
## lm(formula = TotalSP_Filings ~ SUM_EEO + SUM_TPM + CovidDeath,
## data = datDisNZero)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11288 -3545 1274 2624 9868
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3100.3444 1661.7678 1.866 0.073861 .
## SUM_EEO -3633.5056 828.3698 -4.386 0.000183 ***
## SUM_TPM 3537.3855 1688.6828 2.095 0.046488 *
## CovidDeath 5.1816 0.5136 10.088 0.000000000269 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5025 on 25 degrees of freedom
## Multiple R-squared: 0.8078, Adjusted R-squared: 0.7847
## F-statistic: 35.03 on 3 and 25 DF, p-value: 0.000000004146
We’ve identified two models, Model 2C and Model 2 Alt, displaying the best fit in relation to total eviction filings.
We created two separate models as the policy type group data was created by summing the variables used in the first model and therefore could not be used in the same model with those variables.
1). Model 2C: TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP + CovidDeath
CovidDeath: Covid Death Rate of Study Period for Each City
CP_EviSealed: COURT PROCESS: Eviction records sealed
EEO_NoRemNonP: ENFORCEMENT OF EVICTION ORDER: No removal of tenant for nonpayment
2). Model 2 Alt: TotalSP_Filings ~ SUM_EEO + SUM_TPM + CovidDeath
EEO: ENFORCEMENT OF EVICTION ORDER
TPM: TENANCY PRESERVATION MEASURES
Covid Death: Covid Death Rate of Study Period for Each City
Exploration of the regressed relationship between statistically significant independent variables and total eviction filings during the study period.
ggplot(dat, aes(CovidDeathLog, TotalSP_FilingsLog)) +
geom_point(size=3, shape=20, color="blue3") +
geom_smooth(method='lm', se=FALSE, color="grey40") +
ggtitle("Regression: Total Filings and Covid Death Rates") +
xlab("Covid Deaths") + ylab("Total Filings") + plotThemeggplot(dat, aes(CP_EviSealed, TotalSP_FilingsLog)) +
geom_point(size=3, shape=20, color="magenta4") +
geom_smooth(method='lm', se=FALSE, color="grey40") +
ggtitle("Regression: Total Filings and Eviction Records Sealed") +
xlab("Policy") + ylab("Total Filings") + plotThemeggplot(dat, aes(EEO_NoRemNonP, TotalSP_FilingsLog)) +
geom_point(size=3, shape=20, color="cornflowerblue") +
geom_smooth(method='lm', se=FALSE, color="grey40") +
ggtitle("Regression: Total Filings and No Removal for NonPayment") +
xlab("Policy") + ylab("Total Filings") + plotThemeggplot(dat, aes(SUM_EEO, TotalSP_FilingsLog)) +
geom_point(size=3, shape=20, color="orchid") +
geom_smooth(method='lm', se=FALSE, color="grey40") +
ggtitle("Regression: Total Filings and Policy Group: EEO") +
xlab("EEO Policy Count") + ylab("Total Filings") + plotThemeggplot(dat, aes(PoliticParty, TotalSP_FilingsLog)) +
geom_point(size=3, shape=20, color="lightslateblue") +
geom_smooth(method='lm', se=FALSE, color="grey40") +
ggtitle("Regression: Total Filings and Political Party of City Gov't") +
xlab("Political Party") + ylab("Total Filings") + plotTheme######
ggplot(dat, aes(MajorWhite , TotalSP_Filings)) +
geom_point(size=3, shape=20, color="darkviolet") +
geom_smooth(method='lm', se=FALSE, color="grey40") +
ggtitle("Total Filings and Majority White Cities") +
xlab("Majority White Population") + ylab("Total Filings") + plotThemeggplot(dat, aes(CovidDeath , TotalSP_Filings)) +
geom_point(size=3, shape=20, color="lightseagreen") +
geom_smooth(method='lm', se=FALSE, color="grey40") +
ggtitle("Total Filings and Total Covid Deaths") +
xlab("Covid Deaths by City") + ylab("Total Filings") + plotThemeScenario Plot of Best Demographic Model
Scenario: Predicted impact of Covid death rates and Median Rent on eviction filing rates.
#mod2a <- lm(formula = TotalSP_Filings ~ CovidDeath + #MedRent, data = datDisNZero)
#summary(mod2a)
mod2a <- lm(formula = TotalSP_Filings ~ CovidDeath + MedRent, data = dat)
#mod2c <- lm(formula = TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP +
# CovidDeath, data = datDisNZero)
newdat_mod2a <- data.frame(matrix(ncol = 2, nrow = nrow(dat)))
colnames(newdat_mod2a) <- c("CovidDeath", "MedRent")
newdat_mod2a$CovidDeath <- dat$CovidDeath
newdat_mod2a$MedRent <- 1006 #median
newdat_mod2a1 <- data.frame(matrix(ncol = 2, nrow = nrow(dat)))
colnames(newdat_mod2a1) <- c("CovidDeath", "MedRent")
newdat_mod2a1$CovidDeath <- dat$CovidDeath
newdat_mod2a1$MedRent <- 797 #min
newdat_mod2a2 <- data.frame(matrix(ncol = 2, nrow = nrow(dat)))
colnames(newdat_mod2a2) <- c("CovidDeath", "MedRent")
newdat_mod2a2$CovidDeath <- dat$CovidDeath
newdat_mod2a2$MedRent <- 1657 #max
pred_datmod2a <- data.frame(matrix(ncol = 4, nrow = nrow(dat)))
colnames(pred_datmod2a)<- c("CovidDeath", "Pred_MedRent_Median", "Pred_MedRent_Min", "Pred_MedRent_Max")
pred_datmod2a$CovidDeath<-dat$CovidDeath
pred_datmod2a$Pred_MedRent_Median<- predict(mod2a, newdat_mod2a, type="response")
pred_datmod2a$Pred_MedRent_Min<- predict(mod2a, newdat_mod2a1, type="response")
pred_datmod2a$Pred_MedRent_Max<- predict(mod2a, newdat_mod2a2, type="response")
dat_gg <- gather(pred_datmod2a, -CovidDeath, key = "Scenario", value = "value")
ggplot(dat_gg, aes(x = CovidDeath, y = value, colour = Scenario)) +
geom_line() + ylim(0,50000) + xlab("Covid Deaths") +
ylab("Eviction Filings") + ggtitle("Predicted: Impact of Death Rates and Median Rent on Eviction Filings") + plotThemeModel 2A: Demographic Variables
Scenario Plot of Best Combined Variable Model
Scenario: Predicted impact of EviSealed, NoRemNonP, and Covid death rates on eviction filing rates.
#mod2c <- lm(formula = TotalSP_Filings ~ CP_EviSealed + EEO_NoRemNonP +
# CovidDeath, data = datDisNZero)
newdat_combo <- data.frame(matrix(ncol = 3, nrow = nrow(datDisNZero)))
colnames(newdat_combo) <- c("CovidDeath", "CP_EviSealed", "EEO_NoRemNonP")
newdat_combo$CovidDeath <- datDisNZero$CovidDeath
newdat_combo$CP_EviSealed <- "YES"
newdat_combo$EEO_NoRemNonP <- "NO"
newdat_combo1 <- data.frame(matrix(ncol = 3, nrow = nrow(datDisNZero)))
colnames(newdat_combo1) <- c("CovidDeath", "CP_EviSealed", "EEO_NoRemNonP")
newdat_combo1$CovidDeath <- datDisNZero$CovidDeath
newdat_combo1$CP_EviSealed <- "YES"
newdat_combo1$EEO_NoRemNonP <- "YES"
newdat_combo2 <- data.frame(matrix(ncol = 3, nrow = nrow(datDisNZero)))
colnames(newdat_combo2) <- c("CovidDeath", "CP_EviSealed", "EEO_NoRemNonP")
newdat_combo2$CovidDeath <- datDisNZero$CovidDeath
newdat_combo2$CP_EviSealed <- "NO"
newdat_combo2$EEO_NoRemNonP <- "YES"
pred_datcombo <- data.frame(matrix(ncol = 3, nrow = nrow(datDisNZero)))
colnames(pred_datcombo)<- c("CovidDeath", "Pred_YesEviSeal_NoRemPay", "Pred_YesEviSeal_YesRemPay")
pred_datcombo$CovidDeath<-datDisNZero$CovidDeath
pred_datcombo$Pred_YesEviSeal_NoRemPay<- predict(mod2c, newdat_combo, type="response")
pred_datcombo$Pred_YesEviSeal_YesRemPay<- predict(mod2c, newdat_combo1, type="response")
pred_datcombo <- data.frame(matrix(ncol = 4, nrow = nrow(datDisNZero)))
colnames(pred_datcombo)<- c("CovidDeath", "Pred_YesEviSeal_NoRemPay", "Pred_YesEviSeal_YesRemPay","Pred_NoEviSeal_YesRemPay")
pred_datcombo$CovidDeath<-datDisNZero$CovidDeath
pred_datcombo$Pred_YesEviSeal_NoRemPay<- predict(mod2c, newdat_combo, type="response")
pred_datcombo$Pred_YesEviSeal_YesRemPay<- predict(mod2c, newdat_combo1, type="response")
pred_datcombo$Pred_NoEviSeal_YesRemPay<- predict(mod2c, newdat_combo2, type="response")
dat_gg <- gather(pred_datcombo, -CovidDeath, key = "Scenario", value = "value")
ggplot(dat_gg, aes(x = CovidDeath, y = value, colour = Scenario)) +
geom_line() + ylim(0,50000) + xlab("Covid Deaths") +
ylab("Eviction Filings") + ggtitle("Predicted: Impact of Death Rates and Eviction Prevention Policies on Filings") + plotThemeModel 2C: Combination Demographics & Policy Model
Scenario Plot of Best Policy Groups Model
Scenario: Predicted impact of EEO: Enforcement of Eviction Order and TPM: Tenancy Preservation Measure, and Covid death rates on eviction filing rates.
##mod2alt <- lm(TotalSP_Filings ~ SUM_EEO + SUM_TPM + CovidDeath, data=datDisNZero))
newdat_4scen <- data.frame(matrix(ncol = 3, nrow = nrow(datDisNZero)))
colnames(newdat_4scen) <- c("CovidDeath", "SUM_EEO", "SUM_TPM")
newdat_4scen$CovidDeath <- datDisNZero$CovidDeath
newdat_4scen$SUM_EEO <- 0.000 #min
newdat_4scen$SUM_TPM <- 0.00 #min
newdat_4scen1 <- data.frame(matrix(ncol = 3, nrow = nrow(datDisNZero)))
colnames(newdat_4scen1) <- c("CovidDeath", "SUM_EEO", "SUM_TPM")
newdat_4scen1$CovidDeath <- datDisNZero$CovidDeath
newdat_4scen1$SUM_EEO <- 1.448 #mean
newdat_4scen1$SUM_TPM <- 0.4483 #mean
newdat_4scen2 <- data.frame(matrix(ncol = 3, nrow = nrow(datDisNZero)))
colnames(newdat_4scen2) <- c("CovidDeath", "SUM_EEO", "SUM_TPM")
newdat_4scen2$CovidDeath <- datDisNZero$CovidDeath
newdat_4scen2$SUM_EEO <- 3.00 #max
newdat_4scen2$SUM_TPM <- 2.00 #max
pred_dat4scen <- data.frame(matrix(ncol = 4, nrow = nrow(datDisNZero)))
colnames(pred_dat4scen)<- c("CovidDeath", "Pred_EEOzero_TPMzero", "Pred_EEOmean_TPMmean","Pred_EEOmax_TPMmax")
pred_dat4scen$CovidDeath<-datDisNZero$CovidDeath
pred_dat4scen$Pred_EEOzero_TPMzero<- predict(mod2alt, newdat_4scen, type="response")
pred_dat4scen$Pred_EEOmean_TPMmean<- predict(mod2alt, newdat_4scen1, type="response")
pred_dat4scen$Pred_EEOmax_TPMmax<- predict(mod2alt, newdat_4scen2, type="response")
dat_gg4 <- gather(pred_dat4scen, -CovidDeath, key = "Scenario", value = "value")
ggplot(dat_gg4, aes(x = CovidDeath, y = value, colour = Scenario)) +
geom_line() + ylim(0,28000) + xlim(0,4000) + xlab("Covid Deaths") +
ylab("Eviction Filings") + ggtitle("Predicted: Policy Groups on Eviction Filings over Covid Death") + plotThemeModel 2 Alt: Demographics & Policy Groups
The variable white population as largest share of total population was marked as statistically significant and correlated with eviction filings during our study period. As majority of the cities in our study sample had populations in which their greatest racial concentration was white and given the small sample size, we decided to exclude this variable from our models. However, we were interested in visualizing some of the dynamics occurring between eviction filings and our statistically significant policy variables. Below is that plot.
Scenario: Predicted impact of majority white population, EviSealed, NoRemNonP, and Covid death rates on eviction filing rates.
mod3c <- lm(TotalSP_Filings ~ CovidDeath + MajorWhite +
CP_EviSealed + EEO_NoRemNonP, data = dat)
newdat_combine <- data.frame(matrix(ncol = 4, nrow = nrow(dat)))
colnames(newdat_combine) <- c("CovidDeath", "MajorWhite", "CP_EviSealed", "EEO_NoRemNonP")
newdat_combine$CovidDeath <- dat$CovidDeath
newdat_combine$MajorWhite <- 0
newdat_combine$CP_EviSealed <- 1
newdat_combine$EEO_NoRemNonP <-0
newdat_combine1 <- data.frame(matrix(ncol = 4, nrow = nrow(dat)))
colnames(newdat_combine1) <- c("CovidDeath", "MajorWhite", "CP_EviSealed", "EEO_NoRemNonP")
newdat_combine1$CovidDeath <- dat$CovidDeath
newdat_combine1$MajorWhite <- 1
newdat_combine1$CP_EviSealed <- 0
newdat_combine1$EEO_NoRemNonP <-0
newdat_combine2 <- data.frame(matrix(ncol = 4, nrow = nrow(dat)))
colnames(newdat_combine2) <- c("CovidDeath", "MajorWhite", "CP_EviSealed", "EEO_NoRemNonP")
newdat_combine2$CovidDeath <- dat$CovidDeath
newdat_combine2$MajorWhite <- 1
newdat_combine2$CP_EviSealed <- 0
newdat_combine2$EEO_NoRemNonP <- 1
newdat_combine3 <- data.frame(matrix(ncol = 4, nrow = nrow(dat)))
colnames(newdat_combine3) <- c("CovidDeath", "MajorWhite", "CP_EviSealed", "EEO_NoRemNonP")
newdat_combine3$CovidDeath <- dat$CovidDeath
newdat_combine3$MajorWhite <- 0
newdat_combine3$CP_EviSealed <- 1
newdat_combine3$EEO_NoRemNonP <- 1
pred_dat <- data.frame(matrix(ncol = 3, nrow = nrow(dat)))
colnames(pred_dat)<- c("CovidDeath", "Pred_NonWht_YesEviSeal_NoRemPay", "Pred_Wht_NoEviSeal_NoRemPay")
pred_dat$CovidDeath<-dat$CovidDeath
pred_dat$Pred_NonWht_YesEviSeal_NoRemPay<- predict(mod3c, newdat_combine, type="response")
pred_dat$Pred_Wht_NoEviSeal_NoRemPay<- predict(mod3c, newdat_combine1, type="response")
pred_dat <- data.frame(matrix(ncol = 4, nrow = nrow(dat)))
colnames(pred_dat)<- c("CovidDeath", "Pred_NonWht_YesEviSeal_NoRemPay", "Pred_Wht_NoEviSeal_NoRemPay","Pred_Wht_NoEviSeal_YesRemPay")
pred_dat$CovidDeath<-dat$CovidDeath
pred_dat$Pred_NonWht_YesEviSeal_NoRemPay<- predict(mod3c, newdat_combine, type="response")
pred_dat$Pred_Wht_NoEviSeal_NoRemPay<- predict(mod3c, newdat_combine1, type="response")
pred_dat$Pred_Wht_NoEviSeal_YesRemPay<- predict(mod3c, newdat_combine2, type="response")
pred_dat <- data.frame(matrix(ncol = 5, nrow = nrow(dat)))
colnames(pred_dat)<- c("CovidDeath", "Pred_NonWht_YesEviSeal_NoRemPay", "Pred_Wht_NoEviSeal_NoRemPay", "Pred_Wht_NoEviSeal_YesRemPay", "Pred_NonWht_YesEviSeal_YesRemPay")
pred_dat$CovidDeath<-dat$CovidDeath
pred_dat$Pred_NonWht_YesEviSeal_NoRemPay<- predict(mod3c, newdat_combine, type="response")
pred_dat$Pred_Wht_NoEviSeal_NoRemPay<- predict(mod3c, newdat_combine1, type="response")
pred_dat$Pred_Wht_NoEviSeal_YesRemPay<- predict(mod3c, newdat_combine2, type="response")
pred_dat$Pred_NonWht_YesEviSeal_YesRemPay<- predict(mod3c, newdat_combine3, type="response")
dat_gg <- gather(pred_dat, -CovidDeath, key = "Scenario", value = "value")
ggplot(dat_gg, aes(x = CovidDeath, y = value, colour = Scenario)) +
geom_line() + ylim(0,50000) + xlab("Covid Deaths") +
ylab("Eviction Filings") + ggtitle("Predicted ") + plotTheme