#importing data
library(readxl)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.6
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.1     ✔ tibble    3.3.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.2
## ✔ purrr     1.2.1     
## ── 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
selecthousehold<-read.csv("household.csv")
selectmortgage<-read.csv("mortgage.csv")
selectperson<-read.csv("person.csv")
selectproject<-read.csv("project.csv")
#summary stats for household - marketvalue data 
cleanedselecthousehold <- selecthousehold %>% filter(PERPOVLVL > 0, MARKETVAL > 0)
summary(cleanedselecthousehold$MARKETVAL)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1000  238520  392593  529330  626254 9999998
#histogram for household - marketvalue data 
hist(cleanedselecthousehold$MARKETVAL)

#summary stats for household - percent of poverty level 
summary(cleanedselecthousehold$PERPOVLVL)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     1.0   230.0   420.0   358.3   501.0   501.0
#histogram for household - percent of poverty level 
hist(cleanedselecthousehold$PERPOVLVL)

#graph of percent of pov level as predictor of home value 
plot(cleanedselecthousehold$PERPOVLVL, cleanedselecthousehold$MARKETVAL)

#correlation between percent of poverty level and marketvalue 
#The correlation between these two variables is positive = but extremely weak at 0.18. This suggests that other factors contribute to household market value and percent of poverty level contributes very little to market value.  
cor(cleanedselecthousehold$PERPOVLVL,cleanedselecthousehold$MARKETVAL)
## [1] 0.1814647