df <- readRDS("C:/Users/court/Google Drive/Research/SRHS/SRHS_coded.RDS")
NOTE Update on September 26, 2021. Variable ‘advertising’ was previously incorrect and was fixed.
df_corr <- df %>% select(
bp_advert_b,
bp_screen_b,
bp_dec_flex_num,
bp_dec_standard_num,
bp_dec_offer_num,
bp_vouch_b,
bp_crim_b,
bp_dis_b,
bp_keep_pct_num,
bp_keep_rsn,
bp_install_b,
bp_comm_unit_fee_app_b,
bp_comm_unit_fee_sec_b,
bp_comm_unit_fee_clean_b,
bp_comm_unit_fee_park_b,
bp_fair_b,
bp_comm_unit_fee_incl_b,
bp_comm_unit_deposit_b,
bp_rent_raise_b,
bp_rent_raise_num,
bp_rent_raise_rising,
bp_rent_raise_regulation,
bp_rent_raise_market,
bp_terminate_b,
bp_terminate_num,
bp_terminate_paylate,
bp_terminate_pay,
bp_court_b,
bp_income_b,
bp_income_num,
ll_remain_1or5yr_scale,
ll_remain_reg
)
df_corr <- df_corr %>% rename(
"Advertising" = bp_advert_b,
"Screening" = bp_screen_b,
"Flexible decision" = bp_dec_flex_num,
"Standard criteria" = bp_dec_standard_num,
"Offers to nonstandard" = bp_dec_offer_num,
"Rent to vouchers" = bp_vouch_b,
"Rent to criminal" = bp_crim_b,
"Disability accom." = bp_dis_b,
"Deposit pct. kept" = bp_keep_pct_num,
"Depsoit kept reason" = bp_keep_rsn,
"Allow installments" = bp_install_b,
"Fair market price" = bp_fair_b,
"App fee" = bp_comm_unit_fee_app_b,
"Security deposit" = bp_comm_unit_fee_sec_b,
"Cleaning fee" = bp_comm_unit_fee_clean_b,
"Parking fee" = bp_comm_unit_fee_park_b,
"Utilities included" = bp_comm_unit_fee_incl_b,
"Last month required" = bp_comm_unit_deposit_b,
"Raised rent" = bp_rent_raise_b,
"Raised rent pct." = bp_rent_raise_num,
"Raised rent - rising costs" = bp_rent_raise_rising,
"Raised rent - regulations" = bp_rent_raise_regulation,
"Raised rent - market" = bp_rent_raise_market,
"Ever terminated" = bp_terminate_b,
"Num of terminations" = bp_terminate_num,
"Terminated - paid late" = bp_terminate_paylate,
"Terminated - non payment" = bp_terminate_pay,
"Terminated - use courts" = bp_court_b,
"Renter income - above avg. Seattle" = bp_income_b,
"Renter income estimate" = bp_income_num,
"Still be prop mngr in 1, 5 yrs" = ll_remain_1or5yr_scale,
"Stop being prop mngr burdensome regs" = ll_remain_reg)
# --------------------------
# # Variable groups
#
#
# # group A
# "Advertising",
# "Screening",
# "Flexible decision",
# "Standard criteria",
# "Offers to nonstandard",
# "Rent to vouchers",
# "Rent to criminal",
# "Disability accom.",
#
# # group B
# "Deposit pct. kept",
# "Depsoit kept reason",
# "Allow installments",
# "Utilities included",
# "App fee",
# "Security deposit",
# "Cleaning fee",
# "Parking fee",
# # group C
#
#
# "Fair market price",
# "Last month required",
# "Raised rent",
# "Raised rent pct.",
# "Raised rent - rising costs",
# "Raised rent - regulations",
# "Raised rent - market",
#
# # group D
# "Ever terminated",
# "Num of terminations",
# "Terminated - paid late",
# "Terminated - non payment",
# "Terminated - use courts",
#
# # group E
# "Renter income - above avg. Seattle",
# "Renter income estimate",
# "Still be prop mngr in 1, 5 yrs",
# "Stop being prop mngr burdensome regs"
df_corr_AB <- df_corr %>%
select("Advertising",
"Screening",
"Flexible decision",
"Standard criteria",
"Offers to nonstandard",
"Rent to vouchers",
"Rent to criminal",
"Disability accom.",
"Deposit pct. kept",
"Depsoit kept reason",
"Allow installments",
"Utilities included",
"App fee",
"Security deposit",
"Cleaning fee",
"Parking fee")
df_corr_AC <- df_corr %>%
select("Advertising",
"Screening",
"Flexible decision",
"Standard criteria",
"Offers to nonstandard",
"Rent to vouchers",
"Rent to criminal",
"Disability accom.",
"Fair market price",
"Last month required",
"Raised rent",
"Raised rent pct.",
"Raised rent - rising costs",
"Raised rent - regulations",
"Raised rent - market")
df_corr_AD <- df_corr %>%
select("Advertising",
"Screening",
"Flexible decision",
"Standard criteria",
"Offers to nonstandard",
"Rent to vouchers",
"Rent to criminal",
"Disability accom.",
"Ever terminated",
"Num of terminations",
"Terminated - paid late",
"Terminated - non payment",
"Terminated - use courts")
df_corr_AE <- df_corr %>%
select("Advertising",
"Screening",
"Flexible decision",
"Standard criteria",
"Offers to nonstandard",
"Rent to vouchers",
"Rent to criminal",
"Disability accom.",
"Renter income - above avg. Seattle",
"Renter income estimate",
"Still be prop mngr in 1, 5 yrs",
"Stop being prop mngr burdensome regs")
df_corr_BC <- df_corr %>%
select("Deposit pct. kept",
"Depsoit kept reason",
"Allow installments",
"Utilities included",
"App fee",
"Security deposit",
"Cleaning fee",
"Parking fee",
"Last month required",
"Raised rent",
"Raised rent pct.",
"Raised rent - rising costs",
"Raised rent - regulations",
"Raised rent - market")
df_corr_BD <- df_corr %>%
select("Deposit pct. kept",
"Depsoit kept reason",
"Allow installments",
"Utilities included",
"App fee",
"Security deposit",
"Cleaning fee",
"Parking fee",
"Ever terminated",
"Num of terminations",
"Terminated - paid late",
"Terminated - non payment",
"Terminated - use courts")
df_corr_BE <- df_corr %>%
select("Deposit pct. kept",
"Depsoit kept reason",
"Allow installments",
"Utilities included",
"App fee",
"Security deposit",
"Cleaning fee",
"Parking fee",
"Renter income - above avg. Seattle",
"Renter income estimate",
"Still be prop mngr in 1, 5 yrs",
"Stop being prop mngr burdensome regs")
df_corr_CD <- df_corr %>%
select("Last month required",
"Raised rent",
"Raised rent pct.",
"Raised rent - rising costs",
"Raised rent - regulations",
"Raised rent - market",
"Ever terminated",
"Num of terminations",
"Terminated - paid late",
"Terminated - non payment",
"Terminated - use courts")
df_corr_CE <- df_corr %>%
select("Last month required",
"Raised rent",
"Raised rent pct.",
"Raised rent - rising costs",
"Raised rent - regulations",
"Raised rent - market",
"Renter income - above avg. Seattle",
"Renter income estimate",
"Still be prop mngr in 1, 5 yrs",
"Stop being prop mngr burdensome regs")
df_corr_DE <- df_corr %>%
select("Ever terminated",
"Num of terminations",
"Terminated - paid late",
"Terminated - non payment",
"Terminated - use courts",
"Renter income - above avg. Seattle",
"Renter income estimate",
"Still be prop mngr in 1, 5 yrs",
"Stop being prop mngr burdensome regs")
#
# library(ggcorrplot)
# model.matrix(~0+., data=df_corr) %>%
# cor(use="pairwise.complete.obs") %>%
# ggcorrplot(
# show.diag = F,
# type="upper",
# lab=TRUE,
# lab_size=1) +
# theme(axis.text.x = element_text(angle=90, size = 6)) +
# theme(axis.text.y = element_text(size = 6) )
#
The business practice variables are grouped into 5 categories and combinations of two categories are correlated at a time to make the correlation plots more readable. ALL variable were forced to be binary or numeric.
Categories:
See below for the list of variables in each category and how they are coded:
library(ggcorrplot)
model.matrix(~0+., data=df_corr_AB) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.5) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_AC) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.3) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_AD) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.5) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_AE) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.1) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_BC) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.1) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_BD) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.5) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_BE) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.5) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_CD) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.8) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_CE) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.5) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
library(ggcorrplot)
model.matrix(~0+., data=df_corr_CE) %>%
cor(use="pairwise.complete.obs") %>%
ggcorrplot(
show.diag = F,
type="upper",
lab=TRUE,
lab_size=2.5) +
theme(axis.text.x = element_text(angle=90, size = 9)) +
theme(axis.text.y = element_text(size = 9) )
NOTE numbers may be slightly different than plots above
NOTE Update on September 26, 2021: Now these included any correlations above 0.2 (or below -0.2)
cor(df_corr,
use="pairwise.complete.obs") %>%
as.data.frame() %>%
mutate(var1 = rownames(.)) %>%
gather(var2, value, -var1) %>%
arrange(desc(value)) %>%
group_by(value) %>%
filter(row_number()==1) %>%
filter(value >=0.20 & value<1.00) %>%
rename(correlation = value) %>%
kbl() %>%
kable_styling(bootstrap_options = c("striped", "hover"))
| var1 | var2 | correlation |
|---|---|---|
| Raised rent pct. | Raised rent | 0.9997291 |
| Renter income estimate | Renter income - above avg. Seattle | 0.6707352 |
| Num of terminations | Ever terminated | 0.5161096 |
| Terminated - non payment | Rent to vouchers | 0.3685769 |
| Offers to nonstandard | Flexible decision | 0.3581552 |
| Renter income estimate | Fair market price | 0.3291559 |
| Rent to criminal | Rent to vouchers | 0.3102654 |
| Fair market price | Security deposit | 0.3064137 |
| Terminated - non payment | Depsoit kept reason | 0.2822975 |
| Fair market price | Parking fee | 0.2818606 |
| Disability accom. | Rent to vouchers | 0.2790958 |
| Renter income estimate | Security deposit | 0.2687971 |
| Standard criteria | Screening | 0.2361623 |
| Depsoit kept reason | Deposit pct. kept | 0.2334017 |
| Ever terminated | Rent to vouchers | 0.2236422 |
| Terminated - non payment | Rent to criminal | 0.2199996 |
| Disability accom. | Rent to criminal | 0.2138545 |
| Ever terminated | Depsoit kept reason | 0.2079277 |
| Terminated - non payment | Disability accom. | 0.2005175 |
cor(df_corr,
use="pairwise.complete.obs") %>%
as.data.frame() %>%
mutate(var1 = rownames(.)) %>%
gather(var2, value, -var1) %>%
arrange((value)) %>%
group_by(value) %>%
filter(row_number()==1) %>%
filter(value <=-0.20 & value>-1.00) %>%
rename(correlation = value) %>%
kbl() %>%
kable_styling(bootstrap_options = c("striped", "hover"))
| var1 | var2 | correlation |
|---|---|---|
| Raised rent - market | Raised rent - rising costs | -0.8837681 |
| Stop being prop mngr burdensome regs | Still be prop mngr in 1, 5 yrs | -0.6833430 |
| Terminated - use courts | Ever terminated | -0.4303814 |
| Raised rent - regulations | Raised rent - rising costs | -0.3528727 |
| Terminated - use courts | Terminated - non payment | -0.3341441 |
| Terminated - use courts | Num of terminations | -0.3146813 |
| Standard criteria | Flexible decision | -0.3137977 |
| Renter income estimate | Rent to vouchers | -0.2553159 |
| Renter income estimate | Terminated - non payment | -0.2444974 |
| Renter income - above avg. Seattle | Rent to vouchers | -0.2354861 |
| Standard criteria | Advertising | -0.2227897 |
| Terminated - use courts | Rent to vouchers | -0.2078241 |
| Renter income estimate | Allow installments | -0.2056145 |
| Screening | Advertising | -0.2000281 |