Analyzing the Relationship Between Median Income and Homeownership
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.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── 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(mdsr) library(viridis)
Loading required package: viridisLite
library(ggplot2)library(ggthemes)
Introduction
With it becoming increasingly challenging for young workers to find homes, this plot attempts to discern a relationship between a state’s homeownership rate and its median income. This data comes from state_stats in the usdata package from r; the map comes from map_data in the maps package.
state_statistics <- state_stats |>filter(state !="District of Columbia") |>mutate(state_name =str_squish(str_to_lower(as.character(state)))) |>right_join(us_states, by =c("state_name"="region"))
state_statistics |>ggplot(aes(x = long, y = lat, group = group)) +geom_polygon(aes(fill = med_income, alpha = homeownership)) +labs(title ="Relationship Between Homeownership and Median Income", fill ="Median Income", alpha ="Homeownership") +theme(axis.title.x =element_blank()) +theme(axis.title.y =element_blank())
Analysis
In this map, we see that there is no clear correlation between median income and home ownership rates in a state. This is most visible in the juxtaposition of West Virginia, the state with the second-lowest median income but highest home ownership rate, and Minnesota, the state with the second-highest home ownership but a much higher median income. We can also see that lower-median income states like Mississippi and Maine have comparatively higher home ownership rates while California, New York, Massachusetts have much lower home ownership rates while simultaneously boasting high median incomes. With this, we can see that there may be other, more important factors that influence home ownership rates. New York and Massachusetts, two states with small land masses but booming economic centers, lack the size to accommodate adequate housing, meaning property prices are much higher and thus less desirable for aspiring homeowners. Furthermore, states on the West Coast have increasingly high standards of living, meaning property prices are undesirable and unaffordable for a large part of these states’ populations. But, in states such as Minnesota, West Virginia, and Michigan, lower housing prices allow for greater home ownership as a greater percentage of the population can afford property. This demonstrates that property prices and land mass are two variables with greater influence on home ownership.