The 'cran_repo' argument in shelf() was not set, so it will use
cran_repo = 'https://cran.r-project.org' by default.
To avoid this message, set the 'cran_repo' argument to a CRAN
mirror URL (see https://cran.r-project.org/mirrors.html) or set
'quiet = TRUE'.
Code
opts_chunk$set(echo =TRUE)setwd("/Users/briansurratt/Library/CloudStorage/OneDrive-UniversityofTexasatSanAntonio/PAA 2025/R files")options(scipen =999) # This turns off scientific notation.
Reading in the data
Importing the cleaned data for late renter households.
Eviction risk by state score (PAA: Do the probability graphs need to be weighted?)
Code
# Calculating statistics for state score so that I can compare actual values to model-based values.scoreprobs <- latehh %>%group_by(score) %>%summarize(p=mean(highrisk), n=n())scoreprobs$num <- scoreprobs$p*(1-scoreprobs$p)scoreprobs$sep <-sqrt(scoreprobs$num/scoreprobs$n)scoreprobs$me <-2*scoreprobs$sepggplot(data = scoreprobs,aes(x = score, y = p, ymin=p-me, ymax=p+me) ) +geom_line() +ylim(0,1) +geom_ribbon(alpha=0.3,aes(color=NULL) ) +labs(title="Eviction Risk by State Score", subtitle="Respondents in Sample", caption="Source: Household Pulse Survey" ) +xlab(label="State Score") +ylab(label="Proportion of Respondents Who Are At High Risk Of Eviction")
Eviction risk by state score for black vs. non-black
`summarise()` has grouped output by 'nh_black'. You can override using the
`.groups` argument.
Code
scoreprobs$num <- scoreprobs$p*(1-scoreprobs$p)scoreprobs$sep <-sqrt(scoreprobs$num/scoreprobs$n)scoreprobs$me <-2*scoreprobs$sepscoreprobs <- scoreprobs %>%mutate(black =case_when(nh_black ==1~'Black', nh_black ==0~'Non-Black' ) )ggplot(scoreprobs, aes(x = score, y = p, group=black)) +geom_point() +geom_line(aes(color = black)) +labs(x ="Score", y ="Predicted Probability of High Eviction Risk", title ="Predicted Probability of High Eviction Risk for Black versus Non-Black") +scale_color_discrete(name="Probability of High Eviction Risk",breaks=c("Black", "Non-Black"),labels=c("Black", "Non-Black") )
Eviction risk by state score for children vs. no children
`summarise()` has grouped output by 'children'. You can override using the
`.groups` argument.
Code
childprobs$num <- childprobs$p*(1-childprobs$p)childprobs$sep <-sqrt(childprobs$num/childprobs$n)childprobs$me <-2*childprobs$sepchildprobs <- childprobs %>%mutate(child =case_when(children ==1~'Children', children ==0~'No Children' ) )ggplot(childprobs, aes(x = score, y = p, group = child)) +geom_point() +geom_line(aes(color = child)) +labs(x ="Score", y ="Predicted Probability of High Eviction Risk", title ="Predicted Probability of High Eviction Risk Children vs. No children") +scale_color_discrete(name="Probability of High Eviction Risk",breaks=c("Children", "No Children"),labels=c("Children", "No Children") )
Eviction risk by age
Code
# Calculating statistics for specific ages so that I can compare actual values to model-based values.ageprobs<- latehh %>%group_by(age) %>%summarize(p=mean(highrisk),n=n())ageprobs$num <- ageprobs$p*(1-ageprobs$p)ageprobs$sep <-sqrt(ageprobs$num/ageprobs$n)ageprobs$me <-2*ageprobs$sepggplot(data =ageprobs, aes(x = age, y = p, ymin=p-me, ymax=p+me)) +geom_line() +ylim(0,1) +geom_ribbon(alpha=0.3,aes(color=NULL)) +labs(title="Eviction Risk by Age", subtitle="Respondents in Sample", caption="Source: Household Pulse Survey") +xlab(label="Age at Survey") +ylab(label="Proportion of Respondents Who Are At High Risk Of Eviction")
Eviction risk by race/eth
Code
# Calculating statistics for races so that I can compare actual values to model-based values.raceprobs<- latehh %>%group_by(race_eth) %>%summarize(p=mean(highrisk), n=n())raceprobs$num <- raceprobs$p*(1-raceprobs$p)raceprobs$sep <-sqrt(raceprobs$num/raceprobs$n)raceprobs$me <-2*raceprobs$sepggplot(data =raceprobs, aes(x = race_eth, y = p, ymin=p-me, ymax=p+me)) +geom_boxplot() +ylim(0,1) +geom_ribbon(alpha=0.3,aes(color=NULL)) +labs(title="Eviction Risk by Race/Ethnicity", subtitle="Respondents in Sample", caption="Source: Household Pulse Survey") +xlab(label="Race/Ethnicity") +ylab(label="Proportion of Respondents Who Are At High Risk Of Eviction")
Eviction risk by income level
Not using this code since I formatted the inclvl variable differently
Calculating statistics for inclvl so that I can compare actual values to model-based values.
ggplot(data = incprobs, aes(x = inclvl, y = p, ymin=p-me, ymax=p+me)) + geom_line() + ylim(0,1) + geom_ribbon(alpha=0.3,aes(color=NULL)) + labs(title=“Eviction Risk by Income Level”, subtitle=“Respondents in Sample”, caption=“Source: Household Pulse Survey”) + xlab(label=“Income Level”) + ylab(label=“Proportion of Respondents Who Are At High Risk Of Eviction”)
Eviction risk by number of children
Code
# Calculating statistics for number of children so that I can compare actual values to model-based values.kidsprobs<- latehh %>%group_by(thhld_numkid) %>%summarize(p=mean(highrisk), n=n())kidsprobs$num <- kidsprobs$p*(1-kidsprobs$p)kidsprobs$sep <-sqrt(kidsprobs$num/kidsprobs$n)kidsprobs$me <-2*kidsprobs$sepggplot(data =kidsprobs, aes(x = thhld_numkid, y = p, ymin=p-me, ymax=p+me)) +geom_line() +ylim(0,1) +geom_ribbon(alpha=0.3,aes(color=NULL)) +labs(title="Eviction Risk by Number of Children",subtitle="Respondents in Sample",caption="Source: Household Pulse Survey") +xlab(label="Number of Children") +ylab(label="Proportion of Respondents Who Are At High Risk Of Eviction")
Scatterplot of score vs highrisk
I need to make a table that groups by state score and finds a mean or median of the evictrisk variable.
Making a table grouped by state score with mean evictrisk.
“Evictrisk” is defined as “How likely is it that your household will have to leave this home or apartment within the next two months because of eviction? Select only one answer.” 1 is not likely at all, 2 is not very likely, 3 is somewhat likely, and 4 is very likely.
# A tibble: 51 × 3
state score highrisk
<chr> <dbl> <dbl>
1 Alabama 0.83 0.5
2 Alaska 1.23 0.441
3 Arizona 0.23 0.476
4 Arkansas 0 0.483
5 California 1.33 0.406
6 Colorado 3.38 0.429
7 Connecticut 3.78 0.365
8 Delaware 3.88 0.375
9 District of Columbia 4.63 0.314
10 Florida 1.58 0.439
# ℹ 41 more rows
ggplot2 scatter plot
Code
risk_by_score_plot <-ggplot(scoreplot, aes(x=score, y=highrisk)) +geom_point() +geom_smooth(method="lm", se=TRUE, fullrange=FALSE, level=0.95) +ylim(0,1) +labs(title ="Mean Perceived Likelihood of Eviction by State Score",subtitle ="Renters Who Are Not Current On Rent", x="State Score", y ="Mean Perceived Likelihood of Eviction",caption ="Source: HH Pulse and COVID State Housing Policy Score") +stat_cor(method ="pearson", label.x =2, label.y =0.65) +theme(plot.title =element_text(size =20),plot.subtitle =element_text(size =15),axis.title.x =element_text(size =15),axis.title.y =element_text(size =15) )#theme_classic()#labs(title="Perceived Eviction Risk by State Score", x="State Score", y = "Perceived Eviction Risk") +#stat_regline_equation(label.x=2, label.y=3.5) + # This adds the regression equation#stat_cor(aes(label=after_stat(rr.label)), label.x=2, label.y=3.2) + # This adds the r squaredrisk_by_score_plot
Note: `s.d.denom` not specified; assuming "pooled".
Balance summary across all treatment pairs
Type Max.Diff.Un M.Threshold.Un
age Contin. 0.0937 Not Balanced, >0.05
female Binary 0.0547 Not Balanced, >0.05
nh_white Binary 0.1158 Not Balanced, >0.05
hispanic Binary 0.1223 Not Balanced, >0.05
nh_black Binary 0.0371 Balanced, <0.05
nh_asian Binary 0.0507 Not Balanced, >0.05
other Binary 0.0360 Balanced, <0.05
inclvl1 Binary 0.0642 Not Balanced, >0.05
inclvl2 Binary 0.0053 Balanced, <0.05
inclvl3 Binary 0.0605 Not Balanced, >0.05
hsorless Binary 0.0215 Balanced, <0.05
somecollege Binary 0.0686 Not Balanced, >0.05
baorhigher Binary 0.0901 Not Balanced, >0.05
unmarried Binary 0.0569 Not Balanced, >0.05
children Binary 0.0722 Not Balanced, >0.05
Balance tally for mean differences
count
Balanced, <0.05 4
Not Balanced, >0.05 11
Variable with the greatest mean difference
Variable Max.Diff.Un M.Threshold.Un
hispanic 0.1223 Not Balanced, >0.05
Sample sizes
medium high low
All 5713 5811 5136
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.0918918 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Correlation matrix not shown by default, as p = 26 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.0918918 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Warning: Unable to extract a variance-covariance matrix using this `vcov`
argument. Standard errors are computed using the default variance
instead. Perhaps the model or argument is not supported by the
`sandwich` ('HC0', 'HC3', ~clusterid, etc.) or `clubSandwich` ('CR0',
etc.) packages. If you believe that the model is supported by one of
these two packages, you can open a feature request on Github.
Warning: Unable to extract a variance-covariance matrix using this `vcov`
argument. Standard errors are computed using the default variance
instead. Perhaps the model or argument is not supported by the
`sandwich` ('HC0', 'HC3', ~clusterid, etc.) or `clubSandwich` ('CR0',
etc.) packages. If you believe that the model is supported by one of
these two packages, you can open a feature request on Github.
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.00334097 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Correlation matrix not shown by default, as p = 14 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.00334097 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Warning: Unable to extract a variance-covariance matrix using this `vcov`
argument. Standard errors are computed using the default variance
instead. Perhaps the model or argument is not supported by the
`sandwich` ('HC0', 'HC3', ~clusterid, etc.) or `clubSandwich` ('CR0',
etc.) packages. If you believe that the model is supported by one of
these two packages, you can open a feature request on Github.
Warning: Unable to extract a variance-covariance matrix using this `vcov`
argument. Standard errors are computed using the default variance
instead. Perhaps the model or argument is not supported by the
`sandwich` ('HC0', 'HC3', ~clusterid, etc.) or `clubSandwich` ('CR0',
etc.) packages. If you believe that the model is supported by one of
these two packages, you can open a feature request on Github.
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.0222058 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Correlation matrix not shown by default, as p = 26 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.0222058 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Warning: Unable to extract a variance-covariance matrix using this `vcov`
argument. Standard errors are computed using the default variance
instead. Perhaps the model or argument is not supported by the
`sandwich` ('HC0', 'HC3', ~clusterid, etc.) or `clubSandwich` ('CR0',
etc.) packages. If you believe that the model is supported by one of
these two packages, you can open a feature request on Github.
Warning: Unable to extract a variance-covariance matrix using this `vcov`
argument. Standard errors are computed using the default variance
instead. Perhaps the model or argument is not supported by the
`sandwich` ('HC0', 'HC3', ~clusterid, etc.) or `clubSandwich` ('CR0',
etc.) packages. If you believe that the model is supported by one of
these two packages, you can open a feature request on Github.
Plot of Model 2: High Eviction Risk by State Score
This model has controls, but no weights, no interaction
Code
plot_m2<-plot_predictions(m2, condition =c("score")) +labs(title ="Predicted Probability of High Eviction Risk by State Score",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Score",breaks=c(),labels=c("Score") ) +scale_fill_discrete(name="Score",breaks=c(),labels=c("Score") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('plot_m2.png')
Code
plot_m2
Plot of Model 2: Race/Ethnicity
This model has controls, but no weights, no interaction
Code
plot_race_ethm2 <-plot_predictions(m2, condition =c("score", "race_eth")) +labs(title ="Predicted Probability of High Eviction Risk, by Race/Ethnicity",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Race/Ethnicity",breaks=c("nh_white", "nh_black", "hispanic", "nh_asian", "other"),labels=c("White", "Black", "Hispanic", "Asian", "Other") ) +scale_fill_discrete(name="Race/Ethnicity",breaks=c("nh_white", "nh_black", "hispanic", "nh_asian", "other"),labels=c("White", "Black", "Hispanic", "Asian", "Other") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('race_ethm2.png')
Code
plot_race_ethm2
Plot of Model 2: Income
This model has controls, but no weights, no interaction
plot_inclvlm2 <-plot_predictions(m2, condition =c("score", "inclvl")) +labs(title ="Predicted Probability of High Eviction Risk, Income Level",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Income Level",breaks=c("lessthan25", "25to49", "50andover"),labels=c("Less than $25K", "$25K to $49K", "$50K and over") ) +scale_fill_discrete(name="Income Level",breaks=c("lessthan25", "25to49", "50andover"),labels=c("Less than $25K", "$25K to $49K", "$50K and over") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('plot_inclvlm2.png')
Code
plot_inclvlm2
Plot of Model 2: Education
This model has controls, but no weights, no interaction
plot_educm2 <-plot_predictions(m2, condition =c("score", "educ")) +labs(title ="Predicted Probability of High Eviction Risk, Education Level",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Education Level",breaks=c("HSorless", "somecollege", "BAorhigher"),labels=c("Highschool or less", "Some college", "BA or Higher") ) +scale_fill_discrete(name="Education Level",breaks=c("HSorless", "somecollege", "BAorhigher"),labels=c("Highschool or less", "Some college", "BA or Higher") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('educm2.png')
Code
plot_educm2
Plot of Model 2: Marital status
This model has controls, but no weights, no interaction
Code
plot_unmarriedm2 <-plot_predictions(m2, condition =c("score", "unmarried")) +labs(title ="Predicted Probability of High Eviction Risk, Marital Status",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Marital Status",breaks=c("1", "0"),labels=c("Unmarried", "Married") ) +scale_fill_discrete(name="Marital Status",breaks=c("1", "0"),labels=c("Unmarried", "Married") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('unmarriedm2.png')
Code
plot_unmarriedm2
Plot of Model 2: Presence of Children in Household
Code
plot_childrenm2 <-plot_predictions(m2, condition =c("score", "children")) +labs(title ="Predicted Probability of High Eviction Risk, Presence of Children in Household",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Presence of Children in Household",breaks=c("1", "0"),labels=c("Children in Household", "No Children in Household") ) +scale_fill_discrete(name="Presence of Children in Household",breaks=c("1", "0"),labels=c("Children in Household", "No Children in Household") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('childrenm2.png')
Code
plot_childrenm2
(I’m not adding model 3s because they aren’t weighted)
Plots for Model 5: With controls and with weight
Plot of Model 5: High Eviction Risk by State Score
With controls, with weight
Code
plot_scorem5 <-plot_predictions(m5, condition =c("score")) +labs(title ="Predicted Probability of High Likelihood of Eviction by State Score",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Score",breaks=c(),labels=c("Score") ) +scale_fill_discrete(name="Score",breaks=c(),labels=c("Score") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Likelihood of Eviction") +# ylim(0, 0)png('plot_scorem5.png')
Code
plot_scorem5
Code
ggsave("plot_scorem5.png", path ="./figures/")
Saving 7 x 5 in image
Plot of Model 5: Race/Ethnicity
Code
plot_m5race_eth <-plot_predictions(m5, condition =c("score", "race_eth")) +labs(title ="Predicted Probability of High Likelihood of Eviction, by Race/Ethnicity",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Race/Ethnicity",breaks=c("nh_black", "other", "nh_white", "hispanic", "nh_asian"),labels=c("Black", "Other", "White", "Hispanic", "Asian") ) +scale_fill_discrete(name="Race/Ethnicity",breaks=c("nh_black", "other", "nh_white", "hispanic", "nh_asian"),labels=c("Black", "Other", "White", "Hispanic", "Asian") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Likelihood of Eviction") +# ylim(0, 0)png('m5race_eth.png')
Code
plot_m5race_eth
Code
ggsave("plot_m5race_eth.png", path ="./figures/")
Saving 7 x 5 in image
Plot of Model 5: Income
Code
plot_m5inclvl <-plot_predictions(m5, condition =c("score", "inclvl")) +labs(title ="Predicted Probability of High Eviction Risk, Income Level",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Income Level",breaks=c("lessthan25", "25to49", "50andover"),labels=c("Less than $25K", "$25K to $49K", "$50K and over") ) +scale_fill_discrete(name="Income Level",breaks=c("lessthan25", "25to49", "50andover"),labels=c("Less than $25K", "$25K to $49K", "$50K and over") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('plot_m5inclvl.png')
Code
plot_m5inclvl
Code
ggsave("plot_m5inclvl.png", path ="./figures/")
Saving 7 x 5 in image
Plot of Model 5: Education
Code
plot_m5educ <-plot_predictions(m5, condition =c("score", "educ")) +labs(title ="Predicted Probability of High Eviction Risk, Education Level",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Education Level",breaks=c("HSorless", "somecollege", "BAorhigher"),labels=c("Highschool or less", "Some college", "BA or Higher") ) +scale_fill_discrete(name="Education Level",breaks=c("HSorless", "somecollege", "BAorhigher"),labels=c("Highschool or less", "Some college", "BA or Higher") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('plot_m5educ')
Code
plot_m5educ
Code
ggsave("plot_m5educ.png", path ="./figures/")
Saving 7 x 5 in image
Plot of Model 5: Marital Status
Code
plot_m5unmarried <-plot_predictions(m5, condition =c("score", "unmarried")) +labs(title ="Predicted Probability of High Likelihood of Eviction, Marital Status",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Marital Status",breaks=c("1", "0"),labels=c("Unmarried", "Married") ) +scale_fill_discrete(name="Marital Status",breaks=c("1", "0"),labels=c("Unmarried", "Married") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Likelihood of Eviction") +# ylim(0, 0)png('m5unmarried.png')
Plot of Model 5: Presence of Children in Household
Code
plot_m5children <-plot_predictions(m5, condition =c("score", "children")) +labs(title ="Predicted Probability of High Likelihood of Eviction, Children in Household",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Presence of\nChildren in Household",breaks=c("1", "0"),labels=c("Children in Household", "No Children in Household") ) +scale_fill_discrete(name="Presence of\nChildren in Household",breaks=c("1", "0"),labels=c("Children in Household", "No Children in Household") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Likelihood of Eviction") +# ylim(0, 0)png('m5children.png')
Code
plot_m5children
Code
ggsave("plot_m5children.png", path ="./figures/")
Saving 7 x 5 in image
##Plots for Model 6: full interactions with score
Model 6s are score * all covariates interactions.
Plot of Model 6: Race/Ethnicity
Code
plot_m6race_eth <-plot_predictions(m6, condition =c("score", "race_eth")) +labs(title ="Predicted Probability of High Likelihood of Eviction, by Race/Ethnicity",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Race/Ethnicity",breaks=c("nh_white", "nh_black", "hispanic", "nh_asian", "other"),labels=c("White", "Black", "Hispanic", "Asian", "Other") ) +scale_fill_discrete(name="Race/Ethnicity",breaks=c("nh_white", "nh_black", "hispanic", "nh_asian", "other"),labels=c("White", "Black", "Hispanic", "Asian", "Other") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Likelihood of Eviction") +# ylim(0, 0)png('m6race_eth.png')
Code
plot_m6race_eth
Code
ggsave("plot_m6race_eth.png", path ="./figures/")
Saving 7 x 5 in image
Plot of Model 6: Income
Code
plot_m6inclvl <-plot_predictions(m6, condition =c("score", "inclvl")) +labs(title ="Predicted Probability of High Eviction Risk, Income Level",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Income Level",breaks=c("lessthan25", "25to49", "50andover"),labels=c("Less than $25K", "$25K to $49K", "$50K and over") ) +scale_fill_discrete(name="Income Level",breaks=c("lessthan25", "25to49", "50andover"),labels=c("Less than $25K", "$25K to $49K", "$50K and over") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('plot_m6inclvl.png')
Code
plot_m6inclvl
Code
ggsave("plot_m6inclvl.png", path ="./figures/")
Saving 7 x 5 in image
Plot of Model 6: Education
Code
plot_m6educ <-plot_predictions(m6, condition =c("score", "educ")) +labs(title ="Predicted Probability of High Eviction Risk, Education Level",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Education Level",breaks=c("HSorless", "somecollege", "BAorhigher"),labels=c("Highschool or less", "Some college", "BA or Higher") ) +scale_fill_discrete(name="Education Level",breaks=c("HSorless", "somecollege", "BAorhigher"),labels=c("Highschool or less", "Some college", "BA or Higher") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('plot_m6educ')
Code
plot_m6educ
Code
ggsave("plot_m6educ.png", path ="./figures/")
Saving 7 x 5 in image
Plot of Model 6: Marital Status
Code
plot_m6unmarried <-plot_predictions(m6, condition =c("score", "unmarried")) +labs(title ="Predicted Probability of High Eviction Risk, Marital Status",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Marital Status",breaks=c("1", "0"),labels=c("Unmarried", "Married") ) +scale_fill_discrete(name="Marital Status",breaks=c("1", "0"),labels=c("Unmarried", "Married") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('m6unmarried.png')
Plot of Model 6: Presence of Children in Household
Code
plot_m6children <-plot_predictions(m6, condition =c("score", "children")) +labs(title ="Predicted Probability of High Eviction Risk, Presence of Children in Household",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +scale_color_discrete(name="Presence of Children in Household",breaks=c("1", "0"),labels=c("Children in Household", "No Children in Household") ) +scale_fill_discrete(name="Presence of Children in Household",breaks=c("1", "0"),labels=c("Children in Household", "No Children in Household") ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('m6children.png')
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.00453899 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Correlation matrix not shown by default, as p = 13 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.00453899 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Model 9, Variable for unmarried with children, with controls, with full interaction
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.0653454 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Correlation matrix not shown by default, as p = 24 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.0653454 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Plot of Model 9
Code
plot_m9 <-plot_predictions(m9, condition =c("score", "unwch")) +labs(title ="Predicted Probability of High Eviction Risk, Unmarried with Children",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +# scale_color_discrete(name="Presence of Children in Household",# breaks=c("1", "0"),# labels=c("Children in Household", "No Children in Household")# ) +# scale_fill_discrete(name="Presence of Children in Household",# breaks=c("1", "0"),# labels=c("Children in Household", "No Children in Household")# ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('m9.png')
Code
plot_m9
Code
ggsave("plot_m9.png", path ="./figures/")
Saving 7 x 5 in image
Categorical with 4 variables for marrital status and child status
Make dummy variable
Code
latehh <- latehh %>%mutate(marrchild =case_when(married ==0& children ==1~"UnWCh", married ==1& children ==1~"MWCh", married ==0& children ==0~"UnNoCh", married ==1& children ==0~"MNoCh" ) )
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.00390339 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Correlation matrix not shown by default, as p = 15 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.00390339 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Model 12, categorical marital status by children, full interactions
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.105446 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Correlation matrix not shown by default, as p = 28 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.105446 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Plot of Model 12
Code
plot_m12 <-plot_predictions(m12, condition =c("score", "marrchild")) +labs(title ="Predicted Probability of High Eviction Risk, Unmarried with Children",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +# scale_color_discrete(name="Presence of Children in Household",# breaks=c("1", "0"),# labels=c("Children in Household", "No Children in Household")# ) +# scale_fill_discrete(name="Presence of Children in Household",# breaks=c("1", "0"),# labels=c("Children in Household", "No Children in Household")# ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('m12.png')
fixed-effect model matrix is rank deficient so dropping 4 columns / coefficients
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Correlation matrix not shown by default, as p = 17 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
fit warnings:
fixed-effect model matrix is rank deficient so dropping 4 columns / coefficients
optimizer (bobyqa) convergence code: 0 (OK)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Model 15, race by unmarried parent, full interactions
fixed-effect model matrix is rank deficient so dropping 8 columns / coefficients
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in commonArgs(par, fn, control, environment()): maxfun < 10 *
length(par)^2 is not recommended.
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.0805244 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?
Correlation matrix not shown by default, as p = 32 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
fit warnings:
fixed-effect model matrix is rank deficient so dropping 8 columns / coefficients
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.0805244 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?
maxfun < 10 * length(par)^2 is not recommended.
Plot of Model 15
Code
plot_m15 <-plot_predictions(m15, condition =c("score", "rsp")) +labs(title ="Predicted Probability of High Eviction Risk",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +# scale_color_discrete(name="Presence of Children in Household",# breaks=c("1", "0"),# labels=c("Children in Household", "No Children in Household")# ) +# scale_fill_discrete(name="Presence of Children in Household",# breaks=c("1", "0"),# labels=c("Children in Household", "No Children in Household")# ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('m15.png')
Code
plot_m15
Code
ggsave("plot_m15.png", path ="./figures/")
Saving 7 x 5 in image
Sample of only unmarried with children, then test by race
Code
tabyl(latehh, unmarried, children)
unmarried 0 1
0 2111 2863
1 6684 5002
Filter for unmarried with children late households
Code
umwc_latehh <- latehh %>%filter(unmarried ==1& children ==1)nrow(umwc_latehh)
[1] 5002
Write out csv for unmarried with children late households
Code
# Export to csv filesfwrite(umwc_latehh, "./data/umwc_latehh.csv")
Code
tabyl(umwc_latehh$race_eth)
umwc_latehh$race_eth n percent
nh_white 1979 0.39564174
nh_black 1530 0.30587765
hispanic 982 0.19632147
nh_asian 106 0.02119152
other 405 0.08096761
m17 <-glmer(highrisk ~ score + race_eth + age + female + inclvl + educ + (1| abbv), data = umwc_latehh, family = binomial,weights = weights,control =glmerControl(optimizer ="bobyqa"), nAGQ =10 )
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
m18 <-glmer(highrisk ~ score*( race_eth + age + female + inclvl + educ ) + (1| abbv), data = umwc_latehh, family = binomial,weights = weights,control =glmerControl(optimizer ="bobyqa"), nAGQ =10 )
Warning in eval(family$initialize, rho): non-integer #successes in a binomial
glm!
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.0844054 (tol = 0.002, component 1)
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?
Correlation matrix not shown by default, as p = 22 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
optimizer (bobyqa) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.0844054 (tol = 0.002, component 1)
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?
Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?
Plot of Model 18
Code
plot_m18 <-plot_predictions(m18, condition =c("score", "race_eth")) +labs(title ="Predicted Probability of High Eviction Risk",subtitle ="Renters Who Are Not Current On Rent",caption ="Source: HH Pulse and COVID State Housing Policy Score" ) +# scale_color_discrete(name="Presence of Children in Household",# breaks=c("1", "0"),# labels=c("Children in Household", "No Children in Household")# ) +# scale_fill_discrete(name="Presence of Children in Household",# breaks=c("1", "0"),# labels=c("Children in Household", "No Children in Household")# ) +xlab(label ="State Score") +ylab(label ="Predicted Probability of High Eviction Risk") +# ylim(0, 0)png('m18.png')