library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.2     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.1.0     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(pastecs)
## 
## Attaching package: 'pastecs'
## 
## The following objects are masked from 'package:dplyr':
## 
##     first, last
## 
## The following object is masked from 'package:tidyr':
## 
##     extract
library("readxl")
HousingData <- read_csv("Table8.csv")
## Rows: 3221 Columns: 272
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr   (6): source, sumlevel, geoid, name, st, cnty
## dbl (266): T8_est1, T8_est2, T8_est3, T8_est4, T8_est5, T8_est6, T8_est7, T8...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
cor(HousingData %>% select(T8_est69, T8_est3))
##           T8_est69   T8_est3
## T8_est69 1.0000000 0.8999879
## T8_est3  0.8999879 1.0000000

This is comparing owner occupied housing vs renter occupied that has less than or equal to 30% HAMFI

pairs(HousingData %>% select(T8_est69, T8_est3),
      main = "Scatterplot of CHAS Table 8 Variables")

cor.test(HousingData$T8_est69, HousingData$T8_est3, method = "kendall")
## 
##  Kendall's rank correlation tau
## 
## data:  HousingData$T8_est69 and HousingData$T8_est3
## z = 66.232, p-value < 2.2e-16
## alternative hypothesis: true tau is not equal to 0
## sample estimates:
##       tau 
## 0.7804627

I chose Kendall’s Tau test because it makes fewer assumptions than the others. These results (high correlation with very low margin of error) means that there is a significant, positive correlation between the data for renter vs owner households, but it is not exactly the same either.